Skip to content

Commit 4674bdf

Browse files
Derek Howerdhower-qc
authored andcommitted
Add Smctr/Ssctr YAML and properly attribute SCTRCLR to them
1 parent 3d9e72f commit 4674bdf

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed

arch/ext/Smctr.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# yaml-language-server: $schema=../../schemas/ext_schema.json
2+
3+
$schema: "ext_schema.json#"
4+
kind: extension
5+
name: Smctr
6+
long_name: Control Transfer Records
7+
description: |
8+
A method for recording control flow transfer history is valuable not only for performance
9+
profiling but also for debugging.
10+
Control flow transfers refer to jump instructions (including function calls and returns), taken
11+
branch instructions, traps, and trap returns.
12+
Profiling tools, such as Linux perf, collect control transfer history when sampling software
13+
execution, thereby enabling tools, like AutoFDO, to identify hot paths for optimization.
14+
15+
Control flow trace capabilities offer very deep transfer history, but the volume of data produced
16+
can result in significant performance overheads due to memory bandwidth consumption, buffer
17+
management, and decoder overhead.
18+
The Control Transfer Records (CTR) extension provides a method to record a limited history in
19+
register-accessible internal chip storage, with the intent of dramatically reducing the
20+
performance overhead and complexity of collecting transfer history.
21+
22+
CTR defines a circular (FIFO) buffer. Each buffer entry holds a record for a single recorded
23+
control flow transfer.
24+
The number of records that can be held in the buffer depends upon both the implementation (the
25+
maximum supported depth) and the CTR configuration (the software selected depth).
26+
27+
Only qualified transfers are recorded.
28+
Qualified transfers are those that meet the filtering criteria, which include the privilege mode
29+
and the transfer type.
30+
31+
Recorded transfers are inserted at the write pointer, which is then incremented, while older
32+
recorded transfers may be overwritten once the buffer is full.
33+
Or the user can enable RAS (Return Address Stack) emulation mode, where only function calls are
34+
recorded, and function returns pop the last call record.
35+
The source PC, target PC, and some optional metadata (transfer type, elapsed cycles) are stored
36+
for each recorded transfer.
37+
38+
The CTR buffer is accessible through an indirect CSR interface, such that software can specify
39+
which logical entry in the buffer it wishes to read or write.
40+
Logical entry 0 always corresponds to the youngest recorded transfer, followed by entry 1 as the
41+
next youngest, and so on.
42+
type: privileged
43+
versions:
44+
- version: "1.0.0"
45+
state: ratified
46+
ratification_date: 2024-11
47+
implies:
48+
- if: S
49+
then:
50+
name: Ssctr
51+
version: "1.0.0"

arch/ext/Ssctr.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# yaml-language-server: $schema=../../schemas/ext_schema.json
2+
3+
$schema: "ext_schema.json#"
4+
kind: extension
5+
name: Ssctr
6+
long_name: Control Transfer Records
7+
description: |
8+
The supervisor view of `Smctr`.
9+
type: privileged
10+
versions:
11+
- version: "1.0.0"
12+
state: ratified
13+
ratification_date: 2024-11

arch/inst/Smdbltrp/sctrclr.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ name: sctrclr
66
long_name: No synopsis available.
77
description: |
88
No description available.
9-
definedBy: Smdbltrp
9+
definedBy:
10+
anyOf: [Smctr, Ssctr]
1011
assembly: sctrclr
1112
encoding:
1213
match: "00010000010000000000000001110011"

0 commit comments

Comments
 (0)