Skip to content
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

[hipCUB] test_hipcub_block_histogram crashes at build (InferAddressSpaces) #397

Open
pjaaskel opened this issue Apr 14, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@pjaaskel
Copy link
Collaborator

pjaaskel commented Apr 14, 2023

Steps to repro:

diff --git a/test/hipcub/CMakeLists.txt b/test/hipcub/CMakeLists.txt
index 44ffdb7..52382cb 100644
--- a/test/hipcub/CMakeLists.txt
+++ b/test/hipcub/CMakeLists.txt
@@ -195,7 +195,7 @@ add_hipcub_test("hipcub.CachingDeviceAllocator" test_hipcub_caching_device_alloc
 add_hipcub_test("hipcub.BlockAdjacentDifference" test_hipcub_block_adjacent_difference.cpp)
 add_hipcub_test("hipcub.BlockDiscontinuity" test_hipcub_block_discontinuity.cpp)
 add_hipcub_test("hipcub.BlockExchange" test_hipcub_block_exchange.cpp)
-#add_hipcub_test("hipcub.BlockHistogram" test_hipcub_block_histogram.cpp)
+add_hipcub_test("hipcub.BlockHistogram" test_hipcub_block_histogram.cpp)
  • build it with mkdir build; cd build; CXX=hipcc cmake .. -DDOWNLOAD_ROCPRIM=ON -DBUILD_TEST=ON ; make test_hipcub_block_histogram

Should crash with the backtrace:

[ 11%] Building CXX object test/hipcub/CMakeFiles/test_hipcub_block_histogram.dir/test_hipcub_block_histogram.cpp.o
clang-15: warning: -Wl,-rpath,/usr/lib/x86_64-linux-gnu: 'linker' input unused [-Wunused-command-line-argument]
opt: /home/pjaaskel/src/llvm-project/llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From*) [with To = llvm::Constant; From = llvm::Value]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/pjaaskel/local/stow/llvm-15-cspv-patched-relwdebuginfo/bin/opt /tmp/test_hipcub_block_histogram-generic-link-ffe29c.bc -load-pass-plugin /home/pjaaskel/local/stow/chip-spv/lib/llvm/libLLVMHipSpvPasses.so -passes=hip-post-link-passes -o /tmp/test_hipcub_block_histogram-generic-lower-a64063.bc
 #0 0x00007f510dc99d76 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/pjaaskel/src/llvm-project/llvm/lib/Support/Unix/Signals.inc:569:3
 #1 0x00007f510dc97df4 llvm::sys::RunSignalHandlers() /home/pjaaskel/src/llvm-project/llvm/lib/Support/Signals.cpp:103:20
 #2 0x00007f510dc97f96 SignalHandler(int) /home/pjaaskel/src/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
 #3 0x00007f510cc42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f510cc96a7c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007f510cc96a7c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x00007f510cc96a7c pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x00007f510cc42476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x00007f510cc287f3 abort ./stdlib/abort.c:81:7
 #9 0x00007f510cc2871b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007f510cc39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x00007f510eec4262 llvm::CallBase::setOperand(unsigned int, llvm::Value*) /home/pjaaskel/src/llvm-project/llvm/include/llvm/IR/InstrTypes.h:2364:1
