[llvm] [MISched] Use right boundary when trying latency heuristics (PR #116592)
Pengcheng Wang via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 18 01:15:48 PST 2024
https://github.com/wangpc-pp created https://github.com/llvm/llvm-project/pull/116592
We may do bottom-up or bidirectional scheduling but previously we
assume we are doing top-down scheduling, which may cause some issues.
>From 0d333a56ecce4c398cbf16dfc96fc362cba530f7 Mon Sep 17 00:00:00 2001
From: Wang Pengcheng <wangpengcheng.pp at bytedance.com>
Date: Mon, 18 Nov 2024 17:12:21 +0800
Subject: [PATCH] [MISched] Use right boundary when trying latency heuristics
We may do bottom-up or bidirectional scheduling but previously we
assume we are doing top-down scheduling, which may cause some issues.
---
llvm/lib/CodeGen/MachineScheduler.cpp | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index d65db91ac1ebd5..1488411c01eb0b 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -3969,9 +3969,14 @@ bool PostGenericScheduler::tryCandidate(SchedCandidate &Cand,
TryCand, Cand, ResourceDemand))
return TryCand.Reason != NoCand;
- // Avoid serializing long latency dependence chains.
- if (Cand.Policy.ReduceLatency && tryLatency(TryCand, Cand, Top)) {
- return TryCand.Reason != NoCand;
+ // We only compare a subset of features when comparing nodes between
+ // Top and Bottom boundary.
+ if (Cand.AtTop == TryCand.AtTop) {
+ // Avoid serializing long latency dependence chains.
+ if (Cand.Policy.ReduceLatency &&
+ tryLatency(TryCand, Cand, Cand.AtTop ? Top : Bot)) {
+ return TryCand.Reason != NoCand;
+ }
}
// Fall through to original instruction order.
More information about the llvm-commits
mailing list