Skip to content

Commit 93f7398

Browse files
authored
[RISCV] Add TuneDisableLatencySchedHeuristic
This tune feature will disable latency scheduling heuristic. This can reduce the number of spills/reloads but will cause some regressions on some cores. CPU may add this tune feature if they find it's profitable. Reviewers: lukel97, michaelmaitland, asb, preames, mshockwave, topperc Reviewed By: michaelmaitland, mshockwave, topperc Pull Request: #115858
1 parent c4645ff commit 93f7398

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

llvm/lib/Target/RISCV/RISCVFeatures.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,10 @@ def FeatureUnalignedVectorMem
14011401
def TunePostRAScheduler : SubtargetFeature<"use-postra-scheduler",
14021402
"UsePostRAScheduler", "true", "Schedule again after register allocation">;
14031403

1404+
def TuneDisableLatencySchedHeuristic
1405+
: SubtargetFeature<"disable-latency-sched-heuristic", "DisableLatencySchedHeuristic", "true",
1406+
"Disable latency scheduling heuristic">;
1407+
14041408
def TunePredictableSelectIsExpensive
14051409
: SubtargetFeature<"predictable-select-expensive", "PredictableSelectIsExpensive", "true",
14061410
"Prefer likely predicted branches over selects">;

llvm/lib/Target/RISCV/RISCVSubtarget.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ void RISCVSubtarget::overrideSchedPolicy(MachineSchedPolicy &Policy,
203203
Policy.OnlyTopDown = false;
204204
Policy.OnlyBottomUp = false;
205205

206+
// Disabling the latency heuristic can reduce the number of spills/reloads but
207+
// will cause some regressions on some cores.
208+
Policy.DisableLatencyHeuristic = DisableLatencySchedHeuristic;
209+
206210
// Spilling is generally expensive on all RISC-V cores, so always enable
207211
// register-pressure tracking. This will increase compile time.
208212
Policy.ShouldTrackPressure = true;

0 commit comments

Comments
 (0)