[llvm] [AMDGPU] Improved register pressure estimates for rescheduling (PR #213116)
Romanov Vlad via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 31 08:34:06 PDT 2026
================
@@ -2216,6 +2214,105 @@ bool MemoryClauseInitialScheduleStage::shouldRevertScheduling(
return mayCauseSpilling(WavesAfter);
}
+static cl::opt<bool> EnableLiveIntervalRPReschedule(
+ "amdgpu-lirp-reschedule", cl::Hidden,
+ cl::desc("Enable live interval RP reschedule stage"), cl::init(true));
+
+static cl::opt<unsigned> LiveIntervalRPThreshold(
+ "amdgpu-lirp-threshold", cl::Hidden,
+ cl::desc("Percent increase of live interval RP over instant pressure to "
+ "trigger rescheduling"),
+ cl::init(10));
+
+static cl::opt<unsigned> LiveIntervalRPVGPRReduction(
+ "amdgpu-lirp-vgpr-reduction", cl::Hidden,
+ cl::desc(
+ "Reduction factor (percent) for VGPR threshold during live interval RP "
+ "reschedule stage"),
+ cl::init(90));
+
+static cl::opt<unsigned> LiveIntervalRPVGPRReductionEpilogue(
+ "amdgpu-lirp-vgpr-reduction-epilogue", cl::Hidden,
+ cl::desc(
+ "Reduction factor (percent) for VGPR threshold during live interval RP "
+ "reschedule stage for exit blocks"),
+ cl::init(70));
+
+bool LiveIntervalRPStage::initGCNSchedStage() {
+ if (!EnableLiveIntervalRPReschedule)
+ return false;
+
+ if (!GCNSchedStage::initGCNSchedStage())
+ return false;
+
+ if (!S.VGPRThresholdPercent) {
+ LLVM_DEBUG(dbgs() << "LIRP: expected VGPRThresholdPercent to be enabled, "
+ "not using live interval RP reschedule stage\n");
+ return false;
+ }
+
+ return true;
+}
+
+bool LiveIntervalRPStage::initGCNRegion() {
+ unsigned InstantRP = DAG.Pressure[RegionIdx].getArchVGPRNum();
----------------
romanovvlad wrote:
I believe we can ds_read into agprs.
AFAIK rewritemfma doesn't guarantee that there are no "over the limit agpr uses", it can only move some vgpr pressure to agpr pressure.
So, I think checking agprs and reducing agpr limit here could be useful, but probably can be done later.
https://github.com/llvm/llvm-project/pull/213116
More information about the llvm-commits
mailing list