Skip to content

Conversation

@arsenm
Copy link
Contributor

@arsenm arsenm commented Jun 23, 2024

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Jun 23, 2024

@llvm/pr-subscribers-backend-amdgpu

Author: Matt Arsenault (arsenm)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/96444.diff

3 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/AMDGPU.td (+9-1)
  • (modified) llvm/lib/Target/AMDGPU/GCNSubtarget.h (+7)
  • (modified) llvm/lib/Target/AMDGPU/SIISelLowering.cpp (+1-1)
diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td
index 5f798b4391704..fe3cd75d81009 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPU.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPU.td
@@ -788,6 +788,13 @@ def FeatureFlatAtomicFaddF32Inst
   "Has flat_atomic_add_f32 instruction"
 >;
 
+def FeatureFlatBufferGlobalAtomicFaddF64Inst
+  : SubtargetFeature<"flat-buffer-global-fadd-f64-inst",
+  "HasFlatBufferGlobalAtomicFaddF64Inst",
+  "true",
+  "Has flat, buffer, and global instructions for f64 atomic fadd"
+>;
+
 def FeatureMemoryAtomicFaddF32DenormalSupport
   : SubtargetFeature<"memory-atomic-fadd-f32-denormal-support",
   "HasAtomicMemoryAtomicFaddF32DenormalSupport",
@@ -1388,7 +1395,8 @@ def FeatureISAVersion9_0_A : FeatureSet<
      FeatureBackOffBarrier,
      FeatureKernargPreload,
      FeatureAtomicFMinFMaxF64GlobalInsts,
-     FeatureAtomicFMinFMaxF64FlatInsts
+     FeatureAtomicFMinFMaxF64FlatInsts,
+     FeatureFlatBufferGlobalAtomicFaddF64Inst
      ])>;
 
 def FeatureISAVersion9_0_C : FeatureSet<
diff --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.h b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
index 674d84422538f..922435c5efaa6 100644
--- a/llvm/lib/Target/AMDGPU/GCNSubtarget.h
+++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
@@ -174,6 +174,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
   bool HasAtomicGlobalPkAddBF16Inst = false;
   bool HasAtomicBufferPkAddBF16Inst = false;
   bool HasFlatAtomicFaddF32Inst = false;
+  bool HasFlatBufferGlobalAtomicFaddF64Inst = false;
   bool HasDefaultComponentZero = false;
   bool HasAgentScopeFineGrainedRemoteMemoryAtomics = false;
   bool HasDefaultComponentBroadcast = false;
@@ -873,6 +874,12 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
 
   bool hasFlatAtomicFaddF32Inst() const { return HasFlatAtomicFaddF32Inst; }
 
