Clement Courbet | b449379 | 2018-04-10 08:16:37 +0000 | [diff] [blame] | 1 | //===-- 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 Courbet | 41c8af3 | 2018-10-25 07:44:01 +0000 | [diff] [blame] | 14 | def UnhaltedCoreCyclesPfmCounter : PfmCounter<"unhalted_core_cycles">; |
| 15 | def UopsIssuedPfmCounter : PfmCounter<"uops_issued:any">; |
Clement Courbet | b449379 | 2018-04-10 08:16:37 +0000 | [diff] [blame] | 16 | |
Clement Courbet | eee2e06 | 2018-11-09 13:15:32 +0000 | [diff] [blame] | 17 | // No default counters on X86. |
| 18 | def DefaultPfmCounters : ProcPfmCounters {} |
| 19 | def : PfmCountersDefaultBinding<DefaultPfmCounters>; |
| 20 | |
Simon Pilgrim | 6155b32 | 2018-12-07 17:48:40 +0000 | [diff] [blame] | 21 | // Intel X86 Counters. |
| 22 | def PentiumPfmCounters : ProcPfmCounters { |
| 23 | let CycleCounter = PfmCounter<"cpu_clk_unhalted">; |
| 24 | let UopsCounter = PfmCounter<"uops_retired">; |
| 25 | } |
| 26 | def : PfmCountersBinding<"pentiumpro", PentiumPfmCounters>; |
| 27 | def : PfmCountersBinding<"pentium2", PentiumPfmCounters>; |
| 28 | def : PfmCountersBinding<"pentium3", PentiumPfmCounters>; |
| 29 | def : PfmCountersBinding<"pentium3m", PentiumPfmCounters>; |
| 30 | def : PfmCountersBinding<"pentium-m", PentiumPfmCounters>; |
| 31 | |
| 32 | def CorePfmCounters : ProcPfmCounters { |
| 33 | let CycleCounter = UnhaltedCoreCyclesPfmCounter; |
| 34 | let UopsCounter = PfmCounter<"uops_retired:any">; |
| 35 | } |
| 36 | def : PfmCountersBinding<"yonah", CorePfmCounters>; |
| 37 | def : PfmCountersBinding<"prescott", CorePfmCounters>; |
| 38 | def : PfmCountersBinding<"core2", CorePfmCounters>; |
| 39 | def : PfmCountersBinding<"penryn", CorePfmCounters>; |
| 40 | def : PfmCountersBinding<"nehalem", CorePfmCounters>; |
| 41 | def : PfmCountersBinding<"corei7", CorePfmCounters>; |
| 42 | def : PfmCountersBinding<"westmere", CorePfmCounters>; |
| 43 | |
| 44 | def AtomPfmCounters : ProcPfmCounters { |
| 45 | let CycleCounter = UnhaltedCoreCyclesPfmCounter; |
| 46 | let UopsCounter = PfmCounter<"uops_retired:any">; |
| 47 | } |
| 48 | def : PfmCountersBinding<"bonnell", AtomPfmCounters>; |
| 49 | def : PfmCountersBinding<"atom", AtomPfmCounters>; |
| 50 | |
| 51 | def SLMPfmCounters : ProcPfmCounters { |
| 52 | let CycleCounter = UnhaltedCoreCyclesPfmCounter; |
| 53 | let UopsCounter = PfmCounter<"uops_retired:any">; |
| 54 | } |
| 55 | def : PfmCountersBinding<"silvermont", SLMPfmCounters>; |
| 56 | def : PfmCountersBinding<"goldmont", SLMPfmCounters>; |
| 57 | def : PfmCountersBinding<"goldmont-plus", SLMPfmCounters>; |
| 58 | def : PfmCountersBinding<"tremont", SLMPfmCounters>; |
| 59 | def : PfmCountersBinding<"knl", SLMPfmCounters>; |
| 60 | def : PfmCountersBinding<"knm", SLMPfmCounters>; |
| 61 | |
Clement Courbet | 41c8af3 | 2018-10-25 07:44:01 +0000 | [diff] [blame] | 62 | def 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 Courbet | b449379 | 2018-04-10 08:16:37 +0000 | [diff] [blame] | 72 | } |
Clement Courbet | 41c8af3 | 2018-10-25 07:44:01 +0000 | [diff] [blame] | 73 | def : PfmCountersBinding<"sandybridge", SandyBridgePfmCounters>; |
Simon Pilgrim | 9c7d85b | 2018-12-07 09:27:35 +0000 | [diff] [blame] | 74 | def : PfmCountersBinding<"ivybridge", SandyBridgePfmCounters>; |
Clement Courbet | b449379 | 2018-04-10 08:16:37 +0000 | [diff] [blame] | 75 | |
Clement Courbet | 41c8af3 | 2018-10-25 07:44:01 +0000 | [diff] [blame] | 76 | def 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 Courbet | b449379 | 2018-04-10 08:16:37 +0000 | [diff] [blame] | 89 | } |
Clement Courbet | 41c8af3 | 2018-10-25 07:44:01 +0000 | [diff] [blame] | 90 | def : PfmCountersBinding<"haswell", HaswellPfmCounters>; |
Clement Courbet | b449379 | 2018-04-10 08:16:37 +0000 | [diff] [blame] | 91 | |
Clement Courbet | 41c8af3 | 2018-10-25 07:44:01 +0000 | [diff] [blame] | 92 | def 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 Courbet | b449379 | 2018-04-10 08:16:37 +0000 | [diff] [blame] | 105 | } |
Clement Courbet | 41c8af3 | 2018-10-25 07:44:01 +0000 | [diff] [blame] | 106 | def : PfmCountersBinding<"broadwell", BroadwellPfmCounters>; |
Clement Courbet | b449379 | 2018-04-10 08:16:37 +0000 | [diff] [blame] | 107 | |
Clement Courbet | 41c8af3 | 2018-10-25 07:44:01 +0000 | [diff] [blame] | 108 | def 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 Courbet | b449379 | 2018-04-10 08:16:37 +0000 | [diff] [blame] | 121 | } |
Clement Courbet | 41c8af3 | 2018-10-25 07:44:01 +0000 | [diff] [blame] | 122 | def : PfmCountersBinding<"skylake", SkylakeClientPfmCounters>; |
Simon Pilgrim | a90c211 | 2018-05-24 14:54:32 +0000 | [diff] [blame] | 123 | |
Clement Courbet | 41c8af3 | 2018-10-25 07:44:01 +0000 | [diff] [blame] | 124 | def 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 Pilgrim | a90c211 | 2018-05-24 14:54:32 +0000 | [diff] [blame] | 137 | } |
Clement Courbet | 41c8af3 | 2018-10-25 07:44:01 +0000 | [diff] [blame] | 138 | def : PfmCountersBinding<"skylake-avx512", SkylakeServerPfmCounters>; |
Simon Pilgrim | 6155b32 | 2018-12-07 17:48:40 +0000 | [diff] [blame] | 139 | def : PfmCountersBinding<"cascadelake", SkylakeServerPfmCounters>; |
| 140 | def : PfmCountersBinding<"cannonlake", SkylakeServerPfmCounters>; |
| 141 | def : PfmCountersBinding<"icelake-client", SkylakeServerPfmCounters>; |
| 142 | def : PfmCountersBinding<"icelake-server", SkylakeServerPfmCounters>; |
| 143 | |
| 144 | // AMD X86 Counters. |
| 145 | // Set basic counters for AMD cpus that we know libpfm4 supports. |
| 146 | def DefaultAMDPfmCounters : ProcPfmCounters { |
| 147 | let CycleCounter = PfmCounter<"cpu_clk_unhalted">; |
| 148 | let UopsCounter = PfmCounter<"retired_uops">; |
| 149 | } |
| 150 | def : PfmCountersBinding<"athlon", DefaultAMDPfmCounters>; |
| 151 | def : PfmCountersBinding<"athlon-tbird", DefaultAMDPfmCounters>; |
| 152 | def : PfmCountersBinding<"athlon-4", DefaultAMDPfmCounters>; |
| 153 | def : PfmCountersBinding<"athlon-xp", DefaultAMDPfmCounters>; |
| 154 | def : PfmCountersBinding<"athlon-mp", DefaultAMDPfmCounters>; |
| 155 | def : PfmCountersBinding<"k8", DefaultAMDPfmCounters>; |
| 156 | def : PfmCountersBinding<"opteron", DefaultAMDPfmCounters>; |
| 157 | def : PfmCountersBinding<"athlon64", DefaultAMDPfmCounters>; |
| 158 | def : PfmCountersBinding<"athlon-fx", DefaultAMDPfmCounters>; |
| 159 | def : PfmCountersBinding<"k8-sse3", DefaultAMDPfmCounters>; |
| 160 | def : PfmCountersBinding<"opteron-sse3", DefaultAMDPfmCounters>; |
| 161 | def : PfmCountersBinding<"athlon64-sse3", DefaultAMDPfmCounters>; |
| 162 | def : PfmCountersBinding<"amdfam10", DefaultAMDPfmCounters>; |
| 163 | def : PfmCountersBinding<"barcelona", DefaultAMDPfmCounters>; |
| 164 | def : PfmCountersBinding<"btver1", DefaultAMDPfmCounters>; |
| 165 | def : PfmCountersBinding<"bdver3", DefaultAMDPfmCounters>; |
| 166 | def : PfmCountersBinding<"bdver4", DefaultAMDPfmCounters>; |
Clement Courbet | 41c8af3 | 2018-10-25 07:44:01 +0000 | [diff] [blame] | 167 | |
Roman Lebedev | a5baf86 | 2018-10-27 20:46:30 +0000 | [diff] [blame] | 168 | def 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 Pilgrim | 6155b32 | 2018-12-07 17:48:40 +0000 | [diff] [blame] | 178 | def : PfmCountersBinding<"bdver1", BdVer2PfmCounters>; |
Roman Lebedev | a5baf86 | 2018-10-27 20:46:30 +0000 | [diff] [blame] | 179 | def : PfmCountersBinding<"bdver2", BdVer2PfmCounters>; |
| 180 | |
Clement Courbet | 41c8af3 | 2018-10-25 07:44:01 +0000 | [diff] [blame] | 181 | def 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 | } |
| 189 | def : PfmCountersBinding<"btver2", BtVer2PfmCounters>; |
Simon Pilgrim | 6155b32 | 2018-12-07 17:48:40 +0000 | [diff] [blame] | 190 | |
| 191 | def 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 | } |
| 202 | def : PfmCountersBinding<"znver1", ZnVer1PfmCounters>; |