blob: a1a4210b5ebf8e4ef226218f19b58e4568ab8f31 [file] [log] [blame]
Clement Courbetb4493792018-04-10 08:16:37 +00001//===-- X86PfmCounters.td - X86 Hardware Counters ----------*- tablegen -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This describes the available hardware counters for various subtargets.
11//
12//===----------------------------------------------------------------------===//
13
Clement Courbet41c8af32018-10-25 07:44:01 +000014def UnhaltedCoreCyclesPfmCounter : PfmCounter<"unhalted_core_cycles">;
15def UopsIssuedPfmCounter : PfmCounter<"uops_issued:any">;
Clement Courbetb4493792018-04-10 08:16:37 +000016
Clement Courbeteee2e062018-11-09 13:15:32 +000017// No default counters on X86.
18def DefaultPfmCounters : ProcPfmCounters {}
19def : PfmCountersDefaultBinding<DefaultPfmCounters>;
20
Simon Pilgrim6155b322018-12-07 17:48:40 +000021// Intel X86 Counters.
22def PentiumPfmCounters : ProcPfmCounters {
23 let CycleCounter = PfmCounter<"cpu_clk_unhalted">;
24 let UopsCounter = PfmCounter<"uops_retired">;
25}
26def : PfmCountersBinding<"pentiumpro", PentiumPfmCounters>;
27def : PfmCountersBinding<"pentium2", PentiumPfmCounters>;
28def : PfmCountersBinding<"pentium3", PentiumPfmCounters>;
29def : PfmCountersBinding<"pentium3m", PentiumPfmCounters>;
30def : PfmCountersBinding<"pentium-m", PentiumPfmCounters>;
31
32def CorePfmCounters : ProcPfmCounters {
33 let CycleCounter = UnhaltedCoreCyclesPfmCounter;
34 let UopsCounter = PfmCounter<"uops_retired:any">;
35}
36def : PfmCountersBinding<"yonah", CorePfmCounters>;
37def : PfmCountersBinding<"prescott", CorePfmCounters>;
38def : PfmCountersBinding<"core2", CorePfmCounters>;
39def : PfmCountersBinding<"penryn", CorePfmCounters>;
40def : PfmCountersBinding<"nehalem", CorePfmCounters>;
41def : PfmCountersBinding<"corei7", CorePfmCounters>;
42def : PfmCountersBinding<"westmere", CorePfmCounters>;
43
44def AtomPfmCounters : ProcPfmCounters {
45 let CycleCounter = UnhaltedCoreCyclesPfmCounter;
46 let UopsCounter = PfmCounter<"uops_retired:any">;
47}
48def : PfmCountersBinding<"bonnell", AtomPfmCounters>;
49def : PfmCountersBinding<"atom", AtomPfmCounters>;
50
51def SLMPfmCounters : ProcPfmCounters {
52 let CycleCounter = UnhaltedCoreCyclesPfmCounter;
53 let UopsCounter = PfmCounter<"uops_retired:any">;
54}
55def : PfmCountersBinding<"silvermont", SLMPfmCounters>;
56def : PfmCountersBinding<"goldmont", SLMPfmCounters>;
57def : PfmCountersBinding<"goldmont-plus", SLMPfmCounters>;
58def : PfmCountersBinding<"tremont", SLMPfmCounters>;
Simon Pilgrime9d82752018-12-09 13:45:15 +000059
60def KnightPfmCounters : ProcPfmCounters {
61 let CycleCounter = UnhaltedCoreCyclesPfmCounter;
62 let UopsCounter = PfmCounter<"uops_retired:all">;
63}
64def : PfmCountersBinding<"knl", KnightPfmCounters>;
65def : PfmCountersBinding<"knm", KnightPfmCounters>;
Simon Pilgrim6155b322018-12-07 17:48:40 +000066
Clement Courbet41c8af32018-10-25 07:44:01 +000067def SandyBridgePfmCounters : ProcPfmCounters {
68 let CycleCounter = UnhaltedCoreCyclesPfmCounter;
69 let UopsCounter = UopsIssuedPfmCounter;
70 let IssueCounters = [
71 PfmIssueCounter<"SBPort0", "uops_dispatched_port:port_0">,
72 PfmIssueCounter<"SBPort1", "uops_dispatched_port:port_1">,
73 PfmIssueCounter<"SBPort23", "uops_dispatched_port:port_2 + uops_dispatched_port:port_3">,
74 PfmIssueCounter<"SBPort4", "uops_dispatched_port:port_4">,
75 PfmIssueCounter<"SBPort5", "uops_dispatched_port:port_5">
76 ];
Clement Courbetb4493792018-04-10 08:16:37 +000077}
Clement Courbet41c8af32018-10-25 07:44:01 +000078def : PfmCountersBinding<"sandybridge", SandyBridgePfmCounters>;
Simon Pilgrim9c7d85b2018-12-07 09:27:35 +000079def : PfmCountersBinding<"ivybridge", SandyBridgePfmCounters>;
Clement Courbetb4493792018-04-10 08:16:37 +000080
Clement Courbet41c8af32018-10-25 07:44:01 +000081def HaswellPfmCounters : ProcPfmCounters {
82 let CycleCounter = UnhaltedCoreCyclesPfmCounter;
83 let UopsCounter = UopsIssuedPfmCounter;
84 let IssueCounters = [
85 PfmIssueCounter<"HWPort0", "uops_dispatched_port:port_0">,
86 PfmIssueCounter<"HWPort1", "uops_dispatched_port:port_1">,
87 PfmIssueCounter<"HWPort2", "uops_dispatched_port:port_2">,
88 PfmIssueCounter<"HWPort3", "uops_dispatched_port:port_3">,
89 PfmIssueCounter<"HWPort4", "uops_dispatched_port:port_4">,
90 PfmIssueCounter<"HWPort5", "uops_dispatched_port:port_5">,
91 PfmIssueCounter<"HWPort6", "uops_dispatched_port:port_6">,
92 PfmIssueCounter<"HWPort7", "uops_dispatched_port:port_7">
93 ];
Clement Courbetb4493792018-04-10 08:16:37 +000094}
Clement Courbet41c8af32018-10-25 07:44:01 +000095def : PfmCountersBinding<"haswell", HaswellPfmCounters>;
Clement Courbetb4493792018-04-10 08:16:37 +000096
Clement Courbet41c8af32018-10-25 07:44:01 +000097def BroadwellPfmCounters : ProcPfmCounters {
98 let CycleCounter = UnhaltedCoreCyclesPfmCounter;
99 let UopsCounter = UopsIssuedPfmCounter;
100 let IssueCounters = [
101 PfmIssueCounter<"BWPort0", "uops_executed_port:port_0">,
102 PfmIssueCounter<"BWPort1", "uops_executed_port:port_1">,
103 PfmIssueCounter<"BWPort2", "uops_executed_port:port_2">,
104 PfmIssueCounter<"BWPort3", "uops_executed_port:port_3">,
105 PfmIssueCounter<"BWPort4", "uops_executed_port:port_4">,
106 PfmIssueCounter<"BWPort5", "uops_executed_port:port_5">,
107 PfmIssueCounter<"BWPort6", "uops_executed_port:port_6">,
108 PfmIssueCounter<"BWPort7", "uops_executed_port:port_7">
109 ];
Clement Courbetb4493792018-04-10 08:16:37 +0000110}
Clement Courbet41c8af32018-10-25 07:44:01 +0000111def : PfmCountersBinding<"broadwell", BroadwellPfmCounters>;
Clement Courbetb4493792018-04-10 08:16:37 +0000112
Clement Courbet41c8af32018-10-25 07:44:01 +0000113def SkylakeClientPfmCounters : ProcPfmCounters {
114 let CycleCounter = UnhaltedCoreCyclesPfmCounter;
115 let UopsCounter = UopsIssuedPfmCounter;
116 let IssueCounters = [
117 PfmIssueCounter<"SKLPort0", "uops_dispatched_port:port_0">,
118 PfmIssueCounter<"SKLPort1", "uops_dispatched_port:port_1">,
119 PfmIssueCounter<"SKLPort2", "uops_dispatched_port:port_2">,
120 PfmIssueCounter<"SKLPort3", "uops_dispatched_port:port_3">,
121 PfmIssueCounter<"SKLPort4", "uops_dispatched_port:port_4">,
122 PfmIssueCounter<"SKLPort5", "uops_dispatched_port:port_5">,
123 PfmIssueCounter<"SKLPort6", "uops_dispatched_port:port_6">,
124 PfmIssueCounter<"SKLPort7", "uops_dispatched_port:port_7">
125 ];
Clement Courbetb4493792018-04-10 08:16:37 +0000126}
Clement Courbet41c8af32018-10-25 07:44:01 +0000127def : PfmCountersBinding<"skylake", SkylakeClientPfmCounters>;
Simon Pilgrima90c2112018-05-24 14:54:32 +0000128
Clement Courbet41c8af32018-10-25 07:44:01 +0000129def SkylakeServerPfmCounters : ProcPfmCounters {
130 let CycleCounter = UnhaltedCoreCyclesPfmCounter;
131 let UopsCounter = UopsIssuedPfmCounter;
132 let IssueCounters = [
133 PfmIssueCounter<"SKXPort0", "uops_dispatched_port:port_0">,
134 PfmIssueCounter<"SKXPort1", "uops_dispatched_port:port_1">,
135 PfmIssueCounter<"SKXPort2", "uops_dispatched_port:port_2">,
136 PfmIssueCounter<"SKXPort3", "uops_dispatched_port:port_3">,
137 PfmIssueCounter<"SKXPort4", "uops_dispatched_port:port_4">,
138 PfmIssueCounter<"SKXPort5", "uops_dispatched_port:port_5">,
139 PfmIssueCounter<"SKXPort6", "uops_dispatched_port:port_6">,
140 PfmIssueCounter<"SKXPort7", "uops_dispatched_port:port_7">
141 ];
Simon Pilgrima90c2112018-05-24 14:54:32 +0000142}
Clement Courbet41c8af32018-10-25 07:44:01 +0000143def : PfmCountersBinding<"skylake-avx512", SkylakeServerPfmCounters>;
Simon Pilgrim6155b322018-12-07 17:48:40 +0000144def : PfmCountersBinding<"cascadelake", SkylakeServerPfmCounters>;
145def : PfmCountersBinding<"cannonlake", SkylakeServerPfmCounters>;
146def : PfmCountersBinding<"icelake-client", SkylakeServerPfmCounters>;
147def : PfmCountersBinding<"icelake-server", SkylakeServerPfmCounters>;
148
149// AMD X86 Counters.
150// Set basic counters for AMD cpus that we know libpfm4 supports.
151def DefaultAMDPfmCounters : ProcPfmCounters {
152 let CycleCounter = PfmCounter<"cpu_clk_unhalted">;
153 let UopsCounter = PfmCounter<"retired_uops">;
154}
155def : PfmCountersBinding<"athlon", DefaultAMDPfmCounters>;
156def : PfmCountersBinding<"athlon-tbird", DefaultAMDPfmCounters>;
157def : PfmCountersBinding<"athlon-4", DefaultAMDPfmCounters>;
158def : PfmCountersBinding<"athlon-xp", DefaultAMDPfmCounters>;
159def : PfmCountersBinding<"athlon-mp", DefaultAMDPfmCounters>;
160def : PfmCountersBinding<"k8", DefaultAMDPfmCounters>;
161def : PfmCountersBinding<"opteron", DefaultAMDPfmCounters>;
162def : PfmCountersBinding<"athlon64", DefaultAMDPfmCounters>;
163def : PfmCountersBinding<"athlon-fx", DefaultAMDPfmCounters>;
164def : PfmCountersBinding<"k8-sse3", DefaultAMDPfmCounters>;
165def : PfmCountersBinding<"opteron-sse3", DefaultAMDPfmCounters>;
166def : PfmCountersBinding<"athlon64-sse3", DefaultAMDPfmCounters>;
167def : PfmCountersBinding<"amdfam10", DefaultAMDPfmCounters>;
168def : PfmCountersBinding<"barcelona", DefaultAMDPfmCounters>;
Clement Courbet41c8af32018-10-25 07:44:01 +0000169
Roman Lebedeva5baf862018-10-27 20:46:30 +0000170def BdVer2PfmCounters : ProcPfmCounters {
171 let CycleCounter = PfmCounter<"cpu_clk_unhalted">;
172 let UopsCounter = PfmCounter<"retired_uops">;
173 let IssueCounters = [
174 PfmIssueCounter<"PdFPU0", "dispatched_fpu_ops:ops_pipe0 + dispatched_fpu_ops:ops_dual_pipe0">,
175 PfmIssueCounter<"PdFPU1", "dispatched_fpu_ops:ops_pipe1 + dispatched_fpu_ops:ops_dual_pipe1">,
176 PfmIssueCounter<"PdFPU2", "dispatched_fpu_ops:ops_pipe2 + dispatched_fpu_ops:ops_dual_pipe2">,
177 PfmIssueCounter<"PdFPU3", "dispatched_fpu_ops:ops_pipe3 + dispatched_fpu_ops:ops_dual_pipe3">
178 ];
179}
Simon Pilgrim6155b322018-12-07 17:48:40 +0000180def : PfmCountersBinding<"bdver1", BdVer2PfmCounters>;
Roman Lebedeva5baf862018-10-27 20:46:30 +0000181def : PfmCountersBinding<"bdver2", BdVer2PfmCounters>;
182
Simon Pilgrime9d82752018-12-09 13:45:15 +0000183def BdVer3PfmCounters : ProcPfmCounters {
184 let CycleCounter = PfmCounter<"cpu_clk_unhalted">;
185 let UopsCounter = PfmCounter<"retired_uops">;
186 let IssueCounters = [
187 PfmIssueCounter<"SrFPU0", "dispatched_fpu_ops:ops_pipe0 + dispatched_fpu_ops:ops_dual_pipe0">,
188 PfmIssueCounter<"SrFPU1", "dispatched_fpu_ops:ops_pipe1 + dispatched_fpu_ops:ops_dual_pipe1">,
189 PfmIssueCounter<"SrFPU2", "dispatched_fpu_ops:ops_pipe2 + dispatched_fpu_ops:ops_dual_pipe2">
190 ];
191}
192def : PfmCountersBinding<"bdver3", BdVer3PfmCounters>;
193def : PfmCountersBinding<"bdver4", BdVer3PfmCounters>;
194
195def BtVer1PfmCounters : ProcPfmCounters {
196 let CycleCounter = PfmCounter<"cpu_clk_unhalted">;
197 let UopsCounter = PfmCounter<"retired_uops">;
198 let IssueCounters = [
199 PfmIssueCounter<"BtFPU0", "dispatched_fpu:pipe0">,
200 PfmIssueCounter<"BtFPU1", "dispatched_fpu:pipe1">
201 ];
202}
203def : PfmCountersBinding<"btver1", BtVer1PfmCounters>;
204
Clement Courbet41c8af32018-10-25 07:44:01 +0000205def BtVer2PfmCounters : ProcPfmCounters {
206 let CycleCounter = PfmCounter<"cpu_clk_unhalted">;
207 let UopsCounter = PfmCounter<"retired_uops">;
208 let IssueCounters = [
209 PfmIssueCounter<"JFPU0", "dispatched_fpu:pipe0">,
210 PfmIssueCounter<"JFPU1", "dispatched_fpu:pipe1">
211 ];
212}
213def : PfmCountersBinding<"btver2", BtVer2PfmCounters>;
Simon Pilgrim6155b322018-12-07 17:48:40 +0000214
215def ZnVer1PfmCounters : ProcPfmCounters {
216 let CycleCounter = PfmCounter<"cycles_not_in_halt">;
217 let UopsCounter = PfmCounter<"retired_uops">;
218 let IssueCounters = [
219 PfmIssueCounter<"ZnFPU0", "fpu_pipe_assignment:total0">,
220 PfmIssueCounter<"ZnFPU1", "fpu_pipe_assignment:total1">,
221 PfmIssueCounter<"ZnFPU2", "fpu_pipe_assignment:total2">,
222 PfmIssueCounter<"ZnFPU3", "fpu_pipe_assignment:total3">,
223 PfmIssueCounter<"ZnDivider", "div_op_count">
224 ];
225}
226def : PfmCountersBinding<"znver1", ZnVer1PfmCounters>;