Skip to content

[OpenMPOpt] Segmentation fault in Attributor / AAKernelInfoCallSite with function pointer in target region #66094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jplehr opened this issue Sep 12, 2023 · 2 comments
Assignees
Labels

Comments

@jplehr
Copy link
Contributor

jplehr commented Sep 12, 2023

Starting with "[OpenMPOpt] Allow indirect calls in AAKernelInfoCallSite (#65836)" we see one of our internal tests fail.

I have removed some of the macros that were in the original test together with some AMDGCN specific stuff.
The resulting file still triggers the segmentation fault we are seeing in the original test.

0.      Program arguments: /home/janplehr/git/trunk17.0/botbuild/bin/opt -passes=lto<O3> target-func-ptr.cpp.tmp.amdgcn-amd-amdhsa.gfx90a.postlink.bc
 #0 0x000055edfdf23d1f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x4278d1f)
 #1 0x000055edfdf21284 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fb97fe1f420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x000055edfc8e3c5b llvm::IRPosition::getAnchorScope() const AMDGPUAttributor.cpp:0:0
 #4 0x000055edfd9c991a (anonymous namespace)::AAKernelInfo const* llvm::Attributor::getOrCreateAAFor<(anonymous namespace)::AAKernelInfo>(llvm::IRPosition, llvm::AbstractAttribute const*, llvm::DepClassTy, bool, bool) (.constprop.0) OpenMPOpt.cpp:0:0
 #5 0x000055edfd9cc9d2 (anonymous namespace)::AAKernelInfoCallSite::updateImpl(llvm::Attributor&)::'lambda'(llvm::Function*, int)::operator()(llvm::Function*, int) const OpenMPOpt.cpp:0:0
 #6 0x000055edfd9cd3f4 (anonymous namespace)::AAKernelInfoCallSite::updateImpl(llvm::Attributor&) OpenMPOpt.cpp:0:0
 #7 0x000055edfd8a981a llvm::AbstractAttribute::update(llvm::Attributor&) (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x3bfe81a)
 #8 0x000055edfd8c0944 llvm::Attributor::updateAA(llvm::AbstractAttribute&) (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x3c15944)
 #9 0x000055edfd8c958e llvm::Attributor::runTillFixpoint() (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x3c1e58e)
#10 0x000055edfd8dda9a llvm::Attributor::run() (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x3c32a9a)
#11 0x000055edfd9c2749 (anonymous namespace)::OpenMPOpt::runAttributor(bool) (.part.0) OpenMPOpt.cpp:0:0
#12 0x000055edfd9c6da9 (anonymous namespace)::OpenMPOpt::run(bool) OpenMPOpt.cpp:0:0
#13 0x000055edfd9c7e63 llvm::OpenMPOptPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x3d1ce63)
#14 0x000055edfe139ad6 llvm::detail::PassModel<llvm::Module, llvm::OpenMPOptPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) PassBuilder.cpp:0:0
#15 0x000055edfd8168ad llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x3b6b8ad)
#16 0x000055edfc2edde5 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (/home/ja
nplehr/git/trunk17.0/botbuild/bin/opt+0x2642de5)
#17 0x000055edfc2fb786 main (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x2650786)
#18 0x00007fb97f89d083 __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:342:3
#19 0x000055edfc2e0c2e _start (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x2635c2e)
Segmentation fault (core dumped)

I got an IR file out of the original source (thanks for the help with that), that I then ran with opt -passes='lto<O3>' to get the stack trace.
The IR file and the original source is attached in the zip file.

target-func-ptr.zip

@llvmbot
Copy link
Member

llvmbot commented Sep 12, 2023

@llvm/issue-subscribers-openmp

Starting with "[OpenMPOpt] Allow indirect calls in AAKernelInfoCallSite (#65836)" we see one of our internal tests fail.

I have removed some of the macros that were in the original test together with some AMDGCN specific stuff.
The resulting file still triggers the segmentation fault we are seeing in the original test.

0.      Program arguments: /home/janplehr/git/trunk17.0/botbuild/bin/opt -passes=lto<O3> target-func-ptr.cpp.tmp.amdgcn-amd-amdhsa.gfx90a.postlink.bc
 #0 0x000055edfdf23d1f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x4278d1f)
 #1 0x000055edfdf21284 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fb97fe1f420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x000055edfc8e3c5b llvm::IRPosition::getAnchorScope() const AMDGPUAttributor.cpp:0:0
 #4 0x000055edfd9c991a (anonymous namespace)::AAKernelInfo const* llvm::Attributor::getOrCreateAAFor<(anonymous namespace)::AAKernelInfo>(llvm::IRPosition, llvm::AbstractAttribute const*, llvm::DepClassTy, bool, bool) (.constprop.0) OpenMPOpt.cpp:0:0
 #5 0x000055edfd9cc9d2 (anonymous namespace)::AAKernelInfoCallSite::updateImpl(llvm::Attributor&)::'lambda'(llvm::Function*, int)::operator()(llvm::Function*, int) const OpenMPOpt.cpp:0:0
 #6 0x000055edfd9cd3f4 (anonymous namespace)::AAKernelInfoCallSite::updateImpl(llvm::Attributor&) OpenMPOpt.cpp:0:0
 #7 0x000055edfd8a981a llvm::AbstractAttribute::update(llvm::Attributor&) (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x3bfe81a)
 #8 0x000055edfd8c0944 llvm::Attributor::updateAA(llvm::AbstractAttribute&) (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x3c15944)
 #9 0x000055edfd8c958e llvm::Attributor::runTillFixpoint() (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x3c1e58e)
#10 0x000055edfd8dda9a llvm::Attributor::run() (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x3c32a9a)
#11 0x000055edfd9c2749 (anonymous namespace)::OpenMPOpt::runAttributor(bool) (.part.0) OpenMPOpt.cpp:0:0
#12 0x000055edfd9c6da9 (anonymous namespace)::OpenMPOpt::run(bool) OpenMPOpt.cpp:0:0
#13 0x000055edfd9c7e63 llvm::OpenMPOptPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x3d1ce63)
#14 0x000055edfe139ad6 llvm::detail::PassModel<llvm::Module, llvm::OpenMPOptPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) PassBuilder.cpp:0:0
#15 0x000055edfd8168ad llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x3b6b8ad)
#16 0x000055edfc2edde5 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (/home/ja
nplehr/git/trunk17.0/botbuild/bin/opt+0x2642de5)
#17 0x000055edfc2fb786 main (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x2650786)
#18 0x00007fb97f89d083 __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:342:3
#19 0x000055edfc2e0c2e _start (/home/janplehr/git/trunk17.0/botbuild/bin/opt+0x2635c2e)
Segmentation fault (core dumped)

I got an IR file out of the original source (thanks for the help with that), that I then ran with opt -passes='lto<O3>' to get the stack trace.
The IR file and the original source is attached in the zip file.

target-func-ptr.zip

@shiltian shiltian self-assigned this Sep 12, 2023
@xgupta xgupta removed the new issue label Sep 13, 2023
@jplehr
Copy link
Contributor Author

jplehr commented Sep 14, 2023

Fixed in #66274

@jplehr jplehr closed this as completed Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants