Skip to content

Commit a663c42

Browse files
committed
AMDGPU: Add subtarget feature for memory atomic fadd f64
1 parent f99d34b commit a663c42

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

llvm/lib/Target/AMDGPU/AMDGPU.td

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,13 @@ def FeatureFlatAtomicFaddF32Inst
788788
"Has flat_atomic_add_f32 instruction"
789789
>;
790790

791+
def FeatureFlatBufferGlobalAtomicFaddF64Inst
792+
: SubtargetFeature<"flat-buffer-global-fadd-f64-inst",
793+
"HasFlatBufferGlobalAtomicFaddF64Inst",
794+
"true",
795+
"Has flat, buffer, and global instructions for f64 atomic fadd"
796+
>;
797+
791798
def FeatureMemoryAtomicFaddF32DenormalSupport
792799
: SubtargetFeature<"memory-atomic-fadd-f32-denormal-support",
793800
"HasAtomicMemoryAtomicFaddF32DenormalSupport",
@@ -1388,7 +1395,8 @@ def FeatureISAVersion9_0_A : FeatureSet<
13881395
FeatureBackOffBarrier,
13891396
FeatureKernargPreload,
13901397
FeatureAtomicFMinFMaxF64GlobalInsts,
1391-
FeatureAtomicFMinFMaxF64FlatInsts
1398+
FeatureAtomicFMinFMaxF64FlatInsts,
1399+
FeatureFlatBufferGlobalAtomicFaddF64Inst
13921400
])>;
13931401

13941402
def FeatureISAVersion9_0_C : FeatureSet<

llvm/lib/Target/AMDGPU/GCNSubtarget.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
174174
bool HasAtomicGlobalPkAddBF16Inst = false;
175175
bool HasAtomicBufferPkAddBF16Inst = false;
176176
bool HasFlatAtomicFaddF32Inst = false;
177+
bool HasFlatBufferGlobalAtomicFaddF64Inst = false;
177178
bool HasDefaultComponentZero = false;
178179
bool HasAgentScopeFineGrainedRemoteMemoryAtomics = false;
179180
bool HasDefaultComponentBroadcast = false;
@@ -873,6 +874,12 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
873874

874875
bool hasFlatAtomicFaddF32Inst() const { return HasFlatAtomicFaddF32Inst; }
875876

877+
/// \return true if the target has flat, global, and buffer atomic fadd for
878+
/// double.
879+
bool hasFlatBufferGlobalAtomicFaddF64Inst() const {
880+
return HasFlatBufferGlobalAtomicFaddF64Inst;
881+
}
882+
876883
/// \return true if the target's flat, global, and buffer atomic fadd for
877884
/// float supports denormal handling.
878885
bool hasMemoryAtomicFaddF32DenormalSupport() const {

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16028,7 +16028,7 @@ SITargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *RMW) const {
1602816028
return AtomicExpansionKind::CmpXChg;
1602916029

1603016030
// global and flat atomic fadd f64: gfx90a, gfx940.
16031-
if (Subtarget->hasGFX90AInsts() && Ty->isDoubleTy())
16031+
if (Subtarget->hasFlatBufferGlobalAtomicFaddF64Inst() && Ty->isDoubleTy())
1603216032
return ReportUnsafeHWInst(AtomicExpansionKind::None);
1603316033

1603416034
if (AS != AMDGPUAS::FLAT_ADDRESS && Ty->isFloatTy()) {

0 commit comments

Comments
 (0)