[llvm] [clang] [AMDGPU] Emit a waitcnt instruction after each memory instruction (PR #68932)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 6 15:32:25 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff ee1000573e5063f26dcc110983e98fde31e76c87 2c5c4b8ad1bbf11048c0ec14bf6ff64d840391c9 -- clang/test/Driver/amdgpu-features.c llvm/lib/Target/AMDGPU/GCNSubtarget.h llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.h b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
index 0d5098a6b162..fdcd44a4d6cc 100644
--- a/llvm/lib/Target/AMDGPU/GCNSubtarget.h
+++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
@@ -579,9 +579,7 @@ public:
     return EnableCuMode;
   }
 
-  bool isPreciseMemoryEnabled() const {
-    return EnablePreciseMemory;
-  }
+  bool isPreciseMemoryEnabled() const { return EnablePreciseMemory; }
 
   bool hasFlatAddressSpace() const {
     return FlatAddressSpace;
diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index 760848643d07..b97d0166961d 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -56,9 +56,10 @@ static cl::opt<bool> EmitForAllMemOpFlag(
     "amdgpu-waitcnt-for-all-mem-op",
     cl::desc("Emit s_waitcnt 0 after each memory operation"), cl::init(false));
 
-static cl::opt<bool> PreciseMemOpFlag(
-  "amdgpu-precise-memory-op",
-  cl::desc("Emit s_waitcnt 0 after each memory operation"), cl::init(false));
+static cl::opt<bool>
+    PreciseMemOpFlag("amdgpu-precise-memory-op",
+                     cl::desc("Emit s_waitcnt 0 after each memory operation"),
+                     cl::init(false));
 
 namespace {
 // Class of object that encapsulates latest instruction counter score
@@ -397,6 +398,7 @@ private:
   DenseSet<MachineInstr *> ReleaseVGPRInsts;
 
   bool insertWaitcntAfterMemOp(MachineFunction &MF);
+
 public:
   static char ID;
 
@@ -1634,7 +1636,6 @@ bool SIInsertWaitcnts::insertWaitcntInBlock(MachineFunction &MF,
     bool FlushVmCnt = Block.getFirstTerminator() == Inst &&
                       isPreheaderToFlush(Block, ScoreBrackets);
 
-
     // Generate an s_waitcnt instruction to be placed before Inst, if needed.
     Modified |= generateWaitcntInstBefore(Inst, ScoreBrackets, OldWaitcntInstr,
                                           FlushVmCnt);

``````````

</details>


https://github.com/llvm/llvm-project/pull/68932


More information about the cfe-commits mailing list