This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Introduce divergence and uniform bit fields in tablegen
ClosedPublic

Authored by yassingh on Feb 2 2023, 1:10 AM.

Details

Summary

IsSourceOfDivergence and IsAlwaysUniform can be set to 1 to mark instructions
which are inherently divergent or uniform. Adding them to Readlane and
Writelane instruction for now. To be extended to all required instructions.

Diff Detail

Event Timeline

yassingh created this revision.Feb 2 2023, 1:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2023, 1:10 AM
yassingh requested review of this revision.Feb 2 2023, 1:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2023, 1:10 AM
foad added inline comments.Feb 2 2023, 1:52 AM
llvm/lib/Target/AMDGPU/SIDefines.h
137–138

Now would be a good time to adopt the name "IsNeverUniform" instead of "IsSourceOfDivergence", to match the InstructionUniformity enum (https://llvm.org/doxygen/namespacellvm.html#ae58c751054b01f206f9b9e34e461d25f)

arsenm added a comment.Feb 2 2023, 3:25 AM

I’m not sure we really need a bit for just these 3 cases

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
8422

Space after if

I’m not sure we really need a bit for just these 3 cases

At least for divergent there are a lot more instructions, atomic buffers, flat atomics, some lds instructions, etc. Will submit subsequent patches covering them.

ruiling added a subscriber: ruiling.Feb 2 2023, 7:45 AM
ruiling added inline comments.
llvm/lib/Target/AMDGPU/SIInstrFormats.td
242

As we have only very few alwaysUniform instruction, maybe we don't need this to save one bit.

yassingh updated this revision to Diff 494545.Feb 3 2023, 1:10 AM

Addressed review comments

  • Using isNeverUniform instead of isSourceOfDivergence.
  • Removed the bit for always uniform.
sameerds accepted this revision.Feb 5 2023, 10:56 PM

LGTM. But please wait for at least one other reviewer.

Also update the git commit message before submitting

This revision is now accepted and ready to land.Feb 5 2023, 10:56 PM
arsenm accepted this revision.Feb 7 2023, 5:49 AM
This revision was landed with ongoing or failed builds.Feb 7 2023, 10:17 PM
This revision was automatically updated to reflect the committed changes.