Skip to content

Commit 21ad7e2

Browse files
authored
Enable latency instrument on RISC V
1 parent 44e71c9 commit 21ad7e2

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

llvm/lib/Target/RISCV/MCA/RISCVCustomBehaviour.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ uint8_t RISCVSEWInstrument::getSEW() const {
8686
bool RISCVInstrumentManager::supportsInstrumentType(
8787
llvm::StringRef Type) const {
8888
return Type == RISCVLMULInstrument::DESC_NAME ||
89-
Type == RISCVSEWInstrument::DESC_NAME;
89+
Type == RISCVSEWInstrument::DESC_NAME ||
90+
InstrumentManager::supportsInstrumentType(Type);;
9091
}
9192

9293
UniqueInstrument
@@ -110,8 +111,9 @@ RISCVInstrumentManager::createInstrument(llvm::StringRef Desc,
110111
return std::make_unique<RISCVSEWInstrument>(Data);
111112
}
112113

113-
LLVM_DEBUG(dbgs() << "RVCB: Unknown instrumentation Desc: " << Desc << '\n');
114-
return nullptr;
114+
LLVM_DEBUG(dbgs() << "RVCB: Creating default instrument for Desc: "
115+
<< Desc << '\n');
116+
return InstrumentManager::createInstrument(Desc, Data);
115117
}
116118

117119
SmallVector<UniqueInstrument>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
2+
# RUN: llvm-mca -mtriple=riscv64 -mcpu=sifive-x280 -iterations=1 < %s | FileCheck %s
3+
4+
# LLVM-MCA-LATENCY 100
5+
add a0, a0, a0
6+
7+
# CHECK: Iterations: 1
8+
# CHECK-NEXT: Instructions: 1
9+
# CHECK-NEXT: Total Cycles: 101
10+
# CHECK-NEXT: Total uOps: 1
11+
12+
# CHECK: Dispatch Width: 2
13+
# CHECK-NEXT: uOps Per Cycle: 0.01
14+
# CHECK-NEXT: IPC: 0.01
15+
# CHECK-NEXT: Block RThroughput: 0.5
16+
17+
# CHECK: Instruction Info:
18+
# CHECK-NEXT: [1]: #uOps
19+
# CHECK-NEXT: [2]: Latency
20+
# CHECK-NEXT: [3]: RThroughput
21+
# CHECK-NEXT: [4]: MayLoad
22+
# CHECK-NEXT: [5]: MayStore
23+
# CHECK-NEXT: [6]: HasSideEffects (U)
24+
25+
# CHECK: [1] [2] [3] [4] [5] [6] Instructions:
26+
# CHECK-NEXT: 1 3 0.50 add a0, a0, a0
27+
28+
# CHECK: Resources:
29+
# CHECK-NEXT: [0] - VLEN512SiFive7FDiv
30+
# CHECK-NEXT: [1] - VLEN512SiFive7IDiv
31+
# CHECK-NEXT: [2] - VLEN512SiFive7PipeA
32+
# CHECK-NEXT: [3] - VLEN512SiFive7PipeB
33+
# CHECK-NEXT: [4] - VLEN512SiFive7VA
34+
# CHECK-NEXT: [5] - VLEN512SiFive7VCQ
35+
# CHECK-NEXT: [6] - VLEN512SiFive7VL
36+
# CHECK-NEXT: [7] - VLEN512SiFive7VS
37+
38+
# CHECK: Resource pressure per iteration:
39+
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7]
40+
# CHECK-NEXT: - - - 1.00 - - - -
41+
42+
# CHECK: Resource pressure by instruction:
43+
# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] Instructions:
44+
# CHECK-NEXT: - - - 1.00 - - - - add a0, a0, a0

0 commit comments

Comments
 (0)