Skip to content

Commit 93d35ad

Browse files
authored
AMDGPU: Delete FillMFMAShadowMutation (#123861)
No test changes with this removed and it appears to be obsolete.
1 parent aa580c2 commit 93d35ad

File tree

4 files changed

+0
-150
lines changed

4 files changed

+0
-150
lines changed

llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,6 @@ class GCNPassConfig final : public AMDGPUPassConfig {
10751075
DAG->addMutation(createLoadClusterDAGMutation(DAG->TII, DAG->TRI));
10761076
if (ST.shouldClusterStores())
10771077
DAG->addMutation(createStoreClusterDAGMutation(DAG->TII, DAG->TRI));
1078-
DAG->addMutation(ST.createFillMFMAShadowMutation(DAG->TII));
10791078
DAG->addMutation(
10801079
createIGroupLPDAGMutation(AMDGPU::SchedulingPhase::PostRA));
10811080
if (isPassEnabled(EnableVOPD, CodeGenOptLevel::Less))

llvm/lib/Target/AMDGPU/GCNSubtarget.cpp

Lines changed: 0 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ using namespace llvm;
3838
#include "AMDGPUGenSubtargetInfo.inc"
3939
#undef AMDGPUSubtarget
4040

41-
static cl::opt<bool>
42-
EnablePowerSched("amdgpu-enable-power-sched",
43-
cl::desc("Enable scheduling to minimize mAI power bursts"),
44-
cl::init(false));
45-
4641
static cl::opt<bool> EnableVGPRIndexMode(
4742
"amdgpu-vgpr-index-mode",
4843
cl::desc("Use GPR indexing mode instead of movrel for vector indexing"),
@@ -586,117 +581,6 @@ void GCNSubtarget::adjustSchedDependency(
586581
}
587582
}
588583

589-
namespace {
590-
struct FillMFMAShadowMutation : ScheduleDAGMutation {
591-
const SIInstrInfo *TII;
592-
593-
ScheduleDAGMI *DAG;
594-
595-
FillMFMAShadowMutation(const SIInstrInfo *tii) : TII(tii) {}
596-
597-
bool isSALU(const SUnit *SU) const {
598-
const MachineInstr *MI = SU->getInstr();
599-
return MI && TII->isSALU(*MI) && !MI->isTerminator();
600-
}
601-
602-
bool isVALU(const SUnit *SU) const {
603-
const MachineInstr *MI = SU->getInstr();
604-
return MI && TII->isVALU(*MI);
605-
}
606-
607-
// Link as many SALU instructions in chain as possible. Return the size
608-
// of the chain. Links up to MaxChain instructions.
609-
unsigned linkSALUChain(SUnit *From, SUnit *To, unsigned MaxChain,
610-
SmallPtrSetImpl<SUnit *> &Visited) const {
611-
SmallVector<SUnit *, 8> Worklist({To});
612-
unsigned Linked = 0;
613-
614-
while (!Worklist.empty() && MaxChain-- > 0) {
615-
SUnit *SU = Worklist.pop_back_val();
616-
if (!Visited.insert(SU).second)
617-
continue;
618-
619-
LLVM_DEBUG(dbgs() << "Inserting edge from\n"; DAG->dumpNode(*From);
620-
dbgs() << "to\n"; DAG->dumpNode(*SU); dbgs() << '\n');
621-
622-
if (SU != From && From != &DAG->ExitSU && DAG->canAddEdge(SU, From))
623-
if (DAG->addEdge(SU, SDep(From, SDep::Artificial)))
624-
++Linked;
625-
626-
for (SDep &SI : From->Succs) {
627-
SUnit *SUv = SI.getSUnit();
628-
if (SUv != From && SU != &DAG->ExitSU && isVALU(SUv) &&
629-
DAG->canAddEdge(SUv, SU))
630-
DAG->addEdge(SUv, SDep(SU, SDep::Artificial));
631-
}
632-
633-
for (SDep &SI : SU->Succs) {
634-
SUnit *Succ = SI.getSUnit();
635-
if (Succ != SU && isSALU(Succ))
636-
Worklist.push_back(Succ);
637-
}
638-
}
639-
640-
return Linked;
641-
}
642-
643-
void apply(ScheduleDAGInstrs *DAGInstrs) override {
644-
const GCNSubtarget &ST = DAGInstrs->MF.getSubtarget<GCNSubtarget>();
645-
if (!ST.hasMAIInsts())
646-
return;
647-
DAG = static_cast<ScheduleDAGMI *>(DAGInstrs);
648-
const TargetSchedModel *TSchedModel = DAGInstrs->getSchedModel();
649-
if (!TSchedModel || DAG->SUnits.empty())
650-
return;
651-
652-
// Scan for MFMA long latency instructions and try to add a dependency
653-
// of available SALU instructions to give them a chance to fill MFMA
654-
// shadow. That is desirable to fill MFMA shadow with SALU instructions
655-
// rather than VALU to prevent power consumption bursts and throttle.
656-
auto LastSALU = DAG->SUnits.begin();
657-
auto E = DAG->SUnits.end();
658-
SmallPtrSet<SUnit *, 32> Visited;
659-
for (SUnit &SU : DAG->SUnits) {
660-
MachineInstr &MAI = *SU.getInstr();
661-
if (!TII->isMAI(MAI) ||
662-
MAI.getOpcode() == AMDGPU::V_ACCVGPR_WRITE_B32_e64 ||
663-
MAI.getOpcode() == AMDGPU::V_ACCVGPR_READ_B32_e64)
664-
continue;
665-
666-
unsigned Lat = TSchedModel->computeInstrLatency(&MAI) - 1;
667-
668-
LLVM_DEBUG(dbgs() << "Found MFMA: "; DAG->dumpNode(SU);
669-
dbgs() << "Need " << Lat
670-
<< " instructions to cover latency.\n");
671-
672-
// Find up to Lat independent scalar instructions as early as
673-
// possible such that they can be scheduled after this MFMA.
674-
for (; Lat && LastSALU != E; ++LastSALU) {
675-
if (Visited.count(&*LastSALU))
676-
continue;
677-
678-
if (&SU == &DAG->ExitSU || &SU == &*LastSALU || !isSALU(&*LastSALU) ||
679-
!DAG->canAddEdge(&*LastSALU, &SU))
680-
continue;
681-
682-
Lat -= linkSALUChain(&SU, &*LastSALU, Lat, Visited);
683-
}
684-
}
685-
}
686-
};
687-
} // namespace
688-
689-
void GCNSubtarget::getPostRAMutations(
690-
std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations) const {
691-
Mutations.push_back(std::make_unique<FillMFMAShadowMutation>(&InstrInfo));
692-
}
693-
694-
std::unique_ptr<ScheduleDAGMutation>
695-
GCNSubtarget::createFillMFMAShadowMutation(const TargetInstrInfo *TII) const {
696-
return EnablePowerSched ? std::make_unique<FillMFMAShadowMutation>(&InstrInfo)
697-
: nullptr;
698-
}
699-
700584
unsigned GCNSubtarget::getNSAThreshold(const MachineFunction &MF) const {
701585
if (getGeneration() >= AMDGPUSubtarget::GFX12)
702586
return 0; // Not MIMG encoding.

llvm/lib/Target/AMDGPU/GCNSubtarget.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,13 +1575,6 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
15751575
/// unit requirement.
15761576
unsigned getMaxNumVGPRs(const MachineFunction &MF) const;
15771577

1578-
void getPostRAMutations(
1579-
std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations)
1580-
const override;
1581-
1582-
std::unique_ptr<ScheduleDAGMutation>
1583-
createFillMFMAShadowMutation(const TargetInstrInfo *TII) const;
1584-
15851578
bool isWave32() const {
15861579
return getWavefrontSize() == 32;
15871580
}

llvm/test/CodeGen/AMDGPU/power-sched-no-cycle.mir

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)