Skip to content

Commit eb53d08

Browse files
[llvm-exegesis] Add Pfm Counters for SapphireRapids (#113847)
This patch adds the appropriate hookups in X86PfmCounters.td for SapphireRapids. This is mostly to fix errors when some of my jobs that only really need dummy counters get scheduled on sapphire rapids machines, but figured I might as well do it properly while here. I do not have hardware access to test this currently, but this matches exactly with what is in the libpfm source code.
1 parent 5ac3f3c commit eb53d08

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

llvm/lib/Target/X86/X86PfmCounters.td

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,22 @@ def AlderLakePfmCounters : ProcPfmCounters {
220220
}
221221
def : PfmCountersBinding<"alderlake", AlderLakePfmCounters>;
222222

223+
def SapphireRapidsPfmCounters : ProcPfmCounters {
224+
let CycleCounter = UnhaltedCoreCyclesPfmCounter;
225+
let UopsCounter = UopsIssuedPfmCounter;
226+
let IssueCounters = [
227+
PfmIssueCounter<"SPRPort00", "uops_dispatched_port:port_0">,
228+
PfmIssueCounter<"SPRPort01", "uops_dispatched_port:port_1">,
229+
PfmIssueCounter<"SPRPort02_03_10", "uops_dispatched_port:port_2_3_10">,
230+
PfmIssueCounter<"SPRPort04_09", "uops_dispatched_port:port_4_9">,
231+
PfmIssueCounter<"SPRPort05_11", "uops_dispatched_port:port_5_11">,
232+
PfmIssueCounter<"SPRPort06", "uops_dispatched_port:port_6">,
233+
PfmIssueCounter<"SPRPort07_08", "uops_dispatched_port:port_7_8">,
234+
];
235+
let ValidationCounters = DefaultIntelPfmValidationCounters;
236+
}
237+
def : PfmCountersBinding<"sapphirerapids", SapphireRapidsPfmCounters>;
238+
223239
// AMD X86 Counters.
224240
defvar DefaultAMDPfmValidationCounters = [
225241
PfmValidationCounter<InstructionRetired, "RETIRED_INSTRUCTIONS">,

llvm/lib/Target/X86/X86SchedSapphireRapids.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def SPRPort01_05 : ProcResGroup<[SPRPort01, SPRPort05]>;
5959
def SPRPort01_05_10 : ProcResGroup<[SPRPort01, SPRPort05, SPRPort10]>;
6060
def SPRPort02_03 : ProcResGroup<[SPRPort02, SPRPort03]>;
6161
def SPRPort02_03_11 : ProcResGroup<[SPRPort02, SPRPort03, SPRPort11]>;
62+
def SPRPort02_03_10 : ProcResGroup<[SPRPort02, SPRPort03, SPRPort10]>;
63+
def SPRPort05_11 : ProcResGroup<[SPRPort05, SPRPort11]>;
6264
def SPRPort07_08 : ProcResGroup<[SPRPort07, SPRPort08]>;
6365

6466
// EU has 112 reservation stations.
@@ -78,6 +80,10 @@ def SPRPort02_03_07_08_11 : ProcResGroup<[SPRPort02, SPRPort03, SPRPort07,
7880
let BufferSize = 72;
7981
}
8082

83+
def SPRPortAny : ProcResGroup<[SPRPort00, SPRPort01, SPRPort02, SPRPort03,
84+
SPRPort04, SPRPort05, SPRPort06, SPRPort07,
85+
SPRPort08, SPRPort09, SPRPort10, SPRPort11]>;
86+
8187
// Integer loads are 5 cycles, so ReadAfterLd registers needn't be available
8288
// until 5 cycles after the memory operand.
8389
def : ReadAdvance<ReadAfterLd, 5>;

0 commit comments

Comments
 (0)