This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Correct getMaxNumSGPR treatment of flat_scratch
ClosedPublic

Authored by arsenm on Jan 14 2022, 1:37 PM.

Details

Reviewers
rampitec
sebastian-ne
Group Reviewers
Restricted Project
Summary

This was approximating the entry point logic for flat_scratch_init,
which is not really the point. We need to account for whether we need
to reserve the SGPR pair used for flat_scratch, not whether we needed
the initialization kernel argument. If this was an arbitrary function,
we would end up over-reporting the number of potentially free
SGPRs. The logic for architected flat scratch also only applies to the
initialization in the kernel, not the reserved registers at the end.

Avoids compile failures in a future patch from allocating more SGPRs
than the subtarget supports.

Diff Detail

Event Timeline

arsenm created this revision.Jan 14 2022, 1:37 PM
arsenm requested review of this revision.Jan 14 2022, 1:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2022, 1:37 PM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm edited the summary of this revision. (Show Details)Jan 14 2022, 1:38 PM

Any tests?

This prevents a lot of failures in existing tests with D117364

rampitec accepted this revision.Jan 14 2022, 3:24 PM
This revision is now accepted and ready to land.Jan 14 2022, 3:24 PM
sebastian-ne accepted this revision.Jan 17 2022, 2:33 AM