Skip to content

Commit 571d151

Browse files
[RISCV][MISched] Set EnableIntervals to true for SiFive7 (#75681)
The SiFive7 scheduler model has been using AcquireAtCycles and ReleaseAtCycles for some time. Without EnableIntervals, the scheduler was not making decisions based on this information. This patch sets EnableIntervals to true, and the test case demonstrates that the VADD instructions can be issued one cycle earlier since the VCQ is not reserved. This leads to better saturation of the SiFive7VA.
1 parent 69d7cd8 commit 571d151

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

llvm/lib/Target/RISCV/RISCVSchedSiFive7.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ def SiFive7Model : SchedMachineModel {
198198
let LoadLatency = 3;
199199
let MispredictPenalty = 3;
200200
let CompleteModel = 0;
201+
let EnableIntervals = true;
201202
let UnsupportedFeatures = [HasStdExtZbkb, HasStdExtZbkc, HasStdExtZbkx,
202203
HasStdExtZcmt, HasStdExtZknd, HasStdExtZkne,
203204
HasStdExtZknh, HasStdExtZksed, HasStdExtZksh,
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# RUN: llc -mtriple=riscv64 -mcpu=sifive-x280 -run-pass=machine-scheduler \
2+
# RUN: -debug-only=machine-scheduler -misched-dump-schedule-trace \
3+
# RUN: -misched-topdown -o - %s 2>&1 | FileCheck %s
4+
5+
# The purpose of this test is to show that the VADD instructions are issued so
6+
# that the SiFive7VA is saturated.
7+
---
8+
name: add_m2
9+
tracksRegLiveness: true
10+
body: |
11+
bb.0.entry:
12+
liveins: $v8m2, $v10m2, $v12m2, $v14m2, $x10
13+
14+
%4:gprnox0 = COPY $x10
15+
%3:vrm2 = COPY $v14m2
16+
%2:vrm2 = COPY $v12m2
17+
%1:vrm2 = COPY $v10m2
18+
%0:vrm2 = COPY $v8m2
19+
dead $x0 = PseudoVSETVLI %4, 217 /* e64, m2, ta, ma */, implicit-def $vl, implicit-def $vtype
20+
%5:vrm2 = PseudoVADD_VV_M2 undef %5, %0, %1, $noreg, 6 /* e64 */, 0 /* tu, mu */, implicit $vl, implicit $vtype
21+
%6:vrm2 = PseudoVADD_VV_M2 undef %6, %3, %2, $noreg, 6 /* e64 */, 0 /* tu, mu */, implicit $vl, implicit $vtype
22+
%7:vrm2 = PseudoVADD_VV_M2 undef %7, %5, %6, $noreg, 6 /* e64 */, 0 /* tu, mu */, implicit $vl, implicit $vtype
23+
$v8m2 = COPY %7
24+
PseudoRET implicit $v8m2
25+
26+
# CHECK: *** Final schedule for %bb.0 ***
27+
# CHECK-NEXT: * Schedule table (TopDown):
28+
# CHECK-NEXT: i: issue
29+
# CHECK-NEXT: x: resource booked
30+
# CHECK-NEXT: Cycle | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
31+
# CHECK-NEXT: SU(0) | i | | | | | | | | | | | | | | | | |
32+
# CHECK-NEXT: SiFive7PipeAB | x | | | | | | | | | | | | | | | | |
33+
# CHECK-NEXT: SU(1) | i | | | | | | | | | | | | | | | | |
34+
# CHECK-NEXT: SiFive7PipeAB | x | | | | | | | | | | | | | | | | |
35+
# CHECK-NEXT: SU(2) | | i | | | | | | | | | | | | | | | |
36+
# CHECK-NEXT: SiFive7PipeAB | | x | | | | | | | | | | | | | | | |
37+
# CHECK-NEXT: SU(3) | | i | | | | | | | | | | | | | | | |
38+
# CHECK-NEXT: SiFive7PipeAB | | x | | | | | | | | | | | | | | | |
39+
# CHECK-NEXT: SU(4) | | | i | | | | | | | | | | | | | | |
40+
# CHECK-NEXT: SiFive7PipeAB | | | x | | | | | | | | | | | | | | |
41+
# CHECK-NEXT: SU(5) | | | i | | | | | | | | | | | | | | |
42+
# CHECK-NEXT: SiFive7PipeA | | | x | | | | | | | | | | | | | | |
43+
# CHECK-NEXT: SiFive7PipeAB | | | x | | | | | | | | | | | | | | |
44+
# CHECK-NEXT: SU(7) | | | | | i | | | | | | | | | | | | |
45+
# CHECK-NEXT: SiFive7VCQ | | | | | x | | | | | | | | | | | | |
46+
# CHECK-NEXT: SiFive7VA | | | | | | x | x | x | x | | | | | | | | |
47+
# CHECK-NEXT: SU(6) | | | | | | | | | i | | | | | | | | |
48+
# CHECK-NEXT: SiFive7VCQ | | | | | | | | | x | | | | | | | | |
49+
# CHECK-NEXT: SiFive7VA | | | | | | | | | | x | x | x | x | | | | |
50+
# CHECK-NEXT: SU(8) | | | | | | | | | | | | | i | | | | |
51+
# CHECK-NEXT: SiFive7VCQ | | | | | | | | | | | | | x | | | | |
52+
# CHECK-NEXT: SiFive7VA | | | | | | | | | | | | | | x | x | x | x |
53+
# CHECK-NEXT: SU(9) | | | | | | | | | | | | | | | | | i |
54+
# CHECK-NEXT: SiFive7PipeAB | | | | | | | | | | | | | | | | | x |
55+
56+
...

0 commit comments

Comments
 (0)