Skip to content

Commit 3516ad0

Browse files
[RISCV] Update SpacemiT X60 scheduling latencies based on hardware measurements (#144730)
This patch updates the RISC-V SpacemiT X60 scheduling model with latency values collected from the X60 hardware. The previous values were empirically derived but were slightly off. Changes: - LoadLatency (baseline for load instructions): 5 --> 3 cycles - Memory operations: unified at 4 cycles - Atomic loads/stores: 5 --> 8 cycles - Atomic RMW operations: 5 --> 12 cycles Hardware-measured values provide more accurate instruction scheduling for the in-order X60 core. Testing shows NFC across benchmarks except for 523.xalancbmk_r (known to be noisy). https://lnt.lukelau.me/db_default/v4/nts/663?compare_to=657
1 parent eb694b2 commit 3516ad0

File tree

4 files changed

+113
-112
lines changed

4 files changed

+113
-112
lines changed

llvm/lib/Target/RISCV/RISCVSchedSpacemitX60.td

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
def SpacemitX60Model : SchedMachineModel {
1717
let IssueWidth = 2; // dual-issue
1818
let MicroOpBufferSize = 0; // in-order
19-
let LoadLatency = 5; // worse case: >= 3
19+
let LoadLatency = 3; // worse case: >= 3
2020
let MispredictPenalty = 9; // nine-stage
2121

2222
let CompleteModel = 0;
@@ -114,19 +114,15 @@ def : WriteRes<WriteBEXT, [SMX60_IEU]>;
114114
def : WriteRes<WriteBEXTI, [SMX60_IEU]>;
115115

116116
// Memory/Atomic memory
117-
let Latency = 3 in {
117+
let Latency = 4 in {
118118
def : WriteRes<WriteSTB, [SMX60_LS]>;
119119
def : WriteRes<WriteSTH, [SMX60_LS]>;
120120
def : WriteRes<WriteSTW, [SMX60_LS]>;
121121
def : WriteRes<WriteSTD, [SMX60_LS]>;
122122
def : WriteRes<WriteFST16, [SMX60_LS]>;
123123
def : WriteRes<WriteFST32, [SMX60_LS]>;
124124
def : WriteRes<WriteFST64, [SMX60_LS]>;
125-
def : WriteRes<WriteAtomicSTW, [SMX60_LS]>;
126-
def : WriteRes<WriteAtomicSTD, [SMX60_LS]>;
127-
}
128125

129-
let Latency = 5 in {
130126
def : WriteRes<WriteLDB, [SMX60_LS]>;
131127
def : WriteRes<WriteLDH, [SMX60_LS]>;
132128
def : WriteRes<WriteLDW, [SMX60_LS]>;
@@ -137,9 +133,14 @@ let Latency = 5 in {
137133
}
138134

139135
// Atomics
140-
let Latency = 5 in {
136+
let Latency = 8 in {
137+
def : WriteRes<WriteAtomicSTW, [SMX60_LS]>;
138+
def : WriteRes<WriteAtomicSTD, [SMX60_LS]>;
141139
def : WriteRes<WriteAtomicLDW, [SMX60_LS]>;
142140
def : WriteRes<WriteAtomicLDD, [SMX60_LS]>;
141+
}
142+
143+
let Latency = 12 in {
143144
def : WriteRes<WriteAtomicW, [SMX60_LS]>;
144145
def : WriteRes<WriteAtomicD, [SMX60_LS]>;
145146
}

0 commit comments

Comments
 (0)