This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][GlobalISel] Add support for global atomicrmw fadd
ClosedPublic

Authored by foad on Mar 2 2021, 6:17 AM.

Details

Summary

This includes gfx908 which only has a no-return version of the
global_atomic_add_f32 instruction, using the same hack that was
previously implemented for selecting from the
llvm.amdgcn.global.atomic.fadd intrinsic.

Diff Detail

Event Timeline

foad created this revision.Mar 2 2021, 6:17 AM
foad requested review of this revision.Mar 2 2021, 6:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2021, 6:17 AM
arsenm added inline comments.Mar 2 2021, 6:21 AM
llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
1301

Isn't this also conditional on the denorm mode or the unsafe atomic attribute? That would need to be custom and verify those are consistent

foad added inline comments.Mar 3 2021, 2:34 AM
llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
1301

Those checks are done in SITargetLowering::shouldExpandAtomicRMWInIR for both selectiondag and globalisel.

foad added a comment.Mar 8 2021, 1:10 AM

Ping. Is it OK to rely on the atomic-expand pass having been run? That seems to be how SelectionDAG works.

arsenm added a comment.Mar 8 2021, 6:07 AM

Ping. Is it OK to rely on the atomic-expand pass having been run? That seems to be how SelectionDAG works.

Yes, although some additional verification wouldn't hurt in case something decides to do something based on the legality information

arsenm accepted this revision.Mar 30 2021, 3:33 PM

LGTM, though ensuring the right mode in the lowering. We probably won't have MIR atomic expansions anytime soon

This revision is now accepted and ready to land.Mar 30 2021, 3:33 PM
This revision was landed with ongoing or failed builds.Mar 31 2021, 3:15 AM
This revision was automatically updated to reflect the committed changes.