[llvm] [AMDGPU] Add flag to control VGPR pressure limits (PR #203797)
Lucas Ramirez via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 15 04:23:31 PDT 2026
================
@@ -154,12 +182,31 @@ void GCNSchedStrategy::initialize(ScheduleDAGMI *DAG) {
VGPRBudget = std::max(VGPRBudget, Granule);
VGPRCriticalLimit = std::min(VGPRBudget, VGPRExcessLimit);
}
+ // Apply VGPR excess threshold percentage if specified.
+ if (VGPRExcessThresholdPercentOpt > 0) {
+ [[maybe_unused]] unsigned OriginalVGPRExcessLimit = VGPRExcessLimit;
+ [[maybe_unused]] unsigned OriginalVGPRCriticalLimit = VGPRCriticalLimit;
+ VGPRExcessLimit =
+ (VGPRExcessThresholdPercentOpt * VGPRExcessLimit + 99) / 100;
+ // If the new excess limit would be below the critical limit, adjust the
+ // critical limit as well to maintain the invariant that
+ // VGPRCriticalLimit <= VGPRExcessLimit.
+ if (VGPRExcessLimit < VGPRCriticalLimit)
+ VGPRCriticalLimit = VGPRExcessLimit;
+ LLVM_DEBUG(dbgs() << "Applied VGPR excess threshold "
+ << VGPRExcessThresholdPercentOpt << "%, VGPRExcessLimit: "
+ << OriginalVGPRExcessLimit << " -> " << VGPRExcessLimit
+ << "%, VGPRCriticalLimit: " << OriginalVGPRCriticalLimit
----------------
lucas-rami wrote:
```suggestion
<< ", VGPRCriticalLimit: " << OriginalVGPRCriticalLimit
```
Looks like a spurious "%" in the debug output here.
https://github.com/llvm/llvm-project/pull/203797
More information about the llvm-commits
mailing list