This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Fix True16 patterns for cmp on GFX11
ClosedPublic

Authored by Joe_Nash on Oct 10 2022, 11:42 AM.

Details

Summary

These patterns should have a True16 version and a non-true16 version.

Diff Detail

Event Timeline

Joe_Nash created this revision.Oct 10 2022, 11:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2022, 11:42 AM
Joe_Nash requested review of this revision.Oct 10 2022, 11:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2022, 11:42 AM
arsenm accepted this revision.Oct 10 2022, 11:57 AM
arsenm added inline comments.
llvm/test/CodeGen/AMDGPU/v_cmp_gfx11.ll
4

Can replace -march with -mtriple

This revision is now accepted and ready to land.Oct 10 2022, 11:57 AM
This revision was automatically updated to reflect the committed changes.
Leonc added inline comments.Oct 11 2022, 7:15 AM
llvm/test/CodeGen/AMDGPU/v_cmp_gfx11.ll
7

Shouldn't this be v_cmp_eq_u16_t16_e64 on gfx11?

Joe_Nash added inline comments.Oct 11 2022, 7:21 AM
llvm/test/CodeGen/AMDGPU/v_cmp_gfx11.ll
7

The assembly mnemonics do not include references to true16, only the MachineInstr/MCInst names do. I checked that the True16 version of the instruction was used via print-after-all before asm emission in this case.

Leonc added inline comments.Oct 11 2022, 7:27 AM
llvm/test/CodeGen/AMDGPU/v_cmp_gfx11.ll
7

Excellent. Thanks 👍

arsenm added inline comments.Oct 11 2022, 7:46 AM
llvm/test/CodeGen/AMDGPU/v_cmp_gfx11.ll
16

Should also test llvm.amdgcn.fcmp. I'd assume that's missing coverage too if this was broken

16

Plus ballot

Joe_Nash added inline comments.Oct 12 2022, 7:15 AM
llvm/test/CodeGen/AMDGPU/v_cmp_gfx11.ll
16

Is ballot well defined for 16 bit destinations? I think ballot should work over the waveSize, so only 32 or 64 bit returns are valid.
For an instrinsic like this

declare i16 @llvm.amdgcn.ballot.i16(i1)

I would expect a problem here
AMDGPUInstructionSelector.cpp:1226
AMDGPUInstructionSelector::selectBallot

if (Size != STI.getWavefrontSize())
  return false;
Joe_Nash marked an inline comment as not done.Oct 12 2022, 7:56 AM
Joe_Nash added inline comments.
llvm/test/CodeGen/AMDGPU/v_cmp_gfx11.ll
16

On second thought, I think you probably meant a test of a 16 bit compare feeding into ballot. See test https://reviews.llvm.org/D135782