|
| 1 | +#!/usr/bin/env python3 |
| 2 | +# Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | +# |
| 4 | +# This source code is licensed under the MIT license found in the |
| 5 | +# LICENSE file in the root directory of this source tree. |
| 6 | + |
| 7 | +# pyre-unsafe |
| 8 | + |
| 9 | +"""AMD Zen3 (EPYC Milan) -- core PMU + memory bandwidth""" |
| 10 | + |
| 11 | +try: |
| 12 | + from cea.chips.benchpress.perfutils.amd_perf.core import register_arch |
| 13 | +except ModuleNotFoundError: # standalone / OSS: run from perfutils/ dir |
| 14 | + from amd_perf.core import register_arch |
| 15 | +try: |
| 16 | + from cea.chips.benchpress.perfutils.amd_perf.metrics import ( |
| 17 | + avg_mab_latency, |
| 18 | + backend_stalls, |
| 19 | + branch_mispred_rate, |
| 20 | + dtlb_mpki, |
| 21 | + frontend_stalls, |
| 22 | + frontend_stalls_due_to_ic_miss, |
| 23 | + ipc, |
| 24 | + itlb_mpki, |
| 25 | + l1_1g_dtlb_mpki, |
| 26 | + l1_2m_dtlb_mpki, |
| 27 | + l1_4k_dtlb_mpki, |
| 28 | + l1_dcache_miss_rate, |
| 29 | + l1_dcache_mpki, |
| 30 | + l1_icache_fills_l2_ratio, |
| 31 | + l1_icache_fills_sys_ratio, |
| 32 | + l1_icache_mab_demand_requests_rate, |
| 33 | + l1_icache_mab_prefetch_requests_rate, |
| 34 | + l1_icache_miss_rate, |
| 35 | + l1_icache_mpki, |
| 36 | + l2_1g_itlb_mpki, |
| 37 | + l2_2m_itlb_mpki, |
| 38 | + l2_4k_itlb_mpki, |
| 39 | + l2_code_miss_rate, |
| 40 | + l2_code_mpki, |
| 41 | + l2_data_miss_rate, |
| 42 | + l2_data_mpki, |
| 43 | + l2_dtlb_mpki, |
| 44 | + l2_itlb_mpki, |
| 45 | + llc_avg_load_to_use_lat_clks, |
| 46 | + llc_miss_rate, |
| 47 | + llc_mpki, |
| 48 | + mem_read_bw_MBps, |
| 49 | + mem_write_bw_MBps, |
| 50 | + mips, |
| 51 | + timestamp, |
| 52 | + uops_dispatched_decoder_per_instructions, |
| 53 | + uops_dispatched_opcache_per_instructions, |
| 54 | + uops_per_instructions, |
| 55 | + ) |
| 56 | +except ModuleNotFoundError: # standalone / OSS: run from perfutils/ dir |
| 57 | + from amd_perf.metrics import ( |
| 58 | + avg_mab_latency, |
| 59 | + backend_stalls, |
| 60 | + branch_mispred_rate, |
| 61 | + dtlb_mpki, |
| 62 | + frontend_stalls, |
| 63 | + frontend_stalls_due_to_ic_miss, |
| 64 | + ipc, |
| 65 | + itlb_mpki, |
| 66 | + l1_1g_dtlb_mpki, |
| 67 | + l1_2m_dtlb_mpki, |
| 68 | + l1_4k_dtlb_mpki, |
| 69 | + l1_dcache_miss_rate, |
| 70 | + l1_dcache_mpki, |
| 71 | + l1_icache_fills_l2_ratio, |
| 72 | + l1_icache_fills_sys_ratio, |
| 73 | + l1_icache_mab_demand_requests_rate, |
| 74 | + l1_icache_mab_prefetch_requests_rate, |
| 75 | + l1_icache_miss_rate, |
| 76 | + l1_icache_mpki, |
| 77 | + l2_1g_itlb_mpki, |
| 78 | + l2_2m_itlb_mpki, |
| 79 | + l2_4k_itlb_mpki, |
| 80 | + l2_code_miss_rate, |
| 81 | + l2_code_mpki, |
| 82 | + l2_data_miss_rate, |
| 83 | + l2_data_mpki, |
| 84 | + l2_dtlb_mpki, |
| 85 | + l2_itlb_mpki, |
| 86 | + llc_avg_load_to_use_lat_clks, |
| 87 | + llc_miss_rate, |
| 88 | + llc_mpki, |
| 89 | + mem_read_bw_MBps, |
| 90 | + mem_write_bw_MBps, |
| 91 | + mips, |
| 92 | + timestamp, |
| 93 | + uops_dispatched_decoder_per_instructions, |
| 94 | + uops_dispatched_opcache_per_instructions, |
| 95 | + uops_per_instructions, |
| 96 | + ) |
| 97 | + |
| 98 | + |
| 99 | +def metrics(grouped_df): |
| 100 | + metrics = [ |
| 101 | + timestamp(grouped_df), |
| 102 | + mips(grouped_df), |
| 103 | + ipc(grouped_df), |
| 104 | + uops_per_instructions(grouped_df), |
| 105 | + uops_dispatched_opcache_per_instructions(grouped_df), |
| 106 | + uops_dispatched_decoder_per_instructions(grouped_df), |
| 107 | + frontend_stalls(grouped_df), |
| 108 | + frontend_stalls_due_to_ic_miss(grouped_df), |
| 109 | + backend_stalls(grouped_df), |
| 110 | + branch_mispred_rate(grouped_df), |
| 111 | + avg_mab_latency(grouped_df), |
| 112 | + l1_icache_mab_demand_requests_rate(grouped_df), |
| 113 | + l1_icache_mab_prefetch_requests_rate(grouped_df), |
| 114 | + l1_icache_miss_rate(grouped_df), |
| 115 | + l1_icache_mpki(grouped_df), |
| 116 | + l1_icache_fills_l2_ratio(grouped_df), |
| 117 | + l1_icache_fills_sys_ratio(grouped_df), |
| 118 | + l1_dcache_miss_rate(grouped_df), |
| 119 | + l1_dcache_mpki(grouped_df), |
| 120 | + l2_code_miss_rate(grouped_df), |
| 121 | + l2_code_mpki(grouped_df), |
| 122 | + l2_data_miss_rate(grouped_df), |
| 123 | + l2_data_mpki(grouped_df), |
| 124 | + llc_miss_rate(grouped_df), |
| 125 | + llc_mpki(grouped_df), |
| 126 | + llc_avg_load_to_use_lat_clks(grouped_df), |
| 127 | + itlb_mpki(grouped_df), |
| 128 | + l2_itlb_mpki(grouped_df), |
| 129 | + l2_4k_itlb_mpki(grouped_df), |
| 130 | + l2_2m_itlb_mpki(grouped_df), |
| 131 | + l2_1g_itlb_mpki(grouped_df), |
| 132 | + dtlb_mpki(grouped_df), |
| 133 | + l1_4k_dtlb_mpki(grouped_df), |
| 134 | + l1_2m_dtlb_mpki(grouped_df), |
| 135 | + l1_1g_dtlb_mpki(grouped_df), |
| 136 | + l2_dtlb_mpki(grouped_df), |
| 137 | + ] |
| 138 | + metrics.append(mem_read_bw_MBps(grouped_df)) |
| 139 | + metrics.append(mem_write_bw_MBps(grouped_df)) |
| 140 | + return metrics |
| 141 | + |
| 142 | + |
| 143 | +register_arch( |
| 144 | + "zen3", |
| 145 | + metrics, |
| 146 | + vendor="amd", |
| 147 | + align="longest", |
| 148 | + description="Zen3 (EPYC Milan) -- core PMU + memory bandwidth", |
| 149 | +) |
0 commit comments