[llvm] Re-apply "[AMDGPU][Scheduler] Scoring system for rematerializations (#175050)" (PR #177206)
Mikael Holmen via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 3 02:00:34 PST 2026
mikaelholmen wrote:
Hello @lucas-rami
The following two lit tests start crashing with this patch if we build with EXPENSIVE_CHECKS:
```
FAIL: LLVM :: CodeGen/AMDGPU/copy-hoist-no-spills.ll (1654 of 4564)
FAIL: LLVM :: CodeGen/AMDGPU/sched_mfma_rewrite_copies.mir (3793 of 4564)
```
We get
```
# | llc: ../include/llvm/ADT/DenseMap.h:226: ValueT &llvm::DenseMapBase<llvm::DenseMap<unsigned int, llvm::LaneBitmask>, unsigned int, llvm::LaneBitmask, llvm::DenseMapInfo<unsigned int>, llvm::detail::DenseMapPair<unsigned int, llvm::LaneBitmask>>::at(const_arg_type_t<KeyT>) [DerivedT = llvm::DenseMap<unsigned int, llvm::LaneBitmask>, KeyT = unsigned int, ValueT = llvm::LaneBitmask, KeyInfoT = llvm::DenseMapInfo<unsigned int>, BucketT = llvm::detail::DenseMapPair<unsigned int, llvm::LaneBitmask>]: Assertion `Iter != this->end() && "DenseMap::at failed due to a missing key"' failed.
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
# | Stack dump:
# | 0. Program arguments: /repo/main/llvm/build-all-expensive/bin/llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx950 -run-pass=machine-scheduler -amdgpu-disable-rewrite-mfma-form-sched-stage=false -o - /repo/main/llvm/test/CodeGen/AMDGPU/sched_mfma_rewrite_copies.mir
# | 1. Running pass 'Function Pass Manager' on module '/repo/main/llvm/test/CodeGen/AMDGPU/sched_mfma_rewrite_copies.mir'.
# | 2. Running pass 'Machine Instruction Scheduler' on function '@src2_singledef_singleuse_dst_singleuse_singledef_vgpr'
# | #0 0x000056282a67ac06 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/repo/main/llvm/build-all-expensive/bin/llc+0x8b32c06)
# | #1 0x000056282a678365 llvm::sys::RunSignalHandlers() (/repo/main/llvm/build-all-expensive/bin/llc+0x8b30365)
# | #2 0x000056282a67ba09 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
# | #3 0x00007f593a1cb990 __restore_rt (/lib64/libpthread.so.0+0x12990)
# | #4 0x00007f5937b6a52f raise (/lib64/libc.so.6+0x4e52f)
# | #5 0x00007f5937b3de65 abort (/lib64/libc.so.6+0x21e65)
# | #6 0x00007f5937b3dd39 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21d39)
# | #7 0x00007f5937b62e86 (/lib64/libc.so.6+0x46e86)
# | #8 0x000056282779d224 llvm::PreRARematStage::rematerialize(llvm::PreRARematStage::RematReg const&, llvm::BitVector&, llvm::PreRARematStage::RollbackInfo*) GCNSchedStrategy.cpp:0:0
# | #9 0x000056282779a595 llvm::PreRARematStage::initGCNSchedStage() GCNSchedStrategy.cpp:0:0
# | #10 0x0000562827791f8f llvm::GCNScheduleDAGMILive::runSchedStages() GCNSchedStrategy.cpp:0:0
# | #11 0x0000562829541747 llvm::impl_detail::MachineSchedulerBase::scheduleRegions(llvm::ScheduleDAGInstrs&, bool) (/repo/main/llvm/build-all-expensive/bin/llc+0x79f9747)
# | #12 0x0000562829540a59 llvm::impl_detail::MachineSchedulerImpl::run(llvm::MachineFunction&, llvm::TargetMachine const&, llvm::impl_detail::MachineSchedulerImpl::RequiredAnalyses const&) (/repo/main/llvm/build-all-expensive/bin/llc+0x79f8a59)
# | #13 0x0000562829559986 (anonymous namespace)::MachineSchedulerLegacy::runOnMachineFunction(llvm::MachineFunction&) MachineScheduler.cpp:0:0
# | #14 0x0000562829453167 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/repo/main/llvm/build-all-expensive/bin/llc+0x790b167)
# | #15 0x0000562829a95334 llvm::FPPassManager::runOnFunction(llvm::Function&) (/repo/main/llvm/build-all-expensive/bin/llc+0x7f4d334)
# | #16 0x0000562829a9d562 llvm::FPPassManager::runOnModule(llvm::Module&) (/repo/main/llvm/build-all-expensive/bin/llc+0x7f55562)
# | #17 0x0000562829a95e56 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/repo/main/llvm/build-all-expensive/bin/llc+0x7f4de56)
# | #18 0x0000562826f983b7 compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
# | #19 0x0000562826f95816 main (/repo/main/llvm/build-all-expensive/bin/llc+0x544d816)
# | #20 0x00007f5937b567e5 __libc_start_main (/lib64/libc.so.6+0x3a7e5)
# | #21 0x0000562826f949ae _start (/repo/main/llvm/build-all-expensive/bin/llc+0x544c9ae)
```
https://github.com/llvm/llvm-project/pull/177206
More information about the llvm-commits
mailing list