[llvm] unpack packed instructions overlapped by MFMAs post-RA scheduling (PR #157968)
Jeffrey Byrnes via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 18 07:33:56 PDT 2025
================
@@ -483,5 +799,29 @@ bool SIPreEmitPeephole::run(MachineFunction &MF) {
}
}
+ // TODO: Fold this into previous block, if possible. Evaluate and handle any
+ // side effects.
+ for (MachineBasicBlock &MBB : MF) {
+ // Unpack packed instructions overlapped by MFMAs. This allows the compiler
+ // to co-issue unpacked instructions with MFMA
+ uint16_t NumMFMACycles = 0;
+ auto SchedModel = TII->getSchedModel();
+ SetVector<MachineInstr *> InstrsToUnpack;
+ for (auto &MI : make_early_inc_range(MBB.instrs())) {
+ if (SIInstrInfo::isMFMA(MI)) {
+ const MCSchedClassDesc *SchedClassDesc =
+ SchedModel.resolveSchedClass(&MI);
+ NumMFMACycles =
+ SchedModel.getWriteProcResBegin(SchedClassDesc)->ReleaseAtCycle;
+ collectUnpackingCandidates(MI, InstrsToUnpack, NumMFMACycles);
+ }
+ }
+ if (!InstrsToUnpack.empty()) {
----------------
jrbyrnes wrote:
Redundant check for empty
https://github.com/llvm/llvm-project/pull/157968
More information about the llvm-commits
mailing list