[llvm-branch-commits] [llvm] [AMDGPU] Fix the packed F32 unpack window in SIPreEmitPeephole (PR #233721)

Akash Dutta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Oct 21 09:52:00 PDT 2026


================
@@ -385,6 +385,58 @@ llvm::AMDGPU::CoExecInfo llvm::AMDGPU::getMFMACoExecInfo(unsigned Opcode) {
   }
 }
 
+static unsigned getMFMANumPasses(const MachineInstr &MFMA,
+                                 const SIInstrInfo &TII) {
+  unsigned NumPasses = TII.getRepeatRate(MFMA);
+  assert(NumPasses >= 2 && "MFMA has no pass count in the scheduling model");
+  return NumPasses;
+}
+
+static unsigned getMFMASrcSize(const MachineInstr &MFMA, AMDGPU::OpName Name,
+                               const SIInstrInfo &TII) {
+  unsigned Opc = MFMA.getOpcode();
+  return TII.getOpSize(Opc, AMDGPU::getNamedOperandIdx(Opc, Name));
+}
+
+unsigned llvm::AMDGPU::getVALUIssueCycle(const MachineInstr &MFMA,
+                                         const SIInstrInfo &TII) {
+  assert(TII.getSubtarget().hasGFX940Insts() && SIInstrInfo::isMFMA(MFMA) &&
+         "expected a gfx942 or gfx950 MFMA");
+  if (!TII.isXDL(MFMA))
+    return getMFMANumPasses(MFMA, TII) + 2;
+
+  // An XDL holds VALU off for one cycle per 16 bytes of its widest A/B source.
+  unsigned MaxSrcSize = std::max(getMFMASrcSize(MFMA, OpName::src0, TII),
+                                 getMFMASrcSize(MFMA, OpName::src1, TII));
+  return 1 + MaxSrcSize / 16;
----------------
akadutta wrote:

going from the comment above, this will return 2 if MFMASrcSize is 16. shouldn't it be 1 instead?

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


More information about the llvm-branch-commits mailing list