#12 0x00007f510eec4262 llvm::CallBase::setOperand(unsigned int, llvm::Value*) /home/pjaaskel/src/llvm-project/llvm/include/llvm/IR/InstrTypes.h:2364:1
#13 0x00007f510eec4262 llvm::CallBase::setArgOperand(unsigned int, llvm::Value*) /home/pjaaskel/src/llvm-project/llvm/include/llvm/IR/InstrTypes.h:1348:15
#14 0x00007f510eec4262 rewriteIntrinsicOperands /home/pjaaskel/src/llvm-project/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp:369:22
#15 0x00007f510eec4262 (anonymous namespace)::InferAddressSpacesImpl::rewriteWithNewAddressSpaces(llvm::ArrayRef<llvm::WeakTrackingVH>, llvm::DenseMap<llvm::Value const*, unsigned int, llvm::DenseMapInfo<llvm::Value const*, void>, llvm::detail::DenseMapPair<llvm::Value const*, unsigned int>> const&, llvm::DenseMap<std::pair<llvm::Value const*, llvm::Value const*>, unsigned int, llvm::DenseMapInfo<std::pair<llvm::Value const*, llvm::Value const*>, void>, llvm::detail::DenseMapPair<std::pair<llvm::Value const*, llvm::Value const*>, unsigned int>> const&, llvm::Function*) const (.constprop.0) /home/pjaaskel/src/llvm-project/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp:1200:37
#16 0x00007f510eec514b llvm::DenseMap<std::pair<llvm::Value const*, llvm::Value const*>, unsigned int, llvm::DenseMapInfo<std::pair<llvm::Value const*, llvm::Value const*>, void>, llvm::detail::DenseMapPair<std::pair<llvm::Value const*, llvm::Value const*>, unsigned int>>::~DenseMap() /home/pjaaskel/src/llvm-project/llvm/include/llvm/ADT/DenseMap.h:757:22
#17 0x00007f510eec514b (anonymous namespace)::InferAddressSpacesImpl::run(llvm::Function&) (.constprop.0) /home/pjaaskel/src/llvm-project/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp:827:1
#18 0x00007f510eec6507 llvm::InferAddressSpacesPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/pjaaskel/src/llvm-project/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp:1323:3
#19 0x00007f51104bb796 llvm::detail::PassModel<llvm::Function, llvm::InferAddressSpacesPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/pjaaskel/src/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:89:3
#20 0x00007f510de6e5ce llvm::SmallPtrSet<void*, 2u>::operator=(llvm::SmallPtrSet<void*, 2u>&&) /home/pjaaskel/src/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:489:21
#21 0x00007f510de6e5ce llvm::PreservedAnalyses::operator=(llvm::PreservedAnalyses&&) /home/pjaaskel/src/llvm-project/llvm/include/llvm/IR/PassManager.h:152:7
#22 0x00007f510de6e5ce llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/pjaaskel/src/llvm-project/llvm/lib/IR/PassManager.cpp:127:32
#23 0x00007f51104bdbd6 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/pjaaskel/src/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:89:3
#24 0x00007f510de6c181 llvm::SmallPtrSet<void*, 2u>::operator=(llvm::SmallPtrSet<void*, 2u>&&) /home/pjaaskel/src/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:489:21
#25 0x00007f510de6c181 llvm::PreservedAnalyses::operator=(llvm::PreservedAnalyses&&) /home/pjaaskel/src/llvm-project/llvm/include/llvm/IR/PassManager.h:152:7
#26 0x00007f510de6c181 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/pjaaskel/src/llvm-project/llvm/include/llvm/IR/PassManager.h:522:16
#27 0x0000558007adb830 llvm::SmallPtrSetImplBase::isSmall() const /home/pjaaskel/src/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:195:33
#28 0x0000558007adb830 llvm::SmallPtrSetImplBase::~SmallPtrSetImplBase() /home/pjaaskel/src/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:83:17
#29 0x0000558007adb830 llvm::SmallPtrSetImpl<llvm::AnalysisKey*>::~SmallPtrSetImpl() /home/pjaaskel/src/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:344:7
#30 0x0000558007adb830 llvm::SmallPtrSet<llvm::AnalysisKey*, 2u>::~SmallPtrSet() /home/pjaaskel/src/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:450:7
#31 0x0000558007adb830 llvm::PreservedAnalyses::~PreservedAnalyses() /home/pjaaskel/src/llvm-project/llvm/include/llvm/IR/PassManager.h:152:7
#32 0x0000558007adb830 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::StringRef>, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool) /home/pjaaskel/src/llvm-project/llvm/tools/opt/NewPMDriver.cpp:525:10
#33 0x0000558007ace6fb llvm::SmallVectorTemplateCommon<llvm::StringRef, void>::begin() /home/pjaaskel/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h:249:45
#34 0x0000558007ace6fb llvm::SmallVectorTemplateCommon<llvm::StringRef, void>::end() /home/pjaaskel/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h:251:32
#35 0x0000558007ace6fb llvm::SmallVector<llvm::StringRef, 4u>::~SmallVector() /home/pjaaskel/src/llvm-project/llvm/include/llvm/ADT/SmallVector.h:1192:24
#36 0x0000558007ace6fb main /home/pjaaskel/src/llvm-project/llvm/tools/opt/opt.cpp:790:3
#37 0x00007f510cc29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#38 0x00007f510cc29e40 call_init ./csu/../csu/libc-start.c:128:20
#39 0x00007f510cc29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#40 0x0000558007acedb5 _start (/home/pjaaskel/local/stow/llvm-15-cspv-patched-relwdebuginfo/bin/opt+0x1ddb5)
clang-15: error: unable to execute command: Aborted (core dumped)
clang-15: error: hipspv-link command failed due to signal (use -v to see invocation)
clang version 15.0.6 ([email protected]:CHIP-SPV/llvm-project.git 31233417513505db770574f3857f090cdcea3828)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/pjaaskel/local/stow/llvm-15-cspv-patched-relwdebuginfo/bin
clang-15: note: diagnostic msg: Error generating preprocessed source(s).

