Skip to content

[Issue]: ICE during Greedy Register Allocator pass #3995

Description

@StewMH

Problem Description

While building https://github.com/acts-project/acts HIP I have a reproducible internal compiler exception at O3. I confirm it disappears with O2 and O0. The output is as follows:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /opt/rocm-7.2.0/lib/llvm/bin/clang-22 -cc1 -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -O3 -Werror=atomic-alignment -emit-obj -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name combinatorial_kalman_filter_algorithm.cpp -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fno-rounding-math -mconstructor-aliases -aux-target-cpu x86-64 -fcuda-is-device -fno-threadsafe-statics -mllvm -amdgpu-internalize-symbols -fcuda-allow-variadic-functions -fvisibility=hidden -fapply-global-visibility-to-externs -mlink-builtin-bitcode /opt/rocm-7.2.0/lib/llvm/lib/clang/22/lib/amdgcn/bitcode/ocml.bc -mlink-builtin-bitcode /opt/rocm-7.2.0/lib/llvm/lib/clang/22/lib/amdgcn/bitcode/ockl.bc -mlink-builtin-bitcode /opt/rocm-7.2.0/lib/llvm/lib/clang/22/lib/amdgcn/bitcode/oclc_daz_opt_off.bc -mlink-builtin-bitcode /opt/rocm-7.2.0/lib/llvm/lib/clang/22/lib/amdgcn/bitcode/oclc_unsafe_math_off.bc -mlink-builtin-bitcode /opt/rocm-7.2.0/lib/llvm/lib/clang/22/lib/amdgcn/bitcode/oclc_finite_only_off.bc -mlink-builtin-bitcode /opt/rocm-7.2.0/lib/llvm/lib/clang/22/lib/amdgcn/bitcode/oclc_correctly_rounded_sqrt_on.bc -mlink-builtin-bitcode /opt/rocm-7.2.0/lib/llvm/lib/clang/22/lib/amdgcn/bitcode/oclc_wavefrontsize64_on.bc -mlink-builtin-bitcode /opt/rocm-7.2.0/lib/llvm/lib/clang/22/lib/amdgcn/bitcode/oclc_isa_version_90a.bc -mlink-builtin-bitcode /opt/rocm-7.2.0/lib/llvm/lib/clang/22/lib/amdgcn/bitcode/oclc_abi_version_600.bc -target-cpu gfx90a -debugger-tuning=gdb -fdebug-compilation-dir=/build/device/alpaka -fcoverage-compilation-dir=/build/device/alpaka -resource-dir /opt/rocm-7.2.0/lib/llvm/lib/clang/22 -internal-isystem /opt/rocm-7.2.0/lib/llvm/lib/clang/22/include/cuda_wrappers -idirafter /opt/rocm-7.2.0/lib/llvm/bin/../../../include -include __clang_hip_runtime_wrapper.h -isystem /build/_deps/vecmem-build/core/CMakeFiles -isystem /build/_deps/vecmem-src/core/include -isystem /build/_deps/covfie-src/lib/core -isystem /build/_deps/nlohmann_json-src/include -isystem /build/_deps/eigen-src -isystem /build/_deps/alpaka-src/include -isystem /build/_deps/vecmem-build/hip/CMakeFiles -isystem /build/_deps/vecmem-src/hip/include -isystem /build/_deps/covfie-src/lib/hip -isystem /build/_deps/rocthrust-build/thrust/include -isystem /build/_deps/rocthrust-src/thrust/.. -isystem /build/_deps/rocthrust-build/deps/rocprim/include -D ALPAKA_ACC_CPU_B_SEQ_T_THREADS_ENABLED -D ALPAKA_ACC_GPU_HIP_ENABLED -D ALPAKA_BLOCK_SHARED_DYN_MEMBER_ALLOC_KIB=47 -D ALPAKA_DEBUG=0 -D ALPAKA_DISABLE_VENDOR_RNG -D ALPAKA_HAS_STD_ATOMIC_REF -D DETRAY_ALGEBRA_ARRAY -D DETRAY_CUSTOM_SCALARTYPE=float -D DETRAY_INTERNAL_USE_NO_UNIQUE_ADDRESS_ANNOTATION -D DETRAY_LOG_LVL=-1 -D THRUST_IGNORE_CUB_VERSION_CHECK -D USE_PROF_API=1 -D VECMEM_DEBUG_MSG_LVL=0 -D VECMEM_HAVE_PMR_MEMORY_RESOURCE -D VECMEM_SOURCE_DIR_LENGTH=13 -D VECMEM_SUPPORT_POSIX_ATOMIC_REF -D __HIP_PLATFORM_AMD__ -D __HIP_PLATFORM_AMD__=1 -D __HIP_PLATFORM_HCC__ -D __HIP_ROCclr__=1 -D traccc_alpaka_EXPORTS -I /acts/Traccc/device/alpaka/include -I /acts/Traccc/core/include -I /build/core/CMakeFiles/include -I /acts/Detray/core/include -I /build/extern/acts/acts/Detray/core/CMakeFiles -I /build/extern/acts/acts/Detray/core/codegen/50a6c1ef5aadcbd48eb38bfd0e81e3cafd5df725 -I /build/extern/acts/acts/Detray/core/codegen/a2f005b083cf8faabaaa5f19f911494d78be0d8a -I /build/extern/acts/acts/Detray/core/codegen/d3173c582c4b9fb20fc600956089329fb53846db -I /build/extern/acts/acts/Detray/core/codegen/48c37d545b823e72db3942c03873b2cf62cc4aa8 -I /acts/Detray/plugins/algebra/array/include -I /acts/Detray/detectors/include -I /build/extern/acts/acts/Detray/detectors/CMakeFiles/include -I /acts/Detray/io/include -I /acts/Core/include -I /build/extern/acts/acts/Core/include -I /acts/Traccc/device/common/include -I /acts/Traccc/device/hip_utils/include -D NDEBUG -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/x86_64-linux-gnu/c++/13 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/backward -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/x86_64-linux-gnu/c++/13 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/backward -internal-isystem /opt/rocm-7.2.0/lib/llvm/lib/clang/22/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -internal-isystem /opt/rocm-7.2.0/lib/llvm/lib/clang/22/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wall -Wextra -Wshadow -Wunused-local-typedefs -Werror -pedantic -std=c++20 -fdeprecated-macro -fno-autolink -ferror-limit 19 -fmessage-length=272 -fhip-new-launch-api -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -cuid=49b2680ab6437c9b -fcuda-allow-variadic-functions -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/combinatorial_kalman_filter_algorithm-gfx90a-092383.o -x hip /acts/Traccc/device/alpaka/src/finding/combinatorial_kalman_filter_algorithm.cpp
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'CallGraph Pass Manager' on module '/acts/Traccc/device/alpaka/src/finding/combinatorial_kalman_filter_algorithm.cpp'.
4.	Running pass 'Greedy Register Allocator' on function '@_ZNK6detray10rk_stepperIN6covfie10field_viewINS1_7backend6affineINS3_6linearINS3_5clampINS3_7stridedINS1_6vector8vector_dImLm3EEENS3_5arrayINS9_IfLm3EEEmEEEEEESC_EEEEEENS_5arrayIfEENS_18unconstrained_stepIfEENS_17stepper_rk_policyIfEENS_8stepping14void_inspectorELj3EE4stepEfRNSR_5stateERKNSP_6configEbPKNS_8materialIfSt5ratioILl1ELl1EEEE'
 #0 0x00005649cbea9240 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x2893240)
 #1 0x00005649cbea643d SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007f501f045330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #3 0x00005649cb41d7f5 llvm::SplitEditor::extendPHIKillRanges() (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x1e077f5)
 #4 0x00005649cb42a7e6 llvm::SplitEditor::finish(llvm::SmallVectorImpl<unsigned int>*) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x1e147e6)
 #5 0x00005649cb388913 llvm::RAGreedy::tryBlockSplit(llvm::LiveInterval const&, llvm::AllocationOrder&, llvm::SmallVectorImpl<llvm::Register>&) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x1d72913)
 #6 0x00005649cb38e307 llvm::RAGreedy::trySplit(llvm::LiveInterval const&, llvm::AllocationOrder&, llvm::SmallVectorImpl<llvm::Register>&, llvm::SmallSet<llvm::Register, 16u, std::less<llvm::Register>> const&) (.part.0) RegAllocGreedy.cpp:0:0
 #7 0x00005649cb39530f llvm::RAGreedy::selectOrSplitImpl(llvm::LiveInterval const&, llvm::SmallVectorImpl<llvm::Register>&, llvm::SmallSet<llvm::Register, 16u, std::less<llvm::Register>>&, llvm::SmallVector<std::pair<llvm::LiveInterval const*, llvm::MCRegister>, 8u>&, unsigned int) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x1d7f30f)
 #8 0x00005649cb3958f8 llvm::RAGreedy::selectOrSplit(llvm::LiveInterval const&, llvm::SmallVectorImpl<llvm::Register>&) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x1d7f8f8)
 #9 0x00005649cb606553 llvm::RegAllocBase::allocatePhysRegs() (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x1ff0553)
