[llvm] 54194e1 - [RISCV][SiFive7] Change `Latency` of VCIX to the default (#106497)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 5 10:01:33 PDT 2024
Author: Michal Terepeta
Date: 2024-09-05T13:01:29-04:00
New Revision: 54194e1506bdd6dc37988678a8047ad4d48168fa
URL: https://github.com/llvm/llvm-project/commit/54194e1506bdd6dc37988678a8047ad4d48168fa
DIFF: https://github.com/llvm/llvm-project/commit/54194e1506bdd6dc37988678a8047ad4d48168fa.diff
LOG: [RISCV][SiFive7] Change `Latency` of VCIX to the default (#106497)
Currently we multiply the default (`SiFive7GetCyclesDefault`) by 10, but
this turns out to be both surprising to our users and leads to worse
codegen in most cases. I think it's more natural to just keep the
default.
In the end the right solution is probably to have a separate scheduling
model for a particular VCIX coprocessor.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td b/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
index 3f2e8dee76fd66..24cbe1531c017c 100644
--- a/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
+++ b/llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
@@ -961,15 +961,18 @@ def : InstRW<[WriteIALU], (instrs COPY)>;
// VCIX
//
-// In principle we don't know the latency of any VCIX instructions. But instead
-// of taking the default of 1, which can lead to issues [1], we assume that they
-// have a fairly high latency.
+// In principle we don't know the latency of any VCIX instructions (they
+// depends on a particular coprocessor implementation). However, the default
+// latency of 1 can lead to issues [1]. So instead we set the latency to the
+// default provided by `SiFive7GetCyclesDefault`. This is still not accurate
+// and can lead to suboptimal codegen, but should hopefully be a better
+// starting point.
//
// [1] https://github.com/llvm/llvm-project/issues/83391
foreach mx = SchedMxList in {
defvar Cycles = SiFive7GetCyclesDefault<mx>.c;
defvar IsWorstCase = SiFive7IsWorstCaseMX<mx, SchedMxList>.c;
- let Latency = !mul(Cycles, 10),
+ let Latency = Cycles,
AcquireAtCycles = [0, 1],
ReleaseAtCycles = [1, !add(1, Cycles)] in {
defm "" : LMULWriteResMX<"WriteVC_V_I", [SiFive7VCQ, SiFive7VA], mx, IsWorstCase>;
More information about the llvm-commits
mailing list