failed to execute:/home/pjaaskel/local/stow/llvm-15-cspv-patched-relwdebuginfo/bin/clang++ -D__HIP_PLATFORM_SPIRV__= -D__HIP_PLATFORM_SPIRV__= -Xclang -no-opaque-pointers --offload=spirv64 -nohipwrapperinc --hip-path=/home/pjaaskel/local/stow/chip-spv --target=x86_64-unknown-linux-gnu -include /home/pjaaskel/local/stow/chip-spv/include/hip/spirv_fixups.h -isystem "/home/pjaaskel/local/stow/chip-spv/include" -x hip --target=x86_64-linux-gnu -I//home/pjaaskel/local/stow/chip-spv/include -DGTEST_LINKED_AS_SHARED_LIBRARY=1 -I/home/pjaaskel/src/hipCUB/build/hipcub/cub/include -I/home/pjaaskel/src/hipCUB/build/hipcub/cub/include/hipcub -I/home/pjaaskel/src/hipCUB/hipcub/include -isystem /home/pjaaskel/src/hipCUB/build/gtest/include -isystem /home/pjaaskel/src/hipCUB/build/deps/rocprim/include -isystem /home/pjaaskel/local/stow/chip-spv/include/cuspv -O3 -DNDEBUG -x hip -Xclang -no-opaque-pointers -nohipwrapperinc --hip-path=/home/pjaaskel/local/stow/chip-spv -include /home/pjaaskel/local/stow/chip-spv/include/hip/spirv_fixups.h -Wl,-rpath,/usr/lib/x86_64-linux-gnu -std=c++14 -MD -MT test/hipcub/CMakeFiles/test_hipcub_block_histogram.dir/test_hipcub_block_histogram.cpp.o -MF CMakeFiles/test_hipcub_block_histogram.dir/test_hipcub_block_histogram.cpp.o.d -o CMakeFiles/test_hipcub_block_histogram.dir/test_hipcub_block_histogram.cpp.o -c /home/pjaaskel/src/hipCUB/test/hipcub/test_hipcub_block_histogram.cpp

rocPRIM's test_block_histogram reproduces this issue (hipCUB likely just delegates to it).

@pvelesko
Copy link
Collaborator

Fails during llvm -> SPIR-V step now KhronosGroup/SPIRV-LLVM-Translator#2823

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants