This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][Uniformity] SI_IF and SI_ELSE pseudos are always divergent
ClosedPublic

Authored by sameerds on May 18 2023, 4:19 AM.

Diff Detail

Event Timeline

sameerds created this revision.May 18 2023, 4:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2023, 4:19 AM
sameerds requested review of this revision.May 18 2023, 4:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2023, 4:19 AM
sameerds added a subscriber: Restricted Project.
sameerds added inline comments.May 18 2023, 4:23 AM
llvm/include/llvm/ADT/GenericUniformityImpl.h
1150–1154

I guess I should lead with "On some targets, ..."

arsenm accepted this revision.May 18 2023, 9:59 AM
This revision is now accepted and ready to land.May 18 2023, 9:59 AM
ruiling added inline comments.May 18 2023, 6:55 PM
llvm/test/Analysis/UniformityAnalysis/AMDGPU/MIR/control-flow-intrinsics.mir
34

Although we do not have formal specification for the IF/ELSE instructions, I still prefer to see the tests are written using the well-formed pattern. that is SI_IF/SI_END_CF and SI_IF/SI_ELSE/SI_END_CF. My original concern over the SI_IF/SI_ELSE should be divergent is for the case that PHI node in merge block should be divergent(aka. sync depends on the branch). I would like this be covered in the tests.

sameerds added inline comments.May 18 2023, 11:24 PM
llvm/test/Analysis/UniformityAnalysis/AMDGPU/MIR/control-flow-intrinsics.mir
34

I agree that MachineUA is currently not tested as extensively as the UA on LLVM IR. But this change is very specific, and the test being added is an equivalent of similar fragments in the LLVM IR tests. All we want to demonstrate here is that the control flow intrinsics are hard-coded to be divergent, even when the argument is uniform.

Separately, we need to translate all the LLVM IR test to equivalent MIR tests, and I am hoping that we can automate that once GlobalISel is ready for such use. For now, we do have some complete tests, and we deprecated some because the MIR in them was all wrong. But all this is definitely not happening in this change!