From bd22355b964443c37daefa7c12b184d909bee4ca Mon Sep 17 00:00:00 2001 From: colramos-amd Date: Wed, 31 Jan 2024 18:25:37 -0600 Subject: [PATCH] Add numPipes built-in-var for updated metrics Co-authored-by: Nick Curtis Signed-off-by: colramos-amd [ROCm/rocprofiler-compute commit: d16f58b797059186b7a18d9295488b3db7b81d29] --- .../src/omniperf_soc/soc_gfx906.py | 1 + .../src/omniperf_soc/soc_gfx908.py | 1 + .../src/omniperf_soc/soc_gfx90a.py | 1 + .../rocprofiler-compute/src/utils/parser.py | 28 +++++++++------ .../rocprofiler-compute/src/utils/schema.py | 34 +++++++++---------- .../rocprofiler-compute/src/utils/specs.py | 5 +++ .../rocprofiler-compute/src/utils/utils.py | 3 +- 7 files changed, 44 insertions(+), 29 deletions(-) diff --git a/projects/rocprofiler-compute/src/omniperf_soc/soc_gfx906.py b/projects/rocprofiler-compute/src/omniperf_soc/soc_gfx906.py index e49edf35ef..048397425d 100644 --- a/projects/rocprofiler-compute/src/omniperf_soc/soc_gfx906.py +++ b/projects/rocprofiler-compute/src/omniperf_soc/soc_gfx906.py @@ -31,6 +31,7 @@ SOC_PARAM = { "numSE": 4, "numCU": 60, "numSIMD": 240, + "numPipes": 4, "numWavesPerCU": 40, "numSQC": 15, "L2Banks": 16, diff --git a/projects/rocprofiler-compute/src/omniperf_soc/soc_gfx908.py b/projects/rocprofiler-compute/src/omniperf_soc/soc_gfx908.py index 36ad5678b6..d7da55c76c 100644 --- a/projects/rocprofiler-compute/src/omniperf_soc/soc_gfx908.py +++ b/projects/rocprofiler-compute/src/omniperf_soc/soc_gfx908.py @@ -31,6 +31,7 @@ SOC_PARAM = { "numSE": 8, "numCU": 120, "numSIMD": 480, + "numPipes": 4, "numWavesPerCU": 40, "numSQC": 30, "L2Banks": 32, diff --git a/projects/rocprofiler-compute/src/omniperf_soc/soc_gfx90a.py b/projects/rocprofiler-compute/src/omniperf_soc/soc_gfx90a.py index 25631513f5..ea13d9e667 100644 --- a/projects/rocprofiler-compute/src/omniperf_soc/soc_gfx90a.py +++ b/projects/rocprofiler-compute/src/omniperf_soc/soc_gfx90a.py @@ -33,6 +33,7 @@ SOC_PARAM = { "numSE": 8, "numCU": 110, "numSIMD": 440, + "numPipes": 4, "numWavesPerCU": 32, "numSQC": 56, "L2Banks": 32, diff --git a/projects/rocprofiler-compute/src/utils/parser.py b/projects/rocprofiler-compute/src/utils/parser.py index 528ac87c6b..43e47b3431 100644 --- a/projects/rocprofiler-compute/src/utils/parser.py +++ b/projects/rocprofiler-compute/src/utils/parser.py @@ -116,6 +116,11 @@ def to_min(*args): def to_max(*args): if len(args) == 1 and isinstance(args[0], pd.core.series.Series): return args[0].max() + elif len(args) == 2 and ( + isinstance(args[0], pd.core.series.Series) + or isinstance(args[1], pd.core.series.Series) + ): + return np.maximum(args[0], args[1]) elif max(args) == None: return np.nan else: @@ -303,7 +308,7 @@ def build_eval_string(equation, coll_level): def update_denom_string(equation, unit): """ - Update $denom in equation with runtime nomorlization unit. + Update $denom in equation with runtime normalization unit. """ if not equation: return "" @@ -318,7 +323,7 @@ def update_denom_string(equation, unit): def update_normUnit_string(equation, unit): """ - Update $normUnit in equation with runtime nomorlization unit. + Update $normUnit in equation with runtime normalization unit. It is string replacement for display only. """ @@ -327,8 +332,8 @@ def update_normUnit_string(equation, unit): return "" return re.sub( - "\((?P\w*)\s+\+\s+(\$normUnit\))", - "\g " + re.sub("_", " ", unit), + r"\((?P\w*)\s+\+\s+(\$normUnit\))", + r"\g " + re.sub("_", " ", unit), str(equation), ).capitalize() @@ -690,9 +695,10 @@ def eval_metric(dfs, dfs_type, sys_info, soc_spec, raw_pmc_df, debug): # NB: # Following with Omniperf 0.2.0, we are using HW spec from sys_info instead. # The soc_spec is not in using right now, but can be used to do verification - # aganist sys_info, forced theoretical evaluation, or supporting tool-chains + # against sys_info, forced theoretical evaluation, or supporting tool-chains # broken. ammolite__numSE = sys_info.numSE + ammolite__numPipes = sys_info.numPipes ammolite__numCU = sys_info.numCU ammolite__numSIMD = sys_info.numSIMD ammolite__numWavesPerCU = sys_info.maxWavesPerCU # todo: check do we still need it @@ -739,7 +745,7 @@ def eval_metric(dfs, dfs_type, sys_info, soc_spec, raw_pmc_df, debug): print("~" * 40 + "\nExpression:") print(expr, "=", row[expr]) print("Inputs:") - matched_vars = re.findall("ammolite__\w+", row[expr]) + matched_vars = re.findall(r"ammolite__\w+", row[expr]) if matched_vars: for v in matched_vars: print( @@ -749,12 +755,12 @@ def eval_metric(dfs, dfs_type, sys_info, soc_spec, raw_pmc_df, debug): eval(compile(v, "", "eval")), ) matched_cols = re.findall( - "raw_pmc_df\['\w+'\]\['\w+'\]", row[expr] + r"raw_pmc_df\['\w+'\]\['\w+'\]", row[expr] ) if matched_cols: for c in matched_cols: m = re.match( - "raw_pmc_df\['(\w+)'\]\['(\w+)'\]", c + r"raw_pmc_df\['(\w+)'\]\['(\w+)'\]", c ) t = raw_pmc_df[m.group(1)][ m.group(2) @@ -778,7 +784,7 @@ def eval_metric(dfs, dfs_type, sys_info, soc_spec, raw_pmc_df, debug): print("~" * 40) except TypeError: print( - "skiping entry. Encounterd a missing counter" + "skipping entry. Encounterd a missing counter" ) print(expr, " has been assigned to None") print(np.nan) @@ -788,7 +794,7 @@ def eval_metric(dfs, dfs_type, sys_info, soc_spec, raw_pmc_df, debug): == "'NoneType' object has no attribute 'get'" ): print( - "skiping entry. Encounterd a missing csv" + "skipping entry. Encounterd a missing csv" ) print(np.nan) else: @@ -894,7 +900,7 @@ def apply_filters(workload, dir, is_gui, debug): print("{} is an invalid dispatch id.".format(d)) sys.exit(1) if ">" in workload.filter_dispatch_ids[0]: - m = re.match("\> (\d+)", workload.filter_dispatch_ids[0]) + m = re.match(r"\> (\d+)", workload.filter_dispatch_ids[0]) ret_df = ret_df[ ret_df[schema.pmc_perf_file_prefix]["Dispatch_ID"] > int(m.group(1)) ] diff --git a/projects/rocprofiler-compute/src/utils/schema.py b/projects/rocprofiler-compute/src/utils/schema.py index 5c404304b6..aa652ca33b 100644 --- a/projects/rocprofiler-compute/src/utils/schema.py +++ b/projects/rocprofiler-compute/src/utils/schema.py @@ -79,7 +79,7 @@ supported_field = [ "Min", "Max", "Avg", - "PoP", + "Pct of Peak", "Peak", "Count", "Mean", @@ -92,22 +92,22 @@ supported_field = [ "Channel", "L2 Cache Hit Rate", "Requests", - "L1-L2 Read", - "L1-L2 Write", - "L1-L2 Atomic", - "L2-EA Read", - "L2-EA Write", - "L2-EA Atomic", - "L2-EA Read Latency", - "L2-EA Write Latency", - "L2-EA Atomic Latency", - "L2-EA Read Stall - IO", - "L2-EA Read Stall - GMI", - "L2-EA Read Stall - DRAM", - "L2-EA Write Stall - IO", - "L2-EA Write Stall - GMI", - "L2-EA Write Stall - DRAM", - "L2-EA Write Stall - Starve", + "L2 Read Req", + "L2 Write Req", + "L2 Atomic Req", + "L2 - Fabric Read Req", + "L2 - Fabric Write and Atomic Req", + "L2 - Fabric Atomic Req", + "L2 - Fabric Read Latency", + "L2 - Fabric Write Latency", + "L2 - Fabric Atomic Latency", + "L2 - Fabric Read Stall (PCIe)", + "L2 - Fabric Read Stall (Infinity Fabricâ„¢)", + "L2 - Fabric Read Stall (HBM)", + "L2 - Fabric Write Stall (PCIe)", + "L2 - Fabric Write Stall (Infinity Fabricâ„¢)", + "L2 - Fabric Write Stall (HBM)", + "L2 - Fabric Write Starve", ] # The prefix of raw pmc_perf.csv diff --git a/projects/rocprofiler-compute/src/utils/specs.py b/projects/rocprofiler-compute/src/utils/specs.py index a644cffeeb..a71b1c65d5 100644 --- a/projects/rocprofiler-compute/src/utils/specs.py +++ b/projects/rocprofiler-compute/src/utils/specs.py @@ -63,6 +63,7 @@ class MachineSpecs: L2Banks: str LDSBanks: str numSQC: str + numPipes: str hbmBW: str compute_partition: str memory_partition: str @@ -96,6 +97,7 @@ class MachineSpecs: L2Banks: {self.L2Banks} LDSBanks: {self.LDSBanks} numSQC: {self.numSQC} + numPipes: {self.numPipes} hbmBW: {self.hbmBW} MB/s compute_partition: {self.compute_partition} memory_partition: {self.memory_partition} @@ -114,6 +116,7 @@ def gpuinfo(): "max_sclk": None, "num_CU": None, "num_SIMD": None, + "numPipes": None, "num_SE": None, "wave_size": None, "grp_size": None, @@ -197,6 +200,7 @@ def gpuinfo(): gpu_info['L2Banks'] = str(soc_module.SOC_PARAM['L2Banks']) gpu_info['numSQC'] = str(soc_module.SOC_PARAM['numSQC']) gpu_info['LDSBanks'] = str(soc_module.SOC_PARAM['LDSBanks']) + gpu_info['numPipes'] = str(soc_module.SOC_PARAM['numPipes']) except KeyError as e: error("Incomplete class definition for %s. Expected a field for %s in SOC_PARAM." % (gpu_arch, e))\ @@ -358,6 +362,7 @@ def get_machine_specs(devicenum): gpu_info['L2Banks'], gpu_info['LDSBanks'], gpu_info['numSQC'], + gpu_info['numPipes'], hbmBW, compute_partition, memory_partition, diff --git a/projects/rocprofiler-compute/src/utils/utils.py b/projects/rocprofiler-compute/src/utils/utils.py index 5966b95be9..4399d9e208 100644 --- a/projects/rocprofiler-compute/src/utils/utils.py +++ b/projects/rocprofiler-compute/src/utils/utils.py @@ -299,7 +299,7 @@ def gen_sysinfo(workload_name, workload_dir, ip_blocks, app_cmd, skip_roof, roof header += "command," header += "host_name,host_cpu,sbios,host_distro,host_kernel,host_rocmver,date," header += "gpu_soc,vbios,numSE,numCU,numSIMD,waveSize,maxWavesPerCU,maxWorkgroupSize," - header += "L1,L2,sclk,mclk,cur_sclk,cur_mclk,L2Banks,LDSBanks,name,numSQC,hbmBW,compute_partition,memory_partition," + header += "L1,L2,sclk,mclk,cur_sclk,cur_mclk,L2Banks,LDSBanks,name,numSQC,numPipes,hbmBW,compute_partition,memory_partition," header += "ip_blocks\n" sysinfo.write(header) @@ -344,6 +344,7 @@ def gen_sysinfo(workload_name, workload_dir, ip_blocks, app_cmd, skip_roof, roof mspec.LDSBanks, mspec.GPU, mspec.numSQC, + mspec.numPipes, mspec.hbmBW, mspec.compute_partition, mspec.memory_partition,