Skip to content

Commit 54194e1

Browse files
authored
[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.
1 parent 91a3c6f commit 54194e1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

llvm/lib/Target/RISCV/RISCVSchedSiFive7.td

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -961,15 +961,18 @@ def : InstRW<[WriteIALU], (instrs COPY)>;
961961

962962
// VCIX
963963
//
964-
// In principle we don't know the latency of any VCIX instructions. But instead
965-
// of taking the default of 1, which can lead to issues [1], we assume that they
966-
// have a fairly high latency.
964+
// In principle we don't know the latency of any VCIX instructions (they
965+
// depends on a particular coprocessor implementation). However, the default
966+
// latency of 1 can lead to issues [1]. So instead we set the latency to the
967+
// default provided by `SiFive7GetCyclesDefault`. This is still not accurate
968+
// and can lead to suboptimal codegen, but should hopefully be a better
969+
// starting point.
967970
//
968971
// [1] https://github.com/llvm/llvm-project/issues/83391
969972
foreach mx = SchedMxList in {
970973
defvar Cycles = SiFive7GetCyclesDefault<mx>.c;
971974
defvar IsWorstCase = SiFive7IsWorstCaseMX<mx, SchedMxList>.c;
972-
let Latency = !mul(Cycles, 10),
975+
let Latency = Cycles,
973976
AcquireAtCycles = [0, 1],
974977
ReleaseAtCycles = [1, !add(1, Cycles)] in {
975978
defm "" : LMULWriteResMX<"WriteVC_V_I", [SiFive7VCQ, SiFive7VA], mx, IsWorstCase>;

0 commit comments

Comments
 (0)