+  /// \return true if the target has flat, global, and buffer atomic fadd for
+  /// double.
+  bool hasFlatBufferGlobalAtomicFaddF64Inst() const {
+    return HasFlatBufferGlobalAtomicFaddF64Inst;
+  }
+
   /// \return true if the target's flat, global, and buffer atomic fadd for
   /// float supports denormal handling.
   bool hasMemoryAtomicFaddF32DenormalSupport() const {
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index eec750e5b8251..6b5ba160d6402 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -16028,7 +16028,7 @@ SITargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *RMW) const {
       return AtomicExpansionKind::CmpXChg;
 
     // global and flat atomic fadd f64: gfx90a, gfx940.
-    if (Subtarget->hasGFX90AInsts() && Ty->isDoubleTy())
+    if (Subtarget->hasFlatBufferGlobalAtomicFaddF64Inst() && Ty->isDoubleTy())
       return ReportUnsafeHWInst(AtomicExpansionKind::None);
 
     if (AS != AMDGPUAS::FLAT_ADDRESS && Ty->isFloatTy()) {

@arsenm arsenm force-pushed the users/arsenm/amdgpu-add-feature-for-buffer-atomic-fadd-f64 branch from a663c42 to c135403 Compare June 24, 2024 13:42
@rampitec
Copy link
Collaborator

Use it in a predicate when defining pseudos?

@arsenm arsenm force-pushed the users/arsenm/amdgpu-add-feature-for-buffer-atomic-fadd-f64 branch from c135403 to baaf961 Compare June 24, 2024 22:14
@arsenm arsenm force-pushed the users/arsenm/amdgpu-subtarget-feature-fadd-denormal-support branch from 4594135 to 3ec4e64 Compare June 25, 2024 09:10
@arsenm arsenm force-pushed the users/arsenm/amdgpu-add-feature-for-buffer-atomic-fadd-f64 branch from baaf961 to e948fe9 Compare June 25, 2024 09:10
@arsenm arsenm force-pushed the users/arsenm/amdgpu-subtarget-feature-fadd-denormal-support branch from 3ec4e64 to 47017c2 Compare June 25, 2024 22:32
@arsenm arsenm force-pushed the users/arsenm/amdgpu-add-feature-for-buffer-atomic-fadd-f64 branch 2 times, most recently from 7648917 to db51986 Compare June 26, 2024 09:34
@arsenm arsenm force-pushed the users/arsenm/amdgpu-subtarget-feature-fadd-denormal-support branch from 23ec97c to b57b67e Compare June 27, 2024 07:47
@arsenm arsenm force-pushed the users/arsenm/amdgpu-add-feature-for-buffer-atomic-fadd-f64 branch from db51986 to 36cbbdf Compare June 27, 2024 07:47
@arsenm arsenm force-pushed the users/arsenm/amdgpu-subtarget-feature-fadd-denormal-support branch from b57b67e to 5a62792 Compare June 27, 2024 09:10
@arsenm arsenm force-pushed the users/arsenm/amdgpu-add-feature-for-buffer-atomic-fadd-f64 branch from 36cbbdf to 0381e27 Compare June 27, 2024 09:10
@arsenm arsenm force-pushed the users/arsenm/amdgpu-subtarget-feature-fadd-denormal-support branch from 5a62792 to 1e3c134 Compare June 27, 2024 14:28
@arsenm arsenm force-pushed the users/arsenm/amdgpu-add-feature-for-buffer-atomic-fadd-f64 branch from 0381e27 to 234b772 Compare June 27, 2024 14:29
@arsenm arsenm force-pushed the users/arsenm/amdgpu-subtarget-feature-fadd-denormal-support branch from 1e3c134 to ab52788 Compare June 28, 2024 12:41
@arsenm arsenm force-pushed the users/arsenm/amdgpu-add-feature-for-buffer-atomic-fadd-f64 branch from 234b772 to 20d2b3f Compare June 28, 2024 12:41
@arsenm arsenm force-pushed the users/arsenm/amdgpu-subtarget-feature-fadd-denormal-support branch from ab52788 to 1a5d8b8 Compare July 2, 2024 17:01
@arsenm arsenm force-pushed the users/arsenm/amdgpu-add-feature-for-buffer-atomic-fadd-f64 branch from 20d2b3f to ece3239 Compare July 2, 2024 17:01
@arsenm arsenm force-pushed the users/arsenm/amdgpu-subtarget-feature-fadd-denormal-support branch from 1a5d8b8 to 9cf93c6 Compare July 3, 2024 17:07
@arsenm arsenm force-pushed the users/arsenm/amdgpu-add-feature-for-buffer-atomic-fadd-f64 branch from ece3239 to 5945915 Compare July 3, 2024 17:07
@arsenm arsenm force-pushed the users/arsenm/amdgpu-subtarget-feature-fadd-denormal-support branch from 9cf93c6 to deebca2 Compare July 3, 2024 21:41
@arsenm arsenm force-pushed the users/arsenm/amdgpu-add-feature-for-buffer-atomic-fadd-f64 branch from 5945915 to 308e311 Compare July 3, 2024 21:41
@arsenm arsenm force-pushed the users/arsenm/amdgpu-subtarget-feature-fadd-denormal-support branch 2 times, most recently from 573e7bc to 5ef29a5 Compare July 4, 2024 09:42
@arsenm arsenm force-pushed the users/arsenm/amdgpu-add-feature-for-buffer-atomic-fadd-f64 branch from 308e311 to 4590c05 Compare July 4, 2024 09:42
Copy link
Contributor Author

arsenm commented Jul 10, 2024

Merge activity

  • Jul 10, 8:37 AM EDT: @arsenm started a stack merge that includes this pull request via Graphite.
  • Jul 10, 8:52 AM EDT: Graphite rebased this pull request as part of a merge.
  • Jul 10, 8:55 AM EDT: @arsenm merged this pull request with Graphite.

@arsenm arsenm force-pushed the users/arsenm/amdgpu-subtarget-feature-fadd-denormal-support branch from 5ef29a5 to 43dc4f2 Compare July 10, 2024 12:45
Base automatically changed from users/arsenm/amdgpu-subtarget-feature-fadd-denormal-support to main July 10, 2024 12:48
@arsenm arsenm force-pushed the users/arsenm/amdgpu-add-feature-for-buffer-atomic-fadd-f64 branch from 4590c05 to 788b25a Compare July 10, 2024 12:51
@arsenm arsenm merged commit 2ef4f86 into main Jul 10, 2024
@arsenm arsenm deleted the users/arsenm/amdgpu-add-feature-for-buffer-atomic-fadd-f64 branch July 10, 2024 12:55
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants