This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Adjust number of SGPRs available in Calling Convention
ClosedPublic

Authored by rtaylor on Jul 18 2019, 9:56 AM.

Details

Reviewers
arsenm
nhaehnle
Summary

This reduces the number of SGPRs due to some concerns about running
out of SGPRs if you make all the SGPRs that aren't reserved available
for the calling convention.

Change-Id: Ibfdcd4a42ba9ad22bdc96413e1f8d6e2072858c2

Diff Detail

Event Timeline

rtaylor created this revision.Jul 18 2019, 9:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2019, 9:56 AM

Can you add a test for what happens if you exceed the limit? Is there an error?

rtaylor updated this revision to Diff 210890.Jul 19 2019, 1:39 PM

Added test case. Changed assert to report_fatal_error when checking
arguments and returns.

arsenm added inline comments.Jul 19 2019, 1:58 PM
lib/CodeGen/CallingConvLower.cpp
91–92

The message printed here will still be wrong.

91–92

I would rephrase this to be less specific. Unable to allocate function argument?

lib/Target/AMDGPU/AMDGPUCallingConv.td
27

Can you add a comment explaining the limit

52–59

Can you add a comment explaining the limit

rtaylor marked 2 inline comments as done.Jul 19 2019, 2:54 PM
rtaylor added inline comments.
lib/CodeGen/CallingConvLower.cpp
91–92

That's fine.

91–92

It could still be an unhandled type? I'll just remove it.

rtaylor marked an inline comment as done.Jul 19 2019, 2:58 PM
rtaylor added inline comments.
lib/Target/AMDGPU/AMDGPUCallingConv.td
27

I don't think this ever had a comment and 44 is still pretty arbitrary, I'll put something here though.

rtaylor updated this revision to Diff 210913.Jul 19 2019, 3:08 PM

Changed error message in AnalyzeFormalArguments to be more generic.
Added comments.

arsenm added inline comments.Jul 19 2019, 4:28 PM
lib/CodeGen/CallingConvLower.cpp
91–92

s/register/function argument/

118–119

s/register/function return/

rtaylor updated this revision to Diff 210967.Jul 20 2019, 10:33 AM

Updated error comment and case error test

rtaylor marked an inline comment as done.Jul 20 2019, 10:34 AM
rtaylor added inline comments.
lib/CodeGen/CallingConvLower.cpp
91–92

Yes, I realized that last night after I submitted but had to run. I also thought it would be useful info to put which argument/return index was causing the issue.

Hmm... looks like AMDGPUISelLowering.cpp has changed quite a bit in regards to the calling convention.

rtaylor updated this revision to Diff 216907.Aug 23 2019, 11:27 AM

Updating.

arsenm accepted this revision.Aug 27 2019, 5:09 PM

LGTM

This revision is now accepted and ready to land.Aug 27 2019, 5:09 PM
rtaylor closed this revision.Sep 6 2019, 2:22 PM

Upstreamed.

test/CodeGen/AMDGPU/cc-sgpr-over-limit.ll