[llvm] dd2ba5b - [AMDGPU] Added a debug counter to Rewrite AGPR-Copy-MFMA pass (#189437)

via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 10 11:57:03 PDT 2026


Author: Dhruva Chakrabarti
Date: 2026-04-10T11:56:58-07:00
New Revision: dd2ba5b3b406d70ef668425ed7aef76b04feaf47

URL: https://github.com/llvm/llvm-project/commit/dd2ba5b3b406d70ef668425ed7aef76b04feaf47
DIFF: https://github.com/llvm/llvm-project/commit/dd2ba5b3b406d70ef668425ed7aef76b04feaf47.diff

LOG: [AMDGPU] Added a debug counter to Rewrite AGPR-Copy-MFMA pass (#189437)

The debug counter can be used to control the MFMA chains rewritten to
AGPR form.

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/AMDGPURewriteAGPRCopyMFMA.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/AMDGPURewriteAGPRCopyMFMA.cpp b/llvm/lib/Target/AMDGPU/AMDGPURewriteAGPRCopyMFMA.cpp
index 931a2854c54f9..53be369db35cf 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPURewriteAGPRCopyMFMA.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPURewriteAGPRCopyMFMA.cpp
@@ -35,11 +35,15 @@
 #include "llvm/CodeGen/SlotIndexes.h"
 #include "llvm/CodeGen/VirtRegMap.h"
 #include "llvm/InitializePasses.h"
+#include "llvm/Support/DebugCounter.h"
 
 using namespace llvm;
 
 #define DEBUG_TYPE "amdgpu-rewrite-agpr-copy-mfma"
 
+DEBUG_COUNTER(RewriteAGPRCopyMFMACounter, DEBUG_TYPE,
+              "Controls which MFMA chains are rewritten to AGPR form");
+
 namespace {
 
 STATISTIC(NumMFMAsRewrittenToAGPR,
@@ -268,7 +272,8 @@ bool AMDGPURewriteAGPRCopyMFMAImpl::tryReassigningMFMAChain(
     LRM.unassign(LI);
   }
 
-  if (!attemptReassignmentsToAGPR(RewriteRegs, PhysRegHint)) {
+  if (!DebugCounter::shouldExecute(RewriteAGPRCopyMFMACounter) ||
+      !attemptReassignmentsToAGPR(RewriteRegs, PhysRegHint)) {
     // Roll back the register assignments to the original state.
     for (auto [LI, OldAssign] : TentativeReassignments) {
       if (VRM.hasPhys(LI->reg()))


        


More information about the llvm-commits mailing list