[llvm] [AMDGPU] Provide control over AGPR/VGPR MFMA form (PR #148079)

Jeffrey Byrnes via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 11 12:59:24 PDT 2025


================
@@ -29,6 +29,24 @@ enum { MAX_LANES = 64 };
 
 using namespace llvm;
 
+namespace {
+enum MFMARegClass {
+  Unspecified,
+  VGPR,
+  AGPR,
+};
+}
+
+cl::opt<MFMARegClass>
+    MFMAForm("amdgpu-mfma-form", cl::Hidden,
+             cl::desc("Register class to use for Opc and Dest of MFMA. If "
+                      "unspecified, default to compiler heuristics"),
+             cl::init(MFMARegClass::Unspecified),
+             cl::values(clEnumValN(MFMARegClass::VGPR, "vgpr",
+                                   "Use the VGPR MFMA form."),
+                        clEnumValN(MFMARegClass::AGPR, "agpr",
+                                   "Use the VGPR MFMA form.")));
----------------
jrbyrnes wrote:

Okay I think that makes sense, since the main use case we care about is false positive for the `MayNeedAGPRs` MFMA selection predicate.

I can see how RA may work a bit better if we handled the false negative, but we already have `amdgpu-agpr-alloc` which may help address this.

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


More information about the llvm-commits mailing list