This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Add symbolic names for gfx940 HWREGs
ClosedPublic

Authored by rampitec on Mar 10 2022, 3:08 PM.

Details

Summary

The namespaces of HWREGs is now overlapping with gfx10. Thus the
patch is longer than necessary to just support new names. It also
need to handle proper error messages, i.e. to issue a "specified
hardware register is not supported on this GPU" message.

This may need a major refactoring in the future.

Diff Detail

Event Timeline

rampitec created this revision.Mar 10 2022, 3:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2022, 3:08 PM
rampitec requested review of this revision.Mar 10 2022, 3:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2022, 3:08 PM
Herald added a subscriber: wdng. · View Herald Transcript
foad added a comment.Mar 11 2022, 2:23 AM

Seems OK but maybe a bit over-complicated as noted inline.

llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
1083

I don't understand why you need to handle this alias here and on line 1092 below, and the old code had no mention of it?

1103

We also return true for GFX10Plus above, so doesn't that mean that ID_HW_ID needs no special handling at all?

dp added a comment.Mar 11 2022, 3:31 AM

Overall looks fine.
I've already refactored handling of hwreg and sendmsg which simplifies the code significantly. But I have to update my patch with GFX940 changes before sending it for review.

llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
614–616

I'm not sure LLVM_READNONE could be used here because the function reads non-constant memory pointed to by Name. Should the attribute be replaced with LLVM_READONLY?

rampitec updated this revision to Diff 414707.Mar 11 2022, 11:10 AM
rampitec marked 3 inline comments as done.
rampitec added inline comments.
llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
1083

This is because the alias is not recognized by the code at 1087 and we exit. But the check at 1092 is not needed, removed.

1103

Yes, it is not needed anymore. Removed.

dp accepted this revision.Mar 11 2022, 11:18 AM

LGTM

This revision is now accepted and ready to land.Mar 11 2022, 11:18 AM
This revision was landed with ongoing or failed builds.Mar 14 2022, 4:13 PM
This revision was automatically updated to reflect the committed changes.