[llvm] AMDGPU: Select VGPR MFMAs by default (PR #159493)

Jeffrey Byrnes via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 16 10:34:26 PST 2025


================
@@ -37,7 +37,7 @@ static cl::opt<bool, true> MFMAVGPRFormOpt(
     "amdgpu-mfma-vgpr-form",
     cl::desc("Whether to force use VGPR for Opc and Dest of MFMA. If "
              "unspecified, default to compiler heuristics"),
-    cl::location(SIMachineFunctionInfo::MFMAVGPRForm), cl::init(false),
+    cl::location(SIMachineFunctionInfo::MFMAVGPRForm), cl::init(true),
----------------
jrbyrnes wrote:

I don't understand why we need the flag at all anymore.

Previously, we had a rudimentary heuristic https://github.com/llvm/llvm-project/blob/8122ccdca9dd38d15927ba35d2c13fec1160320e/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp#L89 -- we compared the max number of VGPRs based on waves-per-eu and compared this to the addressible number of arch VGPR. If the max number of VGPRs exceeded the addressible arch VGPR (i.e. waves-per-eu 1) then we would MayNeedAGPRs = false, and select the AGPR form. This flag was needed to override this for cases where we wanted to use VGPR form for waves-per-eu 1.

However, after https://github.com/llvm/llvm-project/commit/476a6ea9575f1a8498e080b4ace0700c3b91f9c1 the heuristic was deleted. So this flag now just overrides the amdgpu-agpr-alloc attribute?

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


More information about the llvm-commits mailing list