Skip to content

Commit 7d85a03

Browse files
committed
[RISCV] LMUL lists for indexed and strided loads
Create additional lists representing valid LMULs for strided and indexed load of particular element sizes.
1 parent 954fa0f commit 7d85a03

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

llvm/lib/Target/RISCV/RISCVSchedSiFive7.td

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ multiclass SiFive7WriteResBase<int VLEN,
562562
// resource, we do not need to use LMULSEWXXX constructors. However, we do
563563
// use the SEW from the name to determine the number of Cycles.
564564

565-
foreach mx = SchedMxList in {
565+
foreach mx = SchedMxListDS8 in {
566566
defvar VLDSX0Cycles = SiFive7GetCyclesDefault<mx>.c;
567567
defvar Cycles = SiFive7GetCyclesOnePerElement<mx, 8, VLEN>.c;
568568
defvar IsWorstCase = SiFive7IsWorstCaseMX<mx, SchedMxList>.c;
@@ -582,10 +582,8 @@ multiclass SiFive7WriteResBase<int VLEN,
582582
defm : LMULWriteResMX<"WriteVSTOX8", [VCQ, VS], mx, IsWorstCase>;
583583
}
584584
}
585-
// TODO: The MxLists need to be filtered by EEW. We only need to support
586-
// LMUL >= SEW_min/ELEN. Here, the smallest EEW prevents us from having MF8
587-
// since LMUL >= 16/64.
588-
foreach mx = ["MF4", "MF2", "M1", "M2", "M4", "M8"] in {
585+
586+
foreach mx = SchedMxListDS16 in {
589587
defvar VLDSX0Cycles = SiFive7GetCyclesDefault<mx>.c;
590588
defvar Cycles = SiFive7GetCyclesOnePerElement<mx, 16, VLEN>.c;
591589
defvar IsWorstCase = SiFive7IsWorstCaseMX<mx, SchedMxList>.c;
@@ -605,7 +603,7 @@ multiclass SiFive7WriteResBase<int VLEN,
605603
defm : LMULWriteResMX<"WriteVSTOX16", [VCQ, VS], mx, IsWorstCase>;
606604
}
607605
}
608-
foreach mx = ["MF2", "M1", "M2", "M4", "M8"] in {
606+
foreach mx = SchedMxListDS32 in {
609607
defvar VLDSX0Cycles = SiFive7GetCyclesDefault<mx>.c;
610608
defvar Cycles = SiFive7GetCyclesOnePerElement<mx, 32, VLEN>.c;
611609
defvar IsWorstCase = SiFive7IsWorstCaseMX<mx, SchedMxList>.c;
@@ -625,7 +623,7 @@ multiclass SiFive7WriteResBase<int VLEN,
625623
defm : LMULWriteResMX<"WriteVSTOX32", [VCQ, VS], mx, IsWorstCase>;
626624
}
627625
}
628-
foreach mx = ["M1", "M2", "M4", "M8"] in {
626+
foreach mx = SchedMxListDS64 in {
629627
defvar VLDSX0Cycles = SiFive7GetCyclesDefault<mx>.c;
630628
defvar Cycles = SiFive7GetCyclesOnePerElement<mx, 64, VLEN>.c;
631629
defvar IsWorstCase = SiFive7IsWorstCaseMX<mx, SchedMxList>.c;

llvm/lib/Target/RISCV/RISCVSchedTTAscalonD8.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ foreach mx = SchedMxList in {
437437
defm "" : LMULWriteResMX<"WriteVSTM", [AscalonLS], mx, IsWorstCase>;
438438
}
439439

440-
foreach mx = SchedMxList in {
440+
foreach mx = SchedMxListDS8 in {
441441
defvar Cycles = AscalonGetCyclesLMUL<mx, 2>.c;
442442
defvar IsWorstCase = AscalonIsWorstCaseMX<mx, SchedMxList>.c;
443443
let Latency = Cycles in {
@@ -449,7 +449,7 @@ foreach mx = SchedMxList in {
449449
defm "" : LMULWriteResMX<"WriteVSTOX8", [AscalonLS], mx, IsWorstCase>;
450450
}
451451
}
452-
foreach mx = ["MF4", "MF2", "M1", "M2", "M4", "M8"] in {
452+
foreach mx = SchedMxListDS16 in {
453453
defvar Cycles = AscalonGetCyclesLMUL<mx, 2>.c;
454454
defvar IsWorstCase = AscalonIsWorstCaseMX<mx, SchedMxList>.c;
455455
let Latency = Cycles in {
@@ -461,7 +461,7 @@ foreach mx = ["MF4", "MF2", "M1", "M2", "M4", "M8"] in {
461461
defm "" : LMULWriteResMX<"WriteVSTOX16", [AscalonLS], mx, IsWorstCase>;
462462
}
463463
}
464-
foreach mx = ["MF2", "M1", "M2", "M4", "M8"] in {
464+
foreach mx = SchedMxListDS32 in {
465465
defvar Cycles = AscalonGetCyclesLMUL<mx, 2>.c;
466466
defvar IsWorstCase = AscalonIsWorstCaseMX<mx, SchedMxList>.c;
467467
let Latency = Cycles in {
@@ -473,7 +473,7 @@ foreach mx = ["MF2", "M1", "M2", "M4", "M8"] in {
473473
defm "" : LMULWriteResMX<"WriteVSTOX32", [AscalonLS], mx, IsWorstCase>;
474474
}
475475
}
476-
foreach mx = ["M1", "M2", "M4", "M8"] in {
476+
foreach mx = SchedMxListDS64 in {
477477
defvar Cycles = AscalonGetCyclesLMUL<mx, 2>.c;
478478
defvar IsWorstCase = AscalonIsWorstCaseMX<mx, SchedMxList>.c;
479479
let Latency = Cycles in {

llvm/lib/Target/RISCV/RISCVScheduleV.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ defvar SchedMxListFW = !listremove(SchedMxList, ["M8", "MF8"]);
1919
defvar SchedMxListF = !listremove(SchedMxList, ["MF8"]);
2020
// Used for widening floating-point Reduction as it doesn't contain MF8.
2121
defvar SchedMxListFWRed = SchedMxListF;
22+
// Used for indexed and strided loads of 8 bit lanes, same as full MX list
23+
defvar SchedMxListDS8 = SchedMxList;
24+
// Used for indexed and strided loads of 16 bit lanes
25+
defvar SchedMxListDS16 = SchedMxListF;
26+
// Used for indexed and strided loads of 32 bit lanes
27+
defvar SchedMxListDS32 = !listremove(SchedMxListDS16, ["MF4"]);
28+
// Used for indexed and strided loads of 64 bit lanes
29+
defvar SchedMxListDS64 = !listremove(SchedMxListDS32, ["MF2"]);
2230

2331
class SchedSEWSet<string mx, bit isF = 0, bit isWidening = 0> {
2432
assert !or(!not(isF), !ne(mx, "MF8")), "LMUL shouldn't be MF8 for floating-point";

0 commit comments

Comments
 (0)