This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Wave32 CodeGen for amdgcn.ballot.i64
ClosedPublic

Authored by Pierre-vh on Jul 12 2023, 1:23 AM.

Details

Summary

A recent addition to the device libs, __ockl_dm_trim, caused a series of
failures at O0 due to a i64 ballot intrinsic being inlined into a wave32 function.

The quick fix for this is to support codegen for this rare case.
A proper long-term fix for this type of issue is still being discussed.

Fixes SWDEV-408929, SWDEV-408957, SWDEV-409885, SWDEV-410193

Diff Detail

Event Timeline

Pierre-vh created this revision.Jul 12 2023, 1:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2023, 1:23 AM
Pierre-vh requested review of this revision.Jul 12 2023, 1:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2023, 1:23 AM
arsenm added inline comments.Jul 12 2023, 12:59 PM
llvm/lib/Target/AMDGPU/VOPCInstructions.td
1004

The high bits should be 0, not undef

1079

0 high bits

llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ballot.i64.wave32.ll
3

with and without global-isel. Also no reason to spell out both features, just rely on wave32 being the default. Also add a run line with wave32 on a wave64 target if it doesn't fail too horribly

Pierre-vh marked 3 inline comments as done.

Add GISel

llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ballot.i64.wave32.ll
3

Also add a run line with wave32 on a wave64 target if it doesn't fail too horribly

What target can I use? I think <GFX10 is wave64 default but do they support wave32 mode? There's a comment in AMDGPURemoveIncompatibleFunction that says gfx9 and below don't support wave32 mode

foad added inline comments.Jul 13 2023, 1:28 AM
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ballot.i64.wave32.ll
3

Wave32 did not exist until GFX10.

arsenm accepted this revision.Jul 13 2023, 6:09 AM
arsenm added inline comments.
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ballot.i64.wave32.ll
4

use an explicit -global-isel=0 so the test doesn't break when the default switches

This revision is now accepted and ready to land.Jul 13 2023, 6:09 AM
This revision was landed with ongoing or failed builds.Jul 13 2023, 6:21 AM
This revision was automatically updated to reflect the committed changes.
Pierre-vh marked an inline comment as done.