[llvm] [Draft][AMDGPU] Take into account amdgpu-waves-per-eu in getRegPressureLimit (PR #173992)

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 5 05:06:50 PST 2026


================
@@ -3783,7 +3783,13 @@ bool SIRegisterInfo::isAGPR(const MachineRegisterInfo &MRI,
 
 unsigned SIRegisterInfo::getRegPressureLimit(const TargetRegisterClass *RC,
                                              MachineFunction &MF) const {
-  unsigned MinOcc = ST.getOccupancyWithWorkGroupSizes(MF).first;
+  unsigned MinWGSizeOcc = ST.getOccupancyWithWorkGroupSizes(MF).first;
+  unsigned MaxWavesPerEU = ST.getWavesPerEU(MF.getFunction()).second;
+  // The occupancy is bound by the amdgpu-waves-per-eu value specified by the
+  // user. Using a small value for amdgpu-waves-per-eu, should yield bigger
+  // register pressure limits (if resources allow it).
+  unsigned MinOcc = std::min(MinWGSizeOcc, MaxWavesPerEU);
----------------
jmmartinez wrote:

Originally I wanted to do exactly that, and use `ST.getWavesPerEU(...).first` directly.

This allowed for a lower occupancy than `ST.getOccupancyWithWorkGroupSizes(MF).first` and I was worried about doing that change without testing the performance first.

https://github.com/llvm/llvm-project/pull/173992


More information about the llvm-commits mailing list