From eff72206b8d4516f30ca5c8a9a25ed47b1f986ab Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Fri, 6 Dec 2024 15:34:03 -0800 Subject: [PATCH] Update converter script to handle TMA 5.01 Update for new column headers and the renaming of bottleneck metrics. --- scripts/create_perf_json.py | 48 ++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/scripts/create_perf_json.py b/scripts/create_perf_json.py index 8e9f790..9809db7 100755 --- a/scripts/create_perf_json.py +++ b/scripts/create_perf_json.py @@ -327,7 +327,6 @@ def get(key: str) -> str: if self.umask: self.umask = self.umask.split(",")[0] umask_ext = get('UMaskExt') - # Unset UMaskExt if PortMask or FCMask are set. For future platforms # PortMask and FCMask won't be present and only UMaskExt will be available. if umask_ext and int(umask_ext, 16): @@ -1011,7 +1010,7 @@ def extract_tma_metrics(self, csvfile: TextIO, pmu_prefix: str, saved_formulas: list[Dict[str, str]]): """Process a TMA metrics spreadsheet generating perf metrics.""" - ratio_column = { + ratio_column4 = { "IVT": ("IVT", "IVB", "JKT/SNB-EP", "SNB"), "IVB": ("IVB", "SNB", ), "HSW": ("HSW", "IVB", "SNB", ), @@ -1043,6 +1042,36 @@ def extract_tma_metrics(self, csvfile: TextIO, pmu_prefix: str, 'SKL/KBL', 'BDW', 'HSW', 'IVB', 'SNB'), "CMT": ("CMT","GRT"), } + ratio_column = { + 'LNL/ARL': 'LNL/ARL;MTL;ADL/RPL;TGL;RKL;ICL;KBLR/CFL/CML;SKL/KBL;BDW;HSW;IVB;SNB'.split(';'), + 'GNR': 'GNR;MTL;SPR-HBM;SPR/EMR;ADL/RPL;TGL;RKL;ICX;ICL;CPX;CLX;KBLR/CFL/CML;SKX;SKL/KBL;BDX;BDW;HSX;HSW;IVT;IVB;JKT/SNB-EP;SNB'.split(';'), + 'MTL': 'MTL;ADL/RPL;TGL;RKL;ICL;KBLR/CFL/CML;SKL/KBL;BDW;HSW;IVB;SNB'.split(';'), + 'SPR/EMR': 'SPR/EMR;ADL/RPL;TGL;RKL;ICX;ICL;CPX;CLX;KBLR/CFL/CML;SKX;SKL/KBL;BDX;BDW;HSX;HSW;IVT;IVB;JKT/SNB-EP;SNB'.split(';'), + 'ADL/RPL': 'ADL/RPL;TGL;RKL;ICL;KBLR/CFL/CML;SKL/KBL;BDW;HSW;IVB;SNB'.split(';'), + 'TGL': 'TGL;RKL;ICL;KBLR/CFL/CML;SKL/KBL;BDW;HSW;IVB;SNB'.split(';'), + 'RKL': 'RKL;ICL;KBLR/CFL/CML;SKL/KBL;BDW;HSW;IVB;SNB'.split(';'), + 'ICX': 'ICX;ICL;CPX;CLX;KBLR/CFL/CML;SKX;SKL/KBL;BDX;BDW;HSX;HSW;IVT;IVB;JKT/SNB-EP;SNB'.split(';'), + 'ICL': 'ICL;KBLR/CFL/CML;SKL/KBL;BDW;HSW;IVB;SNB'.split(';'), + 'CPX': 'CPX;CLX;KBLR/CFL/CML;SKX;SKL/KBL;BDX;BDW;HSX;HSW;IVT;IVB;JKT/SNB-EP;SNB'.split(';'), + 'CLX': 'CLX;KBLR/CFL/CML;SKX;SKL/KBL;BDX;BDW;HSX;HSW;IVT;IVB;JKT/SNB-EP;SNB'.split(';'), + 'KBLR/CFL/CML': 'KBLR/CFL/CML;SKL/KBL;BDW;HSW;IVB;SNB'.split(';'), + 'SKX': 'SKX;SKL/KBL;BDX;BDW;HSX;HSW;IVT;IVB;JKT/SNB-EP;SNB'.split(';'), + 'SKL/KBL': 'SKL/KBL;BDW;HSW;IVB;SNB'.split(';'), + 'BDX': 'BDX;BDW;HSX;HSW;IVT;IVB;JKT/SNB-EP;SNB'.split(';'), + 'BDW': 'BDW;HSW;IVB;SNB'.split(';'), + 'HSX': 'HSX;HSW;IVT;IVB;JKT/SNB-EP;SNB'.split(';'), + 'HSW': 'HSW;IVB;SNB'.split(';'), + 'IVT': 'IVT;IVB;JKT/SNB-EP;SNB'.split(';'), + 'IVB': 'IVB;SNB'.split(';'), + 'JKT/SNB-EP': 'JKT/SNB-EP;SNB'.split(';'), + 'SNB': 'SNB'.split(';'), + "GRT": ["GRT",], + "CMT": ["CMT", "GRT"], + 'LNL-SKT': ['LNL-SKT', 'CMT', 'GRT'], + 'ARL-SKT': ['ARL-SKT', 'LNL-SKT', 'CMT', 'GRT'], + } + if csvfile.readline().startswith('TMA,Version,4.7-full'): + ratio_column = ratio_column4 tma_cpu = None if self.shortname == 'BDW-DE': tma_cpu = 'BDW' @@ -1050,7 +1079,7 @@ def extract_tma_metrics(self, csvfile: TextIO, pmu_prefix: str, tma_cpu = 'GRT' else: for key in ratio_column.keys(): - if self.shortname in key: + if self.shortname in key.split('/'): tma_cpu = key break if not tma_cpu: @@ -1104,14 +1133,19 @@ class PerfMetric: if tma_cpu not in col_heading: if tma_cpu == 'ADL/RPL' and 'GRT' in col_heading: tma_cpu = 'GRT' - if tma_cpu == 'MTL' and 'CMT' in col_heading: + elif tma_cpu == 'MTL' and 'CMT' in col_heading: tma_cpu = 'CMT' + elif self.shortname == 'LNL' and 'LNL-SKT' in col_heading: + tma_cpu = 'LNL-SKT' + elif self.shortname == 'ARL' and 'ARL-SKT' in col_heading: + tma_cpu = 'ARL-SKT' _verboseprint3(f'Columns: {col_heading}. Levels: {levels}') elif not found_key: continue def field(x: str) -> str: """Given the name of a column, return the value in the current line of it.""" + assert x in col_heading, f"Expected {x} in {col_heading}" return l[col_heading[x]].strip() def find_form() -> Optional[str]: @@ -1247,7 +1281,8 @@ def is_topdown_row(key: str) -> bool: )) infoname[metric_name] = form tma_metric_names[metric_name] = tma_metric_name - elif l[0].startswith('Info'): + _verboseprint3(f'Found topdown formula {tma_metric_name} on CPU {self.shortname} -> {form}') + elif l[0].startswith('Info') or l[0].startswith('Bottleneck'): metric_name = field('Level1') form = find_form() if metric_name == 'CORE_CLKS': @@ -1287,11 +1322,12 @@ def is_topdown_row(key: str) -> bool: )) infoname[metric_name] = form tma_metric_names[metric_name] = tma_metric_name + _verboseprint3(f'Found info formula {tma_metric_name} on CPU {self.shortname} -> {form}') elif l[0].startswith('Aux'): form = find_form() if form and form != '#NA': aux_name = field('Level1') - assert aux_name.startswith('#') or aux_name == 'Num_CPUs' + assert aux_name.startswith('#') or aux_name == 'Num_CPUs' or aux_name == 'Dependent_Loads_Weight' aux[aux_name] = form _verboseprint3(f'Adding aux {aux_name}: {form}')