This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Add utilities to track number of user SGPRs. NFC.
ClosedPublic

Authored by kerbowa on Sep 4 2023, 9:43 PM.

Details

Summary

Factor out and unify some common code that calculates and tracks the
number of user SGRPs.

Diff Detail

Event Timeline

kerbowa created this revision.Sep 4 2023, 9:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 4 2023, 9:43 PM
kerbowa requested review of this revision.Sep 4 2023, 9:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 4 2023, 9:43 PM
arsenm accepted this revision.Sep 5 2023, 8:23 AM

New reviews are supposed to go to pull requests

This revision is now accepted and ready to land.Sep 5 2023, 8:23 AM
craig.topper added inline comments.
llvm/lib/Target/AMDGPU/GCNSubtarget.h
1412

gcc 8.5.0 doesn't like this being constexpr due to the call to unreachable. I'm getting an error like

llvm/lib/Target/AMDGPU/GCNSubtarget.h: In static member function ‘static constexpr unsigned int llvm::GCNUserSGPRUsageInfo::getNumUserSGPRForField(llvm::GCNUserSGPRUsageInfo::UserSGPRID)’:
llvm/include/llvm/Support/ErrorHandling.h:144:36: error: call to non-‘constexpr’ function ‘void llvm::llvm_unreachable_internal(const char*, const char*, unsigned int)’
   ::llvm::llvm_unreachable_internal(msg, __FILE__, __LINE__)
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
llvm/lib/Target/AMDGPU/GCNSubtarget.h:1431: note: in expansion of macro  llvm_unreachable’
     llvm_unreachable("Unknown UserSGPRID.");