HCC clamp-device segfaults compiling HIP program
When I link the attached object file with HCC, I get a segfault in clamp-device with ROCm 2.8:
$ /opt/rocm/hip/bin/hipcc --amdgpu-target=gfx906 -o libGPUTrackingHIP.so CMakeFiles/GPUTrackingHIP.dir/GPUReconstructionHIP.hip.cxx.o
Stack dump:
0. Program arguments: /opt/rocm/hcc/bin/llc -mtriple amdgcn-amd-amdhsa -mcpu=gfx906 -mattr=-code-object-v3 -O2 -mattr=+sram-ecc -amdgpu-function-calls=0 -filetype=obj -o /tmp/tmp.1bMsuEt3yu/kernel-gfx906.hsaco.isabin /tmp/tmp.1bMsuEt3yu/kernel-gfx906.hsaco.opt.bc
1. Running pass 'CallGraph Pass Manager' on module '/tmp/tmp.1bMsuEt3yu/kernel-gfx906.hsaco.opt.bc'.
2. Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@_ZN2o23gpu25GPUTPCTrackletConstructor6ThreadILi1EEEviiiiRNS1_18GPUTPCSharedMemoryERNS0_13GPUTPCTrackerE'
#0 0x000000000185b7ea llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/opt/rocm/hcc/bin/llc+0x185b7ea)
#1 0x0000000001859814 llvm::sys::RunSignalHandlers() (/opt/rocm/hcc/bin/llc+0x1859814)
#2 0x0000000001859942 (/opt/rocm/hcc/bin/llc+0x1859942)
#3 0x00007f9dc6365910 (/lib64/libpthread.so.0+0x14910)
#4 0x00000000007cdc96 llvm::SIFrameLowering::emitPrologue(llvm::MachineFunction&, llvm::MachineBasicBlock&) const (/opt/rocm/hcc/bin/llc+0x7cdc96)
#5 0x0000000000fcd31f (/opt/rocm/hcc/bin/llc+0xfcd31f)
#6 0x0000000000f0213f (/opt/rocm/hcc/bin/llc+0xf0213f)
#7 0x0000000001239568 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/rocm/hcc/bin/llc+0x1239568)
#8 0x0000000000bc6958 (/opt/rocm/hcc/bin/llc+0xbc6958)
#9 0x0000000001238956 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/rocm/hcc/bin/llc+0x1238956)
#10 0x0000000000669a1f main (/opt/rocm/hcc/bin/llc+0x669a1f)
#11 0x00007f9dc5b74e5b __libc_start_main (/lib64/libc.so.6+0x23e5b)
#12 0x00000000006c7af5 _start (/opt/rocm/hcc/bin/llc+0x6c7af5)
/opt/rocm/hcc/bin/clamp-device: line 243: 24315 Segmentation fault $LLC -mtriple amdgcn-amd-amdhsa -mcpu=$AMDGPU_TARGET $CODE_OBJECT_FORMAT $KMOPTLLC -amdgpu-function-calls=$AMDGPU_FUNC_CALLS -filetype=obj -o $2.isabin $2.opt.bc
Generating AMD GCN kernel failed in llc for target: gfx906
clang-10: error: linker command failed with exit code 139 (use -v to see invocation)
This failure was not present with ROCm 2.7, it was introduced in 2.8.
I attach the object file, since this is from a larger application with many header files from dependencies, and I could neither easily preprocess the HIP source code nor find a smaller reproducer: GPUReconstructionHIP.hip.cxx.o.tar.gz
To reproduce the error, please run /opt/rocm/hip/bin/hipcc --amdgpu-target=gfx906 -o libGPUTrackingHIP.so GPUReconstructionHIP.hip.cxx.o
Please find attached a second test case with source code instead of an object file: testcase.tar.gz
As compile command, please use: hipcc -DFMT_SHARED -DGLFW_DLL -DGPUCA_BUILD_EVENT_DISPLAY -DGPUCA_BUILD_QA -DGPUCA_GPULIBRARY=HIP -DGPUCA_HAVE_OPENMP -DGPUCA_STANDALONE -DGPUTrackingHIP_EXPORTS -DHAVE_O2HEADERS -DHIP_ENABLED -I/home/qon/alice/O2/GPU/GPUTracking/Standalone -IBase -IBase/opencl-common -ICommon -IDataCompression -IdEdx -Idisplay -IGlobal -IHLTHeaders -IITS -IMerger -Iqa -ISliceTracker -ITPCConvert -ITPCFastTransformation -ITRDTracking -Igpucf -I . -O0 -ggdb --amdgpu-target=gfx906 -g -fPIC -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -Wno-invalid-constexpr -Wno-ignored-optimization-argument -Wno-unused-private-field -std=c++17 /home/qon/alice/O2/GPU/GPUTracking/Base/hip/GPUReconstructionHIP.hip.cxx -o test
hcc is no longer used