From d41e115916291465e8d4441e999fea5faa13b183 Mon Sep 17 00:00:00 2001 From: xuchen-amd Date: Thu, 18 Sep 2025 10:48:01 -0400 Subject: [PATCH] [rocprofiler-compute][webui] bug fix (#1047) --- .../rocprof_compute_analyze/analysis_webui.py | 30 ++++++++++--------- .../rocprofiler-compute/src/utils/file_io.py | 8 +++-- .../rocprofiler-compute/src/utils/parser.py | 2 +- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/projects/rocprofiler-compute/src/rocprof_compute_analyze/analysis_webui.py b/projects/rocprofiler-compute/src/rocprof_compute_analyze/analysis_webui.py index a4500f25a9..df84bdb6c1 100644 --- a/projects/rocprofiler-compute/src/rocprof_compute_analyze/analysis_webui.py +++ b/projects/rocprofiler-compute/src/rocprof_compute_analyze/analysis_webui.py @@ -39,6 +39,7 @@ from config import HIDDEN_COLUMNS, PROJECT_NAME from rocprof_compute_analyze.analysis_base import OmniAnalyze_Base from utils import file_io, parser, schema from utils.gui import build_bar_chart, build_table_chart +from utils.gui_components.memchart import get_memchart from utils.logger import console_debug, console_error, console_warning, demarcate @@ -117,11 +118,11 @@ class webui_analysis(OmniAnalyze_Base): [State("container", "children")], ) def generate_from_filter( - disp_filt: str, - kernel_filter: str, - gcd_filter: str, + disp_filt: list[str], + kernel_filter: list[str], + gcd_filter: list[str], norm_filt: str, - top_n_filt: str, + top_n_filt: int, div_children: list[html.Section], ) -> list[html.Section]: console_debug("analysis", f"gui normalization is {norm_filt}") @@ -151,9 +152,15 @@ class webui_analysis(OmniAnalyze_Base): console_debug("analysis", f"gui gpu filter is {gcd_filter}") console_debug("analysis", f"gui top-n filter is {top_n_filt}") - base_data[base_run].filter_kernel_ids = [int(kernel_filter)] - base_data[base_run].filter_gpu_ids = [int(gcd_filter)] - base_data[base_run].filter_dispatch_ids = [int(disp_filt)] + base_data[base_run].filter_kernel_ids = ( + [str(k) for k in kernel_filter] if kernel_filter else [] + ) + base_data[base_run].filter_gpu_ids = ( + [int(g) for g in gcd_filter] if gcd_filter else [] + ) + base_data[base_run].filter_dispatch_ids = ( + [int(d) for d in disp_filt] if disp_filt else [] + ) base_data[base_run].filter_top_n = top_n_filt # Reload the pmc_kernel_top.csv for Top Stats panel @@ -198,14 +205,9 @@ class webui_analysis(OmniAnalyze_Base): # ~~~~~~~~~~~~~~~~~~~~~~~ # Generate GUI content # ~~~~~~~~~~~~~~~~~~~~~~~ - div_children = [] - - # Append memory chart and roofline - from utils.gui_components.memchart import get_memchart - - div_children.append( + div_children = [ get_memchart(panel_configs[300]["data source"], base_data[base_run]) - ) + ] has_roofline = (Path(self.dest_dir) / "roofline.csv").is_file() soc = self.get_socs() diff --git a/projects/rocprofiler-compute/src/utils/file_io.py b/projects/rocprofiler-compute/src/utils/file_io.py index d481bad39d..c9375d7162 100644 --- a/projects/rocprofiler-compute/src/utils/file_io.py +++ b/projects/rocprofiler-compute/src/utils/file_io.py @@ -118,13 +118,15 @@ def create_df_kernel_top_stats( # NB: support ignoring the 1st n dispatched execution by '> n' # The better way may be parsing python slice string first_filter = filter_dispatch_ids[0] - if first_filter.startswith(">"): - match = re.match(r">\s*(\d+)", first_filter) + + if isinstance(first_filter, str) and first_filter.startswith(">"): + match = re.match(r">\s*(\d+)", str(first_filter)) if match: threshold = int(match.group(1)) df = df[df["Dispatch_ID"] > threshold] else: - df = df.loc[df["Dispatch_ID"].astype(str).isin(filter_dispatch_ids)] + filter_strings = [str(f) for f in filter_dispatch_ids] + df = df.loc[df["Dispatch_ID"].astype(str).isin(filter_strings)] # First, create a dispatches file used to populate global vars dispatch_columns = ( diff --git a/projects/rocprofiler-compute/src/utils/parser.py b/projects/rocprofiler-compute/src/utils/parser.py index 00259c0a71..4462b26e89 100755 --- a/projects/rocprofiler-compute/src/utils/parser.py +++ b/projects/rocprofiler-compute/src/utils/parser.py @@ -1174,7 +1174,7 @@ def apply_dispatch_filter(df: pd.DataFrame, workload: schema.Workload) -> pd.Dat if int(dispatch_id) >= len(df): # subtract 2 bc of the two header rows console_error("analysis", f"{dispatch_id} is an invalid dispatch id.") - if ">" in workload.filter_dispatch_ids[0]: + if isinstance(workload.filter_dispatch_ids[0], str) and ">" in workload.filter_dispatch_ids[0]: dispatch_match = re.match(r"\> (\d+)", workload.filter_dispatch_ids[0]) df = df[ df[schema.PMC_PERF_FILE_PREFIX]["Dispatch_ID"]