This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Tune scheduler on GFX10 and GFX11 for regions with spilling
ClosedPublic

Authored by rampitec on Jan 16 2023, 3:31 PM.

Details

Summary

Unlike older ASICs GFX10+ have a lot of VGPRs. Therefore, it is possible
to achieve high occupancy even with all or almost all addressable VGPRs
used. Our scheduler was never tuned for this scenario. The VGPR Critical
Limit threshold always comes very high, even if maximum occupancy is
targeted. For example on gfx1100 it is set to 192 registers even with
the requested occupancy 16. As a result scheduler starts prioritizing
register pressure reduction very late and we easily end up spilling.

This patch makes VGPR critical limit similar to what we would have on
pre-gfx10 targets with much more limited VGPR budget while still trying
to maintain occupancy as it does now.

Pre-gfx10 ASICs shall not be affected as the limit shall be the same
as before, and on gfx10+ it shall only affect regions where we have
to spill.

Fixes: SWDEV-377300

Diff Detail

Event Timeline

rampitec created this revision.Jan 16 2023, 3:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 16 2023, 3:31 PM
rampitec requested review of this revision.Jan 16 2023, 3:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 16 2023, 3:31 PM
Herald added a subscriber: wdng. · View Herald Transcript

This is much more conservative alternative to D141728.

I will try to come up with a reasonable testcase in a meanwhile.

rampitec updated this revision to Diff 489945.Jan 17 2023, 2:43 PM

Added test.

rampitec edited the summary of this revision. (Show Details)Jan 20 2023, 11:14 AM

Can you add some debug printouts so we know when this is being triggered in logs?

rampitec updated this revision to Diff 490945.Jan 20 2023, 12:41 PM

Added debug output.

kerbowa accepted this revision.Jan 22 2023, 10:26 PM

LGTM.

llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
632

Move to initGCNRegion?

This revision is now accepted and ready to land.Jan 22 2023, 10:26 PM
rampitec updated this revision to Diff 491439.Jan 23 2023, 10:24 AM
rampitec marked an inline comment as done.

Moved initialization.

This revision was landed with ongoing or failed builds.Jan 23 2023, 10:42 AM
This revision was automatically updated to reflect the committed changes.