#10 0x00005649cb3913a0 llvm::RAGreedy::run(llvm::MachineFunction&) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x1d7b3a0)
#11 0x00005649cb392888 (anonymous namespace)::RAGreedyLegacy::runOnMachineFunction(llvm::MachineFunction&) RegAllocGreedy.cpp:0:0
#12 0x00005649cb21a67d llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x1c0467d)
#13 0x00005649cb7d7282 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x21c1282)
#14 0x00005649cae0e8aa (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) CallGraphSCCPass.cpp:0:0
#15 0x00005649cb7d7e72 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x21c1e72)
#16 0x00005649cc135762 (anonymous namespace)::EmitAssemblyHelper::RunCodegenPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&) BackendUtil.cpp:0:0
#17 0x00005649cc136233 clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x2b20233)
#18 0x00005649cc76bfd8 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x3155fd8)
#19 0x00005649ce12ce5c clang::ParseAST(clang::Sema&, bool, bool) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x4b16e5c)
#20 0x00005649ccabebae clang::FrontendAction::Execute() (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x34a8bae)
#21 0x00005649cca2e18b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x341818b)
#22 0x00005649ccba2ce4 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0x358cce4)
#23 0x00005649ca2c1735 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0xcab735)
#24 0x00005649ca2b840b ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#25 0x00005649ca2bb62a clang_main(int, char**, llvm::ToolContext const&) (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0xca562a)
#26 0x00005649ca1beaab main (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0xba8aab)
#27 0x00007f501f02a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#28 0x00007f501f02a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#29 0x00005649ca2b7e85 _start (/opt/rocm-7.2.0/lib/llvm/bin/clang-22+0xca1e85)
clang++: error: unable to execute command: Segmentation fault (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
AMD clang version 22.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-7.2.0 26014 7b800a19466229b8479a78de19143dc33c3ab9b5)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/rocm-7.2.0/lib/llvm/bin
Configuration file: /opt/rocm-7.2.0/lib/llvm/bin/clang++.cfg
clang++: note: diagnostic msg: Error generating preprocessed source(s).

Operating System

24.04.3 LTS (Noble Numbat)

CPU

AMD EPYC 7F72 24-Core Processor

GPU

No GPU on system but building for gfx1101 and gfx90a

ROCm Version

ROCm 7.2

ROCm Component

llvm-project

Steps to Reproduce

Since the preprocessed source generation fails you can use this Docker container:

 docker run -it gitlab-registry.cern.ch/smh/rocm_crash/rocm_crash:reproducer-x86_64
root@5ef1e8df7fd8:/build# make traccc_throughput_st_alpaka

which will reproduce the error fairly quickly with ROCm 7.2.

(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions