blob: f38933a36f207a6c684dcf6182cdd4fcdc852a56 [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>;
59def : PfmCountersBinding<"knl", SLMPfmCounters>;
60def : PfmCountersBinding<"knm", SLMPfmCounters>;
61
Clement Courbet41c8af32018-10-25 07:44:01 +000062def SandyBridgePfmCounters : ProcPfmCounters {
63 let CycleCounter = UnhaltedCoreCyclesPfmCounter;
64 let UopsCounter = UopsIssuedPfmCounter;
65 let IssueCounters = [
66 PfmIssueCounter<"SBPort0", "uops_dispatched_port:port_0">,
67 PfmIssueCounter<"SBPort1", "uops_dispatched_port:port_1">,
68 PfmIssueCounter<"SBPort23", "uops_dispatched_port:port_2 + uops_dispatched_port:port_3">,
69 PfmIssueCounter<"SBPort4", "uops_dispatched_port:port_4">,
70 PfmIssueCounter<"SBPort5", "uops_dispatched_port:port_5">
71 ];
Clement Courbetb4493792018-04-10 08:16:37 +000072}
Clement Courbet41c8af32018-10-25 07:44:01 +000073def : PfmCountersBinding<"sandybridge", SandyBridgePfmCounters>;
Simon Pilgrim9c7d85b2018-12-07 09:27:35 +000074def : PfmCountersBinding<"ivybridge", SandyBridgePfmCounters>;
Clement Courbetb4493792018-04-10 08:16:37 +000075
Clement Courbet41c8af32018-10-25 07:44:01 +000076def HaswellPfmCounters : ProcPfmCounters {
77 let CycleCounter = UnhaltedCoreCyclesPfmCounter;
78 let UopsCounter = UopsIssuedPfmCounter;
79 let IssueCounters = [
80 PfmIssueCounter<"HWPort0", "uops_dispatched_port:port_0">,
81 PfmIssueCounter<"HWPort1", "uops_dispatched_port:port_1">,
82 PfmIssueCounter<"HWPort2", "uops_dispatched_port:port_2">,
83 PfmIssueCounter<"HWPort3", "uops_dispatched_port:port_3">,
84 PfmIssueCounter<"HWPort4", "uops_dispatched_port:port_4">,
85 PfmIssueCounter<"HWPort5", "uops_dispatched_port:port_5">,
86 PfmIssueCounter<"HWPort6", "uops_dispatched_port:port_6">,
87 PfmIssueCounter<"HWPort7", "uops_dispatched_port:port_7">
88 ];
Clement Courbetb4493792018-04-10 08:16:37 +000089}
Clement Courbet41c8af32018-10-25 07:44:01 +000090def : PfmCountersBinding<"haswell", HaswellPfmCounters>;
Clement Courbetb4493792018-04-10 08:16:37 +000091
Clement Courbet41c8af32018-10-25 07:44:01 +000092def BroadwellPfmCounters : ProcPfmCounters {
93 let CycleCounter = UnhaltedCoreCyclesPfmCounter;
94 let UopsCounter = UopsIssuedPfmCounter;
95 let IssueCounters = [
96 PfmIssueCounter<"BWPort0", "uops_executed_port:port_0">,
97 PfmIssueCounter<"BWPort1", "uops_executed_port:port_1">,
98 PfmIssueCounter<"BWPort2", "uops_executed_port:port_2">,
99 PfmIssueCounter<"BWPort3", "uops_executed_port:port_3">,
100 PfmIssueCounter<"BWPort4", "uops_executed_port:port_4">,
101 PfmIssueCounter<"BWPort5", "uops_executed_port:port_5">,
102 PfmIssueCounter<"BWPort6", "uops_executed_port:port_6">,
103 PfmIssueCounter<"BWPort7", "uops_executed_port:port_7">
104 ];
Clement Courbetb4493792018-04-10 08:16:37 +0000105}
Clement Courbet41c8af32018-10-25 07:44:01 +0000106def : PfmCountersBinding<"broadwell", BroadwellPfmCounters>;
Clement Courbetb4493792018-04-10 08:16:37 +0000107
Clement Courbet41c8af32018-10-25 07:44:01 +0000108def SkylakeClientPfmCounters : ProcPfmCounters {
109 let CycleCounter = UnhaltedCoreCyclesPfmCounter;
110 let UopsCounter = UopsIssuedPfmCounter;
111 let IssueCounters = [
112 PfmIssueCounter<"SKLPort0", "uops_dispatched_port:port_0">,
113 PfmIssueCounter<"SKLPort1", "uops_dispatched_port:port_1">,
114 PfmIssueCounter<"SKLPort2", "uops_dispatched_port:port_2">,
115 PfmIssueCounter<"SKLPort3", "uops_dispatched_port:port_3">,
116 PfmIssueCounter<"SKLPort4", "uops_dispatched_port:port_4">,
117 PfmIssueCounter<"SKLPort5", "uops_dispatched_port:port_5">,
118 PfmIssueCounter<"SKLPort6", "uops_dispatched_port:port_6">,
119 PfmIssueCounter<"SKLPort7", "uops_dispatched_port:port_7">
120 ];
Clement Courbetb4493792018-04-10 08:16:37 +0000121}
Clement Courbet41c8af32018-10-25 07:44:01 +0000122def : PfmCountersBinding<"skylake", SkylakeClientPfmCounters>;
Simon Pilgrima90c2112018-05-24 14:54:32 +0000123
Clement Courbet41c8af32018-10-25 07:44:01 +0000124def SkylakeServerPfmCounters : ProcPfmCounters {
125 let CycleCounter = UnhaltedCoreCyclesPfmCounter;
126 let UopsCounter = UopsIssuedPfmCounter;
127 let IssueCounters = [
128 PfmIssueCounter<"SKXPort0", "uops_dispatched_port:port_0">,
129 PfmIssueCounter<"SKXPort1", "uops_dispatched_port:port_1">,
130 PfmIssueCounter<"SKXPort2", "uops_dispatched_port:port_2">,
131 PfmIssueCounter<"SKXPort3", "uops_dispatched_port:port_3">,
132 PfmIssueCounter<"SKXPort4", "uops_dispatched_port:port_4">,
133 PfmIssueCounter<"SKXPort5", "uops_dispatched_port:port_5">,
134 PfmIssueCounter<"SKXPort6", "uops_dispatched_port:port_6">,
135 PfmIssueCounter<"SKXPort7", "uops_dispatched_port:port_7">
136 ];
Simon Pilgrima90c2112018-05-24 14:54:32 +0000137}
Clement Courbet41c8af32018-10-25 07:44:01 +0000138def : PfmCountersBinding<"skylake-avx512", SkylakeServerPfmCounters>;
Simon Pilgrim6155b322018-12-07 17:48:40 +0000139def : PfmCountersBinding<"cascadelake", SkylakeServerPfmCounters>;
140def : PfmCountersBinding<"cannonlake", SkylakeServerPfmCounters>;
141def : PfmCountersBinding<"icelake-client", SkylakeServerPfmCounters>;
142def : PfmCountersBinding<"icelake-server", SkylakeServerPfmCounters>;
143
144// AMD X86 Counters.
145// Set basic counters for AMD cpus that we know libpfm4 supports.
146def DefaultAMDPfmCounters : ProcPfmCounters {
147 let CycleCounter = PfmCounter<"cpu_clk_unhalted">;
148 let UopsCounter = PfmCounter<"retired_uops">;
149}
150def : PfmCountersBinding<"athlon", DefaultAMDPfmCounters>;
151def : PfmCountersBinding<"athlon-tbird", DefaultAMDPfmCounters>;
152def : PfmCountersBinding<"athlon-4", DefaultAMDPfmCounters>;
153def : PfmCountersBinding<"athlon-xp", DefaultAMDPfmCounters>;
154def : PfmCountersBinding<"athlon-mp", DefaultAMDPfmCounters>;
155def : PfmCountersBinding<"k8", DefaultAMDPfmCounters>;
156def : PfmCountersBinding<"opteron", DefaultAMDPfmCounters>;
157def : PfmCountersBinding<"athlon64", DefaultAMDPfmCounters>;
158def : PfmCountersBinding<"athlon-fx", DefaultAMDPfmCounters>;
159def : PfmCountersBinding<"k8-sse3", DefaultAMDPfmCounters>;
160def : PfmCountersBinding<"opteron-sse3", DefaultAMDPfmCounters>;
161def : PfmCountersBinding<"athlon64-sse3", DefaultAMDPfmCounters>;
162def : PfmCountersBinding<"amdfam10", DefaultAMDPfmCounters>;
163def : PfmCountersBinding<"barcelona", DefaultAMDPfmCounters>;
164def : PfmCountersBinding<"btver1", DefaultAMDPfmCounters>;
165def : PfmCountersBinding<"bdver3", DefaultAMDPfmCounters>;
166def : PfmCountersBinding<"bdver4", DefaultAMDPfmCounters>;
Clement Courbet41c8af32018-10-25 07:44:01 +0000167
Roman Lebedeva5baf862018-10-27 20:46:30 +0000168def BdVer2PfmCounters : ProcPfmCounters {
169 let CycleCounter = PfmCounter<"cpu_clk_unhalted">;
170 let UopsCounter = PfmCounter<"retired_uops">;
171 let IssueCounters = [
172 PfmIssueCounter<"PdFPU0", "dispatched_fpu_ops:ops_pipe0 + dispatched_fpu_ops:ops_dual_pipe0">,
173 PfmIssueCounter<"PdFPU1", "dispatched_fpu_ops:ops_pipe1 + dispatched_fpu_ops:ops_dual_pipe1">,
174 PfmIssueCounter<"PdFPU2", "dispatched_fpu_ops:ops_pipe2 + dispatched_fpu_ops:ops_dual_pipe2">,
175 PfmIssueCounter<"PdFPU3", "dispatched_fpu_ops:ops_pipe3 + dispatched_fpu_ops:ops_dual_pipe3">
176 ];
177}
Simon Pilgrim6155b322018-12-07 17:48:40 +0000178def : PfmCountersBinding<"bdver1", BdVer2PfmCounters>;
Roman Lebedeva5baf862018-10-27 20:46:30 +0000179def : PfmCountersBinding<"bdver2", BdVer2PfmCounters>;
180
Clement Courbet41c8af32018-10-25 07:44:01 +0000181def BtVer2PfmCounters : ProcPfmCounters {
182 let CycleCounter = PfmCounter<"cpu_clk_unhalted">;
183 let UopsCounter = PfmCounter<"retired_uops">;
184 let IssueCounters = [
185 PfmIssueCounter<"JFPU0", "dispatched_fpu:pipe0">,
186 PfmIssueCounter<"JFPU1", "dispatched_fpu:pipe1">
187 ];
188}
189def : PfmCountersBinding<"btver2", BtVer2PfmCounters>;
Simon Pilgrim6155b322018-12-07 17:48:40 +0000190
191def ZnVer1PfmCounters : ProcPfmCounters {
192 let CycleCounter = PfmCounter<"cycles_not_in_halt">;
193 let UopsCounter = PfmCounter<"retired_uops">;
194 let IssueCounters = [
195 PfmIssueCounter<"ZnFPU0", "fpu_pipe_assignment:total0">,
196 PfmIssueCounter<"ZnFPU1", "fpu_pipe_assignment:total1">,
197 PfmIssueCounter<"ZnFPU2", "fpu_pipe_assignment:total2">,
198 PfmIssueCounter<"ZnFPU3", "fpu_pipe_assignment:total3">,
199 PfmIssueCounter<"ZnDivider", "div_op_count">
200 ];
201}
202def : PfmCountersBinding<"znver1", ZnVer1PfmCounters>;