[llvm] [AMDGPU] Prefer lower total register usage in regions with spilling (PR #71882)
Valery Pykhtin via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 10 02:25:58 PST 2023
================
@@ -115,7 +119,19 @@ bool GCNRegPressure::less(const GCNSubtarget &ST,
SGPRImportant = false;
}
- // compare large regs pressure
+ // In regions with spilling, we should give prefernce to the schedule with
+ // less general RP.
+ if (Occ <= MFI.getMinWavesPerEU()) {
+ unsigned GPRPressure =
+ SGPRImportant ? getSGPRNum() : getVGPRNum(ST.hasGFX90AInsts());
+ unsigned OtherGPRPressure =
+ SGPRImportant ? O.getSGPRNum() : O.getVGPRNum(ST.hasGFX90AInsts());
+
+ if (GPRPressure != OtherGPRPressure)
+ return GPRPressure < OtherGPRPressure;
+ }
----------------
vpykhtin wrote:
It looks like _SGPRImportant_ is not actual here because it compares occupancies. It probably should select a kind of register shortage to compare but I'm not sure this is the right answer to the scheduler's question "which schedule to prefer".
https://github.com/llvm/llvm-project/pull/71882
More information about the llvm-commits
mailing list