Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AMDGPU] Use the SchedModel available in SIInstrInfo #110859

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions llvm/lib/Target/AMDGPU/AMDGPUInsertDelayAlu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AMDGPUInsertDelayAlu : public MachineFunctionPass {
const SIInstrInfo *SII;
const TargetRegisterInfo *TRI;

TargetSchedModel SchedModel;
const TargetSchedModel *SchedModel;

AMDGPUInsertDelayAlu() : MachineFunctionPass(ID) {}

Expand Down Expand Up @@ -387,7 +387,7 @@ class AMDGPUInsertDelayAlu : public MachineFunctionPass {
if (Type != OTHER) {
// TODO: Scan implicit defs too?
for (const auto &Op : MI.defs()) {
unsigned Latency = SchedModel.computeOperandLatency(
unsigned Latency = SchedModel->computeOperandLatency(
&MI, Op.getOperandNo(), nullptr, 0);
for (MCRegUnit Unit : TRI->regunits(Op.getReg()))
State[Unit] = DelayInfo(Type, Latency);
Expand Down Expand Up @@ -429,8 +429,7 @@ class AMDGPUInsertDelayAlu : public MachineFunctionPass {

SII = ST.getInstrInfo();
TRI = ST.getRegisterInfo();

SchedModel.init(&ST);
SchedModel = &SII->getSchedModel();

// Calculate the delay state for each basic block, iterating until we reach
// a fixed point.
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ static bool shouldRunLdsBranchVmemWARHazardFixup(const MachineFunction &MF,
GCNHazardRecognizer::GCNHazardRecognizer(const MachineFunction &MF)
: IsHazardRecognizerMode(false), CurrCycleInstr(nullptr), MF(MF),
ST(MF.getSubtarget<GCNSubtarget>()), TII(*ST.getInstrInfo()),
TRI(TII.getRegisterInfo()), UseVALUReadHazardExhaustiveSearch(false),
TRI(TII.getRegisterInfo()), TSchedModel(TII.getSchedModel()),
UseVALUReadHazardExhaustiveSearch(false),
ClauseUses(TRI.getNumRegUnits()), ClauseDefs(TRI.getNumRegUnits()) {
MaxLookAhead = MF.getRegInfo().isPhysRegUsed(AMDGPU::AGPR0) ? 19 : 5;
TSchedModel.init(&ST);
RunLdsBranchVmemWARHazardFixup = shouldRunLdsBranchVmemWARHazardFixup(MF, ST);
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class GCNHazardRecognizer final : public ScheduleHazardRecognizer {
const GCNSubtarget &ST;
const SIInstrInfo &TII;
const SIRegisterInfo &TRI;
TargetSchedModel TSchedModel;
const TargetSchedModel &TSchedModel;
bool RunLdsBranchVmemWARHazardFixup;
BitVector VALUReadHazardSGPRs;
bool UseVALUReadHazardExhaustiveSearch;
Expand Down
Loading