This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][MC][NFC] Refactored custom operands handling
ClosedPublic

Authored by dp on Mar 15 2022, 7:09 AM.

Details

Summary

The original design of custom operands support assumed that most GPUs
have the same or very similar operand names end encodings. This is
no longer the case. As a result the support code becomes over-complicated
and difficult to maintain.

This change proposes a different design with the following benefits:

  • support of aliases;
  • support of operands with overlapped encodings;
  • identification of defined but unsupported operands.

This is the first part of the change. A patch for sendmsg(...) will be submitted separately.

Diff Detail

Event Timeline

dp created this revision.Mar 15 2022, 7:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2022, 7:09 AM
dp requested review of this revision.Mar 15 2022, 7:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2022, 7:09 AM
dp updated this revision to Diff 415468.Mar 15 2022, 9:25 AM
dp edited the summary of this revision. (Show Details)

Corrections to suppress warnings.

dp edited the summary of this revision. (Show Details)Mar 15 2022, 10:25 AM
dp added reviewers: rampitec, foad.
arsenm added inline comments.Mar 15 2022, 10:33 AM
llvm/lib/Target/AMDGPU/Utils/AMDGPUAsmUtils.h
29

Instead of a callback could you use a mask of required features?

rampitec accepted this revision.Mar 15 2022, 11:06 AM

Thanks Dmitry!

llvm/lib/Target/AMDGPU/Utils/AMDGPUAsmUtils.h
29

I believe it would need 3 masks then: required features 'and' mask, required features 'or' mask, and features required to be absent. Seems over-complicated to me.

This revision is now accepted and ready to land.Mar 15 2022, 11:06 AM
dp marked 2 inline comments as done.Mar 15 2022, 11:54 AM
dp added inline comments.
llvm/lib/Target/AMDGPU/Utils/AMDGPUAsmUtils.h
29

Yes, I agree that it would be over-complicated (and less flexible). Also I wanted to use CustomOperand to simplify handling of message operations (OpSysSymbolic/OpGsSymbolic) which shall be enabled based on message id rather than on GPU features.

This revision was landed with ongoing or failed builds.Mar 16 2022, 6:05 AM
This revision was automatically updated to reflect the committed changes.
mehdi_amini added inline comments.
llvm/lib/Target/AMDGPU/Utils/AMDGPUAsmUtils.cpp
107

This does not build with gcc5:

llvm/lib/Target/AMDGPU/Utils/AMDGPUAsmUtils.cpp:107:1: error: could not convert '(const char*)""' from 'const char*' to 'llvm::StringLiteral'
 };
 ^

Can you have a look?

dp added inline comments.Mar 16 2022, 2:55 PM
llvm/lib/Target/AMDGPU/Utils/AMDGPUAsmUtils.cpp
107

Sure. I’ll try to fix it tomorrow.

dp added a comment.Mar 17 2022, 4:51 AM

The issue has been fixed in 9c632b6