Skip to content

Commit 6e5695b

Browse files
AMDGPU: Prioritize VGPRs over AGPRs over SGPRs
Track AGPRs only if we are not tracking VGPRs Prioritize AGPR pressure over SGPR pressure
1 parent 122c212 commit 6e5695b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,10 @@ void GCNSchedStrategy::initCandidate(SchedCandidate &Cand, SUnit *SU,
286286

287287
// FIXME: Better heuristics to determine whether to prefer SGPRs or VGPRs.
288288
static constexpr unsigned MaxVGPRPressureInc = 16;
289-
bool ShouldTrackAGPRs = AGPRPressure >= AGPRExcessLimit;
290289
bool ShouldTrackVGPRs = VGPRPressure + MaxVGPRPressureInc >= VGPRExcessLimit;
291-
bool ShouldTrackSGPRs = !ShouldTrackVGPRs && SGPRPressure >= SGPRExcessLimit;
290+
bool ShouldTrackAGPRs = !ShouldTrackVGPRs && AGPRPressure >= AGPRExcessLimit;
291+
bool ShouldTrackSGPRs =
292+
!ShouldTrackVGPRs && !ShouldTrackAGPRs && SGPRPressure >= SGPRExcessLimit;
292293

293294
// FIXME: We have to enter REG-EXCESS before we reach the actual threshold
294295
// to increase the likelihood we don't go over the limits. We should improve
@@ -329,7 +330,7 @@ void GCNSchedStrategy::initCandidate(SchedCandidate &Cand, SUnit *SU,
329330
if (SGPRDelta >= 0 || VGPRDelta >= 0 || AGPRDelta >= 0) {
330331
HasHighPressure = true;
331332
// Prioritize reducing the VGPRDelta if both are >= 0
332-
if (SGPRDelta > VGPRDelta) {
333+
if (SGPRDelta > VGPRDelta && SGPRDelta > AGPRDelta) {
333334
Cand.RPDelta.CriticalMax =
334335
PressureChange(AMDGPU::RegisterPressureSets::SReg_32);
335336
Cand.RPDelta.CriticalMax.setUnitInc(SGPRDelta);

0 commit comments

Comments
 (0)