[llvm] [AMDGPU] Avoid wmma bank conflict for GFX11 and GFX12 (PR #205530)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 24 04:32:32 PDT 2026


================
@@ -262,6 +266,41 @@ void GCNPreRAOptimizationsImpl::hintTrue16Copy(const MachineInstr &MI) {
     MRI->setRegAllocationHint(Dst, AMDGPURI::Size16, Src);
 }
 
+void GCNPreRAOptimizationsImpl::recordWMMABankSiblings(
+    const MachineInstr &MI, SIMachineFunctionInfo &MFI) {
+  // The consecutive-allocation VGPR bank collision only happens when each
+  // matrix operand is a multiple of 4 VGPRs (128 bits) wide; with narrower
+  // operands the start registers already fall on different banks. Restrict the
+  // hint to WMMAs whose matrix source operands are a multiple of 128 bits.
+  auto Is128BitMultiple = [&](AMDGPU::OpName Name) {
+    const MachineOperand *MO = TII->getNamedOperand(MI, Name);
+    return MO && MO->isReg() && MO->getReg() &&
+           TRI->getRegSizeInBits(MO->getReg(), *MRI) % 128 == 0;
----------------
arsenm wrote:

Use register class based checks instead of the size 

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


More information about the llvm-commits mailing list