[PATCH v5 0/3]
v5 cover [PATCH v5 0/3]
This series of patches brings the PMU events for AMD family 17h series of processors up to date with the latest versions of the AMD processor programming reference manuals, all of which can be found at:
https://bugzilla.kernel.org/show_bug.cgi?id=206537
Change summary:
Patch 1: changes the pmu events mapfile to be more selective for the model number rather than blanket detecting all f17h processors to have the same events directory. This is required for the later patch where we add events for zen2 based processors.
Patch 2: adds the PMU events for zen2.
Patch 3: updates the zen1 PMU events to be in accordance with the latest PPR version and bumps up the events version to v2, mainly adding some events that were previously missing, and cleaning up some fpu counters.
Details of what changed between patch revisions is included within the commits.
Vijay Thakkar (3):
perf vendor events amd: restrict model detection for zen1 based
processors
perf vendor events amd: add Zen2 events
perf vendor events amd: update Zen1 events to V2
.../pmu-events/arch/x86/amdfam17h/branch.json | 12 -
.../pmu-events/arch/x86/amdfam17h/cache.json | 329 -----------------
.../pmu-events/arch/x86/amdfam17h/other.json | 65 ----
.../pmu-events/arch/x86/amdzen1/branch.json | 23 ++
.../pmu-events/arch/x86/amdzen1/cache.json | 294 +++++++++++++++
.../arch/x86/{amdfam17h => amdzen1}/core.json | 15 +-
.../floating-point.json | 64 +++-
.../x86/{amdfam17h => amdzen1}/memory.json | 82 +++--
.../pmu-events/arch/x86/amdzen1/other.json | 56 +++
.../pmu-events/arch/x86/amdzen2/branch.json | 52 +++
.../pmu-events/arch/x86/amdzen2/cache.json | 338 +++++++++++++++++
.../pmu-events/arch/x86/amdzen2/core.json | 130 +++++++
.../arch/x86/amdzen2/floating-point.json | 112 ++++++
.../pmu-events/arch/x86/amdzen2/memory.json | 341 ++++++++++++++++++
.../pmu-events/arch/x86/amdzen2/other.json | 115 ++++++
tools/perf/pmu-events/arch/x86/mapfile.csv | 3 +-
16 files changed, 1578 insertions(+), 453 deletions(-)
delete mode 100644 tools/perf/pmu-events/arch/x86/amdfam17h/branch.json
delete mode 100644 tools/perf/pmu-events/arch/x86/amdfam17h/cache.json
delete mode 100644 tools/perf/pmu-events/arch/x86/amdfam17h/other.json
create mode 100644 tools/perf/pmu-events/arch/x86/amdzen1/branch.json
create mode 100644 tools/perf/pmu-events/arch/x86/amdzen1/cache.json
rename tools/perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/core.json (87%)
rename tools/perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/floating-point.json (61%)
rename tools/perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/memory.json (63%)
create mode 100644 tools/perf/pmu-events/arch/x86/amdzen1/other.json
create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/branch.json
create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/cache.json
create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/core.json
create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/floating-point.json
create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/memory.json
create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/other.jsonSignature · 1 line
2.25.1
PATCH v5 1/3 perf vendor events amd: restrict model detection for zen1 based processors
This patch changes the previous blanket detection of AMD Family 17h processors to be more specific to Zen1 core based products only by replacing model detection regex pattern [[:xdigit:]]+ with ([12][0-9A-F]|[0-9A-F]), restricting to models 0 though 2f only.
This change is required to allow for the addition of separate PMU events for Zen2 core based models in the following patches as those belong to family 17h but have different PMCs. Current PMU events directory has also been renamed to "amdzen1" from "amdfam17h" to reflect this specificity.
Note that although this change does not break PMU counters for existing zen1 based systems, it does disable the current set of counters for zen2 based systems. Counters for zen2 have been added in the following patches in this patchset.
---
Changes in v2:
- Change Zen1 model detection regex to include all models in range 0 through 2F inclusive.
.../perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/branch.json | 0
.../perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/cache.json | 0
tools/perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/core.json | 0
.../arch/x86/{amdfam17h => amdzen1}/floating-point.json | 0
.../perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/memory.json | 0
.../perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/other.json | 0
tools/perf/pmu-events/arch/x86/mapfile.csv | 2 +-
7 files changed, 1 insertion(+), 1 deletion(-)
rename tools/perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/branch.json (100%)
rename tools/perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/cache.json (100%)
rename tools/perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/core.json (100%)
rename tools/perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/floating-point.json (100%)
rename tools/perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/memory.json (100%)
rename tools/perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/other.json (100%)tools/perf/pmu-events/arch/x86/amdzen1/branch.json renamed from tools/perf/pmu-events/arch/x86/amdfam17h/branch.json +0 -0
tools/perf/pmu-events/arch/x86/amdzen1/cache.json renamed from tools/perf/pmu-events/arch/x86/amdfam17h/cache.json +0 -0
tools/perf/pmu-events/arch/x86/amdzen1/core.json renamed from tools/perf/pmu-events/arch/x86/amdfam17h/core.json +0 -0
tools/perf/pmu-events/arch/x86/amdzen1/floating-point.json renamed from tools/perf/pmu-events/arch/x86/amdfam17h/floating-point.json +0 -0
tools/perf/pmu-events/arch/x86/amdzen1/memory.json renamed from tools/perf/pmu-events/arch/x86/amdfam17h/memory.json +0 -0
tools/perf/pmu-events/arch/x86/amdzen1/other.json renamed from tools/perf/pmu-events/arch/x86/amdfam17h/other.json +0 -0
tools/perf/pmu-events/arch/x86/mapfile.csv +1 -1
@@ -36,4 +36,4 @@ GenuineIntel-6-55-[56789ABCDEF],v1,cascadelakex,core GenuineIntel-6-7D,v1,icelake,core GenuineIntel-6-7E,v1,icelake,core GenuineIntel-6-86,v1,tremontx,core -AuthenticAMD-23-[[:xdigit:]]+,v1,amdfam17h,core +AuthenticAMD-23-([12][0-9A-F]|[0-9A-F]),v1,amdzen1,core
Signature · 1 line
2.25.1
Re: [PATCH v5 1/3] perf vendor events amd: restrict model detection for zen1 based processors
Quoted 10 lines · Vijay Thakkar
This patch changes the previous blanket detection of AMD Family 17h processors to be more specific to Zen1 core based products only by replacing model detection regex pattern [[:xdigit:]]+ with ([12][0-9A-F]|[0-9A-F]), restricting to models 0 though 2f only.
This change is required to allow for the addition of separate PMU events for Zen2 core based models in the following patches as those belong to family 17h but have different PMCs. Current PMU events directory has also been renamed to "amdzen1" from "amdfam17h" to reflect this specificity.
Quoted 6 lines
Note that although this change does not break PMU counters for existing zen1 based systems, it does disable the current set of counters for zen2 based systems. Counters for zen2 have been added in the following patches in this patchset.
Signed-off-by Vijay Thakkar <[email protected]>
For the series:
Thanks,
Kim
PATCH v5 2/3 perf vendor events amd: add Zen2 events
In reply to Vijay ThakkarThis patch adds PMU events for AMD Zen2 core based processors, namely, Matisse (model 71h), Castle Peak (model 31h) and Rome (model 2xh), as documented in the AMD Processor Programming Reference for Matisse [1]. The model number regex has been set to detect all the models under family 17 that do not match those of Zen1, as the range is larger for zen2.
Zen2 adds some additional counters that are not present in Zen1 and events for them have been added in this patch. Some counters have also been removed for Zen2 thatwere previously present in Zen1 and have been confirmed to always sample zero on zen2. These added/removed counters have been omitted for brevity but can be found here:
https://gist.github.com/thakkarV/5b12ca5fd7488eb2c42e451e40bdd5f3
Note that PPR for Zen2 [1] does not include some counters that were documented in the PPR for Zen1 based processors [2]. After having tested these counters, some of them that still work for zen2 systems have been preserved in the events for zen2. The counters that are omitted in [1] but are still measurable and non-zero on zen2 (tested on a Ryzen 3900X system) are the following:
PMC 0x000 fpu_pipe_assignment.{total|total0|total1|total2|total3} PMC 0x004 fp_num_mov_elim_scal_op.*
PMC 0x046 ls_tablewalker.*
PMC 0x062 l2_latency.l2_cycles_waiting_on_fills
PMC 0x063 l2_wcb_req.*
PMC 0x06D l2_fill_pending.l2_fill_busy
PMC 0x080 ic_fw32
PMC 0x081 ic_fw32_miss
PMC 0x086 bp_snp_re_sync
PMC 0x087 ic_fetch_stall.*
PMC 0x08C ic_cache_inval.*
PMC 0x099 bp_tlb_rel
PMC 0x0C7 ex_ret_brn_resync
PMC 0x28A ic_oc_mode_switch.*
L3PMC 0x001 l3_request_g1.*
L3PMC 0x006 l3_comb_clstr_state.*
[1]: Processor Programming Reference (PPR) for AMD Family 17h Model 71h, Revision B0 Processors, 56176 Rev 3.06 - Jul 17, 2019
[2]: Processor Programming Reference (PPR) for AMD Family 17h Models 01h,08h, Revision B2 Processors, 54945 Rev 3.03 - Jun 14, 2019 All of the PPRs can be found at:
https://bugzilla.kernel.org/show_bug.cgi?id=206537
---
Changes in v2:
- Correct UMask for ls_mab_alloc.loads
Changes in v3:
- branch: update BriefDescriptions of event to match the latest AMD PPR
- cache: update BriefDescriptions and remove redundant PublicDescriptions. Add missing UMasks for counters 70h, 71h and 72h.
- floating_point: update descriptions to latest PPR
- memory: update descriptions.
- other: update descriptions. change umask for PMC0xAF to be up to date with PPR 56176 Rev 3.06
Changes in v4:
- PMC 0x46: Add I and D side tablewalker allocation breakdown by type 0 and 1 based on Zen 1 PPR 54945 Rev 3.03
- clean up numerous event descriptions
Changes in v5:
- Minor cleanup for a description
.../pmu-events/arch/x86/amdzen2/branch.json | 52 +++ .../pmu-events/arch/x86/amdzen2/cache.json | 338 +++++++++++++++++ .../pmu-events/arch/x86/amdzen2/core.json | 130 +++++++ .../arch/x86/amdzen2/floating-point.json | 112 ++++++ .../pmu-events/arch/x86/amdzen2/memory.json | 341 ++++++++++++++++++ .../pmu-events/arch/x86/amdzen2/other.json | 115 ++++++ tools/perf/pmu-events/arch/x86/mapfile.csv | 1 + 7 files changed, 1089 insertions(+) create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/branch.json create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/cache.json create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/core.json create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/floating-point.json create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/memory.json create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/other.json
tools/perf/pmu-events/arch/x86/amdzen2/branch.json new file +52 -0
@@ -0,0 +1,52 @@ +[ + { + "EventName": "bp_l1_btb_correct", + "EventCode": "0x8a", + "BriefDescription": "L1 Branch Prediction Overrides Existing Prediction (speculative)." + }, + { + "EventName": "bp_l2_btb_correct", + "EventCode": "0x8b", + "BriefDescription": "L2 Branch Prediction Overrides Existing Prediction (speculative)." + }, + { + "EventName": "bp_dyn_ind_pred", + "EventCode": "0x8e", + "BriefDescription": "Dynamic Indirect Predictions.", + "PublicDescription": "Indirect Branch Prediction for potential multi-target branch (speculative)." + }, + { + "EventName": "bp_de_redirect", + "EventCode": "0x91", + "BriefDescription": "Decoder Overrides Existing Branch Prediction (speculative)." + }, + { + "EventName": "bp_l1_tlb_fetch_hit", + "EventCode": "0x94", + "BriefDescription": "The number of instruction fetches that hit in the L1 ITLB.", + "UMask": "0xFF" + }, + { + "EventName": "bp_l1_tlb_fetch_hit.if1g", + "EventCode": "0x94", + "BriefDescription": "The number of instruction fetches that hit in the L1 ITLB. Instruction fetches to a 1GB page.", + "UMask": "0x4" + }, + { + "EventName": "bp_l1_tlb_fetch_hit.if2m", + "EventCode": "0x94", + "BriefDescription": "The number of instruction fetches that hit in the L1 ITLB. Instruction fetches to a 2MB page.", + "UMask": "0x2" + }, + { + "EventName": "bp_l1_tlb_fetch_hit.if4k", + "EventCode": "0x94", + "BriefDescription": "The number of instruction fetches that hit in the L1 ITLB. Instruction fetches to a 4KB page.", + "UMask": "0x1" + }, + { + "EventName": "bp_tlb_rel", + "EventCode": "0x99", + "BriefDescription": "The number of ITLB reload requests." + } +]
tools/perf/pmu-events/arch/x86/amdzen2/cache.json new file +338 -0
338 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/amdzen2/core.json new file +130 -0
130 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/amdzen2/floating-point.json new file +112 -0
112 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/amdzen2/memory.json new file +341 -0
341 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/amdzen2/other.json new file +115 -0
115 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/mapfile.csv +1 -0
@@ -37,3 +37,4 @@ GenuineIntel-6-7D,v1,icelake,core GenuineIntel-6-7E,v1,icelake,core GenuineIntel-6-86,v1,tremontx,core AuthenticAMD-23-([12][0-9A-F]|[0-9A-F]),v1,amdzen1,core +AuthenticAMD-23-[[:xdigit:]]+,v1,amdzen2,core
Signature · 1 line
2.25.1
Re: [PATCH v5 2/3] perf vendor events amd: add Zen2 events
Em Mon, Mar 16, 2020 at 06:52:37PM -0400, Vijay Thakkar escreveu:
Quoted 14 lines
This patch adds PMU events for AMD Zen2 core based processors, namely, Matisse (model 71h), Castle Peak (model 31h) and Rome (model 2xh), as documented in the AMD Processor Programming Reference for Matisse [1]. The model number regex has been set to detect all the models under family 17 that do not match those of Zen1, as the range is larger for zen2.
Zen2 adds some additional counters that are not present in Zen1 and events for them have been added in this patch. Some counters have also been removed for Zen2 thatwere previously present in Zen1 and have been confirmed to always sample zero on zen2. These added/removed counters have been omitted for brevity but can be found here:
https://gist.github.com/thakkarV/5b12ca5fd7488eb2c42e451e40bdd5f3
Quoted 8 lines
Note that PPR for Zen2 [1] does not include some counters that were documented in the PPR for Zen1 based processors [2]. After having tested these counters, some of them that still work for zen2 systems have been preserved in the events for zen2. The counters that are omitted in [1] but are still measurable and non-zero on zen2 (tested on a Ryzen 3900X system) are the following:
PMC
0x000fpu_pipe_assignment.{total|total0|total1|total2|total3}
So trying to test this a bit, can you take a look at the examples below? I.e. it would be really nice to have at least some of these examples tested programatically.
So, picking this one:
"EventName": "fpu_pipe_assignment.total", "EventCode": "0x00", "BriefDescription": "Total number of fp uOps.", "PublicDescription":
"Total number of fp uOps. The number of operations (uOps) dispatched to each of the 4 FPU execution pipelines. This event reflects how busy the FPU pipelines are and may be used for workload characterization. This includes all operations performed by x87, MMX, and SSE instructions, including moves. Each increment represents a one- cycle dispatch event. This event is a speculative event. Since this event includes non-numeric operations it is not suitable for measuring MFLOPS.",
Committer testing:
On a AMD Ryzen 5 3600X 6-Core Processor, model 113 (0x71):
Before:
[root@five ~]# perf list *fpu_pipe_assignment*
List of pre-defined events (to be used in -e):
[root@five ~]#
After:
[root@five ~]# perf list *fpu_pipe_assignment*
List of pre-defined events (to be used in -e):
floating point:
fpu_pipe_assignment.total
[Total number of fp uOps]
Metric Groups:
[root@five ~]#
Using it:
[root@five ~]# perf stat -I1000 -e fpu_pipe_assignment.total
# time counts unit events
1.000781022 71,830,536 fpu_pipe_assignment.total
2.001835955 69,017,141 fpu_pipe_assignment.total
3.002498539 79,561,420 fpu_pipe_assignment.total
4.002922910 79,834,539 fpu_pipe_assignment.total
5.003545481 76,197,236 fpu_pipe_assignment.total ^C 5.288876179 36,038,036 fpu_pipe_assignment.total
[root@five ~]#
[root@five ~]# perf stat -e fpu_pipe_assignment.total sleep 1
Performance counter stats for 'sleep 1':
396,722 fpu_pipe_assignment.total
1.000777226 seconds time elapsed
0.000712000 seconds user
0.000000000 seconds sys[root@five ~]#
[root@five ~]# perf record -e fpu_pipe_assignment.total sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.020 MB perf.data (7 samples) ] [root@five ~]# perf report --stdio --no-header
# To display the perf.data header info, please use --header/--header-only options. #
#
# Total Lost Samples: 0
#
# Samples: 7 of event 'fpu_pipe_assignment.total'
# Event count (approx.): 120733
#
# Overhead Command Shared Object Symbol
# ........ ....... ................ ..........................
#
96.44% sleep ld-2.30.so [.] _dl_map_object_deps
3.44% sleep [kernel.vmlinux] [k] __do_munmap
0.12% sleep [kernel.vmlinux] [k] kfree
0.00% sleep [kernel.vmlinux] [k] perf_event_mmap_output
0.00% sleep [kernel.vmlinux] [k] kmem_cache_alloc_trace
0.00% sleep [kernel.vmlinux] [k] prepend_name
0.00% sleep [kernel.vmlinux] [k] shift_arg_pages #
# (Tip: If you have debuginfo enabled, try: perf report -s sym,srcline) #
[root@five ~]#
[root@five ~]# perf annotate --stdio2 kfree | egrep '^ {0,2}[0-9]+' -B5 -A5
mov 0x8(%rbp),%rax
lea -0x1(%rax),%rdx
test $0x1,%al
cmovne %rdx,%rbp
mov 0x8(%rbp),%rdx
100.00 lea -0x1(%rdx),%rax
and $0x1,%edx
cmove %rbp,%rax
mov (%rax),%rax
test $0x2,%ah
↓ je 1bc
[root@five ~]#
[root@five ~]# perf annotate --stdio2 _dl_map_object_deps | egrep '^ {0,2}[0-9]+' -B5 -A5
cmp $0xfffffffffffffffd,%rax
↑ jbe 559
c7b: xor %ecx,%ecx
↑ jmpq 56f
c82: mov %r10,-0x4c0(%rbp)
100.00 mov -0x4b8(%rbp),%r14
movl $0x1,-0x4dc(%rbp)
↑ jmpq 13b
c9f: mov -0x4b8(%rbp),%rax
cmp %rax,_rtld_global
↑ jne 7a0
[root@five ~]#These look reassuring:
[root@five ~]# perf record -e fpu_pipe_assignment.total -a sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.351 MB perf.data (2112 samples) ] [root@five ~]# perf report --stdio --no-header | head -30
# To display the perf.data header info, please use --header/--header-only options. #
#
# Total Lost Samples: 0
#
# Samples: 2K of event 'fpu_pipe_assignment.total'
# Event count (approx.): 1408125294
#
# Overhead Command Shared Object Symbol
# ........ ............... ............................ .............................................
#
10.24% Compositor libxul.so [.] 0x00000000041bf629
5.90% Compositor libxul.so [.] 0x00000000041bf63c
5.15% DecodingThread libxul.so [.] vp9_variance_and_sad_16x16_sse2
2.87% Compositor libxul.so [.] 0x00000000041c421b
2.56% Compositor libxul.so [.] 0x00000000041bf611
2.30% Compositor libc-2.30.so [.] __memmove_avx_unaligned_erms
1.39% Compositor libxul.so [.] 0x00000000041bf307
1.21% Compositor libxul.so [.] 0x0000000003b485de
1.09% Compositor libxul.so [.] 0x0000000003b4a9b0
1.02% Compositor libxul.so [.] 0x00000000041bf2f9
0.98% DecodingThread libxul.so [.] vp8_variance_and_sad_16x16_sse2
0.97% Compositor libxul.so [.] 0x00000000041c41cf
0.81% Compositor libxul.so [.] 0x00000000041c41bc
0.79% Compositor libxul.so [.] 0x00000000041bf2cd
0.73% Compositor libxul.so [.] 0x00000000041bf2de
0.72% Compositor libxul.so [.] 0x00000000041c4225
0.70% Compositor [kernel.vmlinux] [k] clear_page_rep
0.69% Compositor libxul.so [.] 0x00000000041bf2d2
0.68% Compositor libxul.so [.] 0x0000000003b48524[root@five ~]#
[root@five ~]# perf annotate --stdio2 vp9_variance_and_sad_16x16_sse2 | egrep '^ {0,2}[0-9]+' -B2 -A2
movdqa %xmm1,%xmm5
pavgb %xmm3,%xmm5
2.15 psubusb %xmm1,%xmm4
psubusb %xmm0,%xmm1
psubusb %xmm3,%xmm6
--
movdqa (%rsp),%xmm2
pxor %xmm1,%xmm1
0.74 movdqa %xmm2,%xmm7
psubusb %xmm4,%xmm2
0.99 psubusb %xmm6,%xmm7
pcmpeqb %xmm1,%xmm2
2.29 pcmpeqb %xmm1,%xmm7
por %xmm2,%xmm7
14.96 neg %rax
movdqu (%rsi,%rax,2),%xmm1
movdqu (%rsi,%rax,1),%xmm3
--
pavgb %xmm3,%xmm1
psubusb %xmm2,%xmm6
2.70 psubusb %xmm0,%xmm2
psubusb %xmm3,%xmm4
psubusb %xmm0,%xmm3
--
movdqa (%rsp),%xmm2
pxor %xmm1,%xmm1
1.68 movdqa %xmm2,%xmm3
psubusb %xmm6,%xmm2
0.92 psubusb %xmm4,%xmm3
pcmpeqb %xmm1,%xmm2
pcmpeqb %xmm1,%xmm3
1.84 por %xmm2,%xmm7
5.95 por %xmm3,%xmm7
2.93 pavgb %xmm0,%xmm5
pand %xmm7,%xmm0
10.03 pandn %xmm5,%xmm7
0.96 paddusb %xmm7,%xmm0
movdqu %xmm0,(%rdi)
2.60 neg %rax
add $0x10,%rsi
add $0x10,%rdi
add $0x10,%rdx
cmp -0x28(%rbp),%edx
1.20 ↓ jge b67
movdqu (%rbx),%xmm2
movdqu %xmm2,(%rsp)
add $0x10,%rbx
2.50 ↑ jmpq a78
b67: sub %rdx,%rsi
sub %rdx,%rdi
--
punpcklbw %mm1,%mm1
punpcklwd %mm1,%mm1
1.14 punpckldq %mm1,%mm1
mov $0xfffffffffffffff8,%rdx
movq %mm1,(%rdi,%rdx,1)
movslq -0x28(%rbp),%rdx
movq -0x1(%rdi,%rdx,1),%mm1
2.16 punpcklbw %mm1,%mm1
punpcklwd %mm1,%mm1
punpckldq %mm1,%mm1
--
bb6: movdqu (%rdi,%rdx,1),%xmm0
movdqu -0x2(%rdi,%rdx,1),%xmm1
0.60 movdqu -0x1(%rdi,%rdx,1),%xmm3
movdqa %xmm0,%xmm4
movdqa %xmm0,%xmm6
--
movdqa %xmm2,%xmm7
psubusb %xmm4,%xmm2
1.19 psubusb %xmm6,%xmm7
2.37 pcmpeqb %xmm1,%xmm2
pcmpeqb %xmm1,%xmm7
por %xmm2,%xmm7
4.40 movdqu 0x1(%rdi,%rdx,1),%xmm1
movdqu 0x2(%rdi,%rdx,1),%xmm3
movdqa %xmm0,%xmm6
movdqa %xmm0,%xmm4
3.07 movdqa %xmm1,%xmm2
pavgb %xmm3,%xmm1
psubusb %xmm2,%xmm6
psubusb %xmm0,%xmm2
2.05 psubusb %xmm3,%xmm4
psubusb %xmm0,%xmm3
paddusb %xmm2,%xmm6
paddusb %xmm3,%xmm4
1.98 pavgb %xmm1,%xmm5
movdqa (%rsp),%xmm2
pxor %xmm1,%xmm1
movdqa %xmm2,%xmm3
1.94 psubusb %xmm6,%xmm2
psubusb %xmm4,%xmm3
pcmpeqb %xmm1,%xmm2
pcmpeqb %xmm1,%xmm3
2.42 por %xmm2,%xmm7
1.49 por %xmm3,%xmm7
1.78 pavgb %xmm0,%xmm5
pand %xmm7,%xmm0
2.89 pandn %xmm5,%xmm7
3.24 paddusb %xmm7,%xmm0
movq %mm0,-0x10(%rdi,%rdx,1)
movq %mm1,-0x8(%rdi,%rdx,1)
movdq2q %xmm0,%mm0
6.83 psrldq $0x8,%xmm0
1.97 movdq2q %xmm0,%mm1
4.03 add $0x10,%rdx
cmp -0x28(%rbp),%edx
↓ jge caf
[root@five ~]#Re: [PATCH v5 2/3] perf vendor events amd: add Zen2 events
Quoted 7 lines
floating point:
fpu_pipe_assignment.total
[Total number of fp uOps]Metric Groups:
I just realized that I did not add back the counters for per pipe total assignment as I said in the commit message. Patch 3/3 adds the total uOp assignments per pipe for Zen1 based processors. Although the PPR for Matisse does not list these counters, I can still sample them on my Ryzen 3900X system and they seem to report correct numbers. For example, here is the result of running:
$> perf stat -e r100,r200,r400,r800,rf00 ls
$> Performance counter stats for 'ls':
5,047 r100:u
5,236 r200:u
31,300 r400:u
2,040 r800:u
43,623 fpu_pipe_assignment.total:uNote that the per pipe total counters add up the overall total, which makes me think I should submit a v6 of this patch adding the per pipe totals for zen2 as well, especially since it is mentioned in the commit message.
-Vijay
Re: [PATCH v5 2/3] perf vendor events amd: add Zen2 events
Em Wed, Mar 18, 2020 at 11:21:12AM -0400, Vijay Thakkar escreveu:
Quoted 25 lines
Quoted 7 lines
floating point:
fpu_pipe_assignment.total
[Total number of fp uOps]Metric Groups:
I just realized that I did not add back the counters for per pipe total assignment as I said in the commit message. Patch 3/3 adds the total uOp assignments per pipe for Zen1 based processors. Although the PPR for Matisse does not list these counters, I can still sample them on my Ryzen 3900X system and they seem to report correct numbers. For example, here is the result of running:
$> perf stat -e r100,r200,r400,r800,rf00 ls
$> Performance counter stats for 'ls':
5,047 r100:u 5,236 r200:u 31,300 r400:u 2,040 r800:u 43,623 fpu_pipe_assignment.total:u
Quoted 4 lines
Note that the per pipe total counters add up the overall total, which makes me think I should submit a v6 of this patch adding the per pipe totals for zen2 as well, especially since it is mentioned in the commit message.
Ok, so I'll remove these patches, please redo that sequence I did in the commit log, ok?
- Arnaldo
Re: [PATCH v5 2/3] perf vendor events amd: add Zen2 events
Okay, should be updated now in the v6 series. Sorry for the last minute change, and thanks for your patience.
-Vijay
PATCH v5 3/3 perf vendor events amd: update Zen1 events to V2
In reply to Vijay ThakkarThis patch updates the PMCs for AMD Zen1 core based processors (Family 17h; Models 0 through 2F) to be in accordance with PMCs as documented in the latest versions of the AMD Processor Programming Reference [1], [2] and [3]. Note that some events, such as FPU pipe assignment are missing in [1], and therefore [3] is included for full coverage of events.
PMCs added:
fpu_pipe_assignment.dual{0|1|2|3}
fpu_pipe_assignment.total{0|1|2|3}
ls_mab_alloc.dc_prefetcher
ls_mab_alloc.stores
ls_mab_alloc.loadsbp_dyn_ind_predbp_de_redirect
PMC removed:ex_ret_cond_misp
Cumulative counts, fpu_pipe_assignment.total and fpu_pipe_assignment.dual, existed in v1, but did expose port-level counters.
ex_ret_cond_misp has been removed as it has been removed from the latest versions of the PPR, and when tested, always seems to sample zero as tested on a Ryzen 3400G system.
[1]: Processor Programming Reference (PPR) for AMD Family 17h Models 01h,08h, Revision B2 Processors, 54945 Rev 3.03 - Jun 14, 2019.
[2]: Processor Programming Reference (PPR) for AMD Family 17h Model 18h, Revision B1 Processors, 55570-B1 Rev 3.14 - Sep 26, 2019.
[3]: OSRR for AMD Family 17h processors, Models 00h-2Fh, 56255 Rev 3.03 - July, 2018 All of the PPRs can be found at:
https://bugzilla.kernel.org/show_bug.cgi?id=206537
---
Changes in v2:
- Correct the UMasks for fpu_pipe_assignment.dual* by left shifting all by 4 bits.
- Correct UMask for ls_mab_alloc.loads
- add bp_dyn_ind_pred (PMC0x08E)
- add bp_de_redirect (PMC0x091)
Changes in v3:
- Correct the pipe numbers for fpu_pipe_assignment counters
- Correct ls_mab_alloc.* public descriptions
Changes in v4:
- PMC 0x46 add missing subcounters for types 0 and 1 of tablewalker allocation
- PMC 0x60 and 0x61: add missing detail on brief descriptions
- change descriptions of many of the events to bring them in-line with improvements made in patch 2/3. These were for counters that did not change between zen1 to zen2. Patch reviews for zen2 lead these descriptions to be changed and improved, and many of these have been carried here in this version of patch 3.
.../pmu-events/arch/x86/amdzen1/branch.json | 11 ++ .../pmu-events/arch/x86/amdzen1/cache.json | 107 ++++++------------ .../pmu-events/arch/x86/amdzen1/core.json | 15 +-- .../arch/x86/amdzen1/floating-point.json | 64 ++++++++++- .../pmu-events/arch/x86/amdzen1/memory.json | 82 +++++++++----- .../pmu-events/arch/x86/amdzen1/other.json | 27 ++--- tools/perf/pmu-events/arch/x86/mapfile.csv | 2 +- 7 files changed, 172 insertions(+), 136 deletions(-)
tools/perf/pmu-events/arch/x86/amdzen1/branch.json +11 -0
@@ -8,5 +8,16 @@ "EventName": "bp_l2_btb_correct", "EventCode": "0x8b", "BriefDescription": "L2 BTB Correction." + }, + { + "EventName": "bp_dyn_ind_pred", + "EventCode": "0x8e", + "BriefDescription": "Dynamic Indirect Predictions.", + "PublicDescription": "Indirect Branch Prediction for potential multi-target branch (speculative)." + }, + { + "EventName": "bp_de_redirect", + "EventCode": "0x91", + "BriefDescription": "Decoder Overrides Existing Branch Prediction (speculative)." } ]
tools/perf/pmu-events/arch/x86/amdzen1/cache.json +36 -71
283 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/amdzen1/core.json +3 -12
@@ -62,7 +62,6 @@ "EventName": "ex_ret_brn_ind_misp", "EventCode": "0xca", "BriefDescription": "Retired Indirect Branch Instructions Mispredicted.", - "PublicDescription": "Retired Indirect Branch Instructions Mispredicted." }, { "EventName": "ex_ret_mmx_fp_instr.sse_instr",
@@ -90,11 +89,6 @@ "EventCode": "0xd1", "BriefDescription": "Retired Conditional Branch Instructions." }, - { - "EventName": "ex_ret_cond_misp", - "EventCode": "0xd2", - "BriefDescription": "Retired Conditional Branch Instructions Mispredicted." - }, { "EventName": "ex_div_busy", "EventCode": "0xd3",
@@ -108,22 +102,19 @@ { "EventName": "ex_tagged_ibs_ops.ibs_count_rollover", "EventCode": "0x1cf", - "BriefDescription": "Number of times an op could not be tagged by IBS because of a previous tagged op that has not retired.", - "PublicDescription": "Tagged IBS Ops. Number of times an op could not be tagged by IBS because of a previous tagged op that has not retired.", + "BriefDescription": "Tagged IBS Ops. Number of times an op could not be tagged by IBS because of a previous tagged op that has not retired.", "UMask": "0x4" }, { "EventName": "ex_tagged_ibs_ops.ibs_tagged_ops_ret", "EventCode": "0x1cf", - "BriefDescription": "Number of Ops tagged by IBS that retired.", - "PublicDescription": "Tagged IBS Ops. Number of Ops tagged by IBS that retired.", + "BriefDescription": "Tagged IBS Ops. Number of Ops tagged by IBS that retired.", "UMask": "0x2" }, { "EventName": "ex_tagged_ibs_ops.ibs_tagged_ops", "EventCode": "0x1cf", - "BriefDescription": "Number of Ops tagged by IBS.", - "PublicDescription": "Tagged IBS Ops. Number of Ops tagged by IBS.", + "BriefDescription": "Tagged IBS Ops. Number of Ops tagged by IBS.", "UMask": "0x1" }, {
tools/perf/pmu-events/arch/x86/amdzen1/floating-point.json +60 -4
77 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/amdzen1/memory.json +52 -30
198 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/amdzen1/other.json +9 -18
@@ -2,64 +2,55 @@ { "EventName": "ic_oc_mode_switch.oc_ic_mode_switch", "EventCode": "0x28a", - "BriefDescription": "OC to IC mode switch.", - "PublicDescription": "OC Mode Switch. OC to IC mode switch.", + "BriefDescription": "OC Mode Switch. OC to IC mode switch.", "UMask": "0x2" }, { "EventName": "ic_oc_mode_switch.ic_oc_mode_switch", "EventCode": "0x28a", - "BriefDescription": "IC to OC mode switch.", - "PublicDescription": "OC Mode Switch. IC to OC mode switch.", + "BriefDescription": "OC Mode Switch. IC to OC mode switch.", "UMask": "0x1" }, { "EventName": "de_dis_dispatch_token_stalls0.retire_token_stall", "EventCode": "0xaf", - "BriefDescription": "RETIRE Tokens unavailable.", - "PublicDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall. RETIRE Tokens unavailable.", + "BriefDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall. RETIRE Tokens unavailable.", "UMask": "0x40" }, { "EventName": "de_dis_dispatch_token_stalls0.agsq_token_stall", "EventCode": "0xaf", - "BriefDescription": "AGSQ Tokens unavailable.", - "PublicDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall. AGSQ Tokens unavailable.", + "BriefDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall. AGSQ Tokens unavailable.", "UMask": "0x20" }, { "EventName": "de_dis_dispatch_token_stalls0.alu_token_stall", "EventCode": "0xaf", - "BriefDescription": "ALU tokens total unavailable.", - "PublicDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall. ALU tokens total unavailable.", + "BriefDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall. ALU tokens total unavailable.", "UMask": "0x10" }, { "EventName": "de_dis_dispatch_token_stalls0.alsq3_0_token_stall", "EventCode": "0xaf", - "BriefDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall.", - "PublicDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall.", + "BriefDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall. ALSQ 3_0 Tokens unavailable.", "UMask": "0x8" }, { "EventName": "de_dis_dispatch_token_stalls0.alsq3_token_stall", "EventCode": "0xaf", - "BriefDescription": "ALSQ 3 Tokens unavailable.", - "PublicDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall. ALSQ 3 Tokens unavailable.", + "BriefDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall. ALSQ 3 Tokens unavailable.", "UMask": "0x4" }, { "EventName": "de_dis_dispatch_token_stalls0.alsq2_token_stall", "EventCode": "0xaf", - "BriefDescription": "ALSQ 2 Tokens unavailable.", - "PublicDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall. ALSQ 2 Tokens unavailable.", + "BriefDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall. ALSQ 2 Tokens unavailable.", "UMask": "0x2" }, { "EventName": "de_dis_dispatch_token_stalls0.alsq1_token_stall", "EventCode": "0xaf", - "BriefDescription": "ALSQ 1 Tokens unavailable.", - "PublicDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall. ALSQ 1 Tokens unavailable.", + "BriefDescription": "Cycles where a dispatch group is valid but does not get dispatched due to a token stall. ALSQ 1 Tokens unavailable.", "UMask": "0x1" } ]
tools/perf/pmu-events/arch/x86/mapfile.csv +1 -1
@@ -36,5 +36,5 @@ GenuineIntel-6-55-[56789ABCDEF],v1,cascadelakex,core GenuineIntel-6-7D,v1,icelake,core GenuineIntel-6-7E,v1,icelake,core GenuineIntel-6-86,v1,tremontx,core -AuthenticAMD-23-([12][0-9A-F]|[0-9A-F]),v1,amdzen1,core +AuthenticAMD-23-([12][0-9A-F]|[0-9A-F]),v2,amdzen1,core AuthenticAMD-23-[[:xdigit:]]+,v1,amdzen2,core
Signature · 1 line
2.25.1