This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Add detailed buffer, global and flat atomic fadd tests
ClosedPublic

Authored by Petar.Avramovic on Aug 10 2022, 5:43 AM.

Details

Summary

AMDGPU: Add detailed buffer, global and flat atomic fadd tests

Precommit for D130579 that will remove manual selection and use
patterns from td files. Tests are grouped based on target features.

All patterns have rtn and no-rtn versions.

buffer atomics patterns are selected based on the intrinsic used
(raw or struct) and the offset operand (imm or vgpr):
_offset raw with imm offset
_offen raw with vgpr offset (or large imm offset)
_idxen struct with imm offset
_bothen struct with vgpr offset (or large imm offset)

global and flat atomics are selected via intrinsic or the atomicrmw fadd.
atomicrmw tests have amdgpu-unsafe-fp-atomics=true and non-system scope
since they get expanded otherwise. atomicrmw fadd does not support vector
type, test float and double.

global atomics patterns are selected based on address type via (global or
flat) intrinsic or atomicrmw fadd with global address(addrspace(1)*).
'no suffix' vgpr addrspace(1)* address
_saddr sgpr addrspace(1)* address

flat atomics patterns are selected via (flat)intrinsic or atomicrmw fadd
with flat address (* - address space 0).

Diff Detail

Build Status
Buildable 188148

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2022, 5:43 AM
Petar.Avramovic requested review of this revision.Aug 10 2022, 5:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2022, 5:43 AM
arsenm accepted this revision.Sep 15 2022, 10:39 AM

LGTM. The buffer tests could use some cases that need waterfall loops

This revision is now accepted and ready to land.Sep 15 2022, 10:39 AM

The buffer tests could use some cases that need waterfall loops

These already exist in GlobalISel/llvm.amdgcn.raw.buffer.atomic.fadd.ll and GlobalISel/llvm.amdgcn.struct.buffer.atomic.fadd.ll. I will add gfx11 run lines in another patch.
gfx11 was missing some tests and patterns, I wanted to have exactly one test for each fadd pattern that exists in td file since some patterns were missing regression test.

Usually the type suffix is .type, not -type

Renamed tests to .type.
Added tests for flat intrinsic with global address (selects into global atomic).
Added test to Transforms/AtomicExpand for cases that don't expand atomic rmw fadd.

arsenm accepted this revision.Sep 21 2022, 5:07 PM

LGTM

Petar.Avramovic retitled this revision from AMDGPU: Add detailed test buffer global and flat atomic fadd to AMDGPU: Add detailed buffer, global and flat atomic fadd tests.
Petar.Avramovic edited the summary of this revision. (Show Details)
llvm/test/CodeGen/AMDGPU/global-atomic-fadd.v2f16-rtn.ll