[llvm-branch-commits] [llvm] [AMDGPU] Apply occupancy-aware register allocation anti-hints (PR #218074)
Syadus Sefat via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Sep 16 20:23:02 PDT 2026
================
@@ -4173,6 +4177,144 @@ bool SIRegisterInfo::getRegAllocationHints(Register VirtReg,
}
}
+bool SIRegisterInfo::shouldApplyAntiHints(
+ const MachineFunction &MF, unsigned NumAllocatedVGPRs,
+ unsigned &MaxVGPRsForCurrentOccupancy) const {
+
+ const SIMachineFunctionInfo *MFI = MF.getInfo<SIMachineFunctionInfo>();
+ unsigned DynamicVGPRBlockSize = MFI->getDynamicVGPRBlockSize();
+ unsigned RecordedMaxOccupancy = MFI->getOccupancy();
+ unsigned CurrentOccupancy =
+ ST.getOccupancyWithNumVGPRs(NumAllocatedVGPRs, DynamicVGPRBlockSize);
+ MaxVGPRsForCurrentOccupancy =
+ ST.getMaxNumVGPRs(CurrentOccupancy, DynamicVGPRBlockSize);
+
+ LLVM_DEBUG(dbgs() << "anti-hints: " << NumAllocatedVGPRs
+ << " VGPRs allocated, RecordedMaxOccupancy "
----------------
mssefat wrote:
Fixed it.
https://github.com/llvm/llvm-project/pull/218074
More information about the llvm-branch-commits
mailing list