[rocprofiler-compute] Fix kernel/dispatch filtering (#2479)
* Fix kernel/dispatch fitlering in GUI
* Disallow --kernel and --dispatch filtering in analyze --gui mode since
GUI frontend offers dropdown menu for kernel and dispatch filtering
* Update CHANGELOG and documentation
* Gracefully handle N/A values
* Ensure workload path is valid before using it in GUI
* Ignore kernel filters if dispatch filters provided
* Add documentation for dispatch filtering overriding kernel filtering
* Fix typo
* Fix documentation
* remove unnecessary whitespace
* Address review comments
* Allow kernel/dispatch filtering with --gui
* Address review comments
* Address review comments
* Update CHANGELOG
* Fix formatting
This commit is contained in:
1 parent
a926660670
commit
4a5cbbfba5
7 files changed
+33
-31
No files matched your search
@@ -386,26 +386,24 @@ class OmniAnalyze_Base:
|
||||
sys.exit(0)
|
||||
|
||||
# Ensure analysis output does not overwrite existing files
|
||||
if not args.output_name:
|
||||
return
|
||||
if args.output_name:
|
||||
if not re.match(r"^[A-Za-z0-9_-]+$", args.output_name):
|
||||
console_error(
|
||||
"analysis",
|
||||
"Analysis output file/folder name must "
|
||||
"contain only alphanumeric characters "
|
||||
"or underscores (_), hyphens (-).",
|
||||
)
|
||||
|
||||
if not re.match(r"^[A-Za-z0-9_-]+$", args.output_name):
|
||||
console_error(
|
||||
"analysis",
|
||||
"Analysis output file/folder name must "
|
||||
"contain only alphanumeric characters "
|
||||
"or underscores (_), hyphens (-).",
|
||||
)
|
||||
path_to_check = args.output_name
|
||||
if args.output_format in ("txt", "db"):
|
||||
path_to_check += f".{args.output_format}"
|
||||
|
||||
path_to_check = args.output_name
|
||||
if args.output_format in ("txt", "db"):
|
||||
path_to_check += f".{args.output_format}"
|
||||
|
||||
if Path(path_to_check).exists():
|
||||
console_error(
|
||||
f"Analysis output file/folder {path_to_check} already exists. "
|
||||
"Please choose a different name."
|
||||
)
|
||||
if Path(path_to_check).exists():
|
||||
console_error(
|
||||
f"Analysis output file/folder {path_to_check} already exists. "
|
||||
"Please choose a different name."
|
||||
)
|
||||
|
||||
# Check if any kernel's counters are missing due to iteration multiplexing
|
||||
if (
|
||||
|
||||
@@ -51,7 +51,6 @@ class webui_analysis(OmniAnalyze_Base):
|
||||
self.app = dash.Dash(
|
||||
__name__, title=PROJECT_NAME, external_stylesheets=[dbc.themes.CYBORG]
|
||||
)
|
||||
self.dest_dir = str(Path(args.path[0][0]).absolute().resolve())
|
||||
self.arch: Optional[str] = None
|
||||
|
||||
self.__hidden_sections = ["Memory Chart"]
|
||||
@@ -90,6 +89,7 @@ class webui_analysis(OmniAnalyze_Base):
|
||||
kernel_top_df = base_data.dfs[1]
|
||||
for kernel_id in base_data.filter_kernel_ids:
|
||||
filt_kernel_names.append(str(kernel_top_df.loc[kernel_id, "Kernel_Name"]))
|
||||
input_filters["kernel"] = filt_kernel_names
|
||||
|
||||
# setup app layout
|
||||
from utils.gui_components.header import get_header
|
||||
@@ -338,6 +338,7 @@ class webui_analysis(OmniAnalyze_Base):
|
||||
)
|
||||
|
||||
args = self.get_args()
|
||||
self.dest_dir = str(Path(args.path[0][0]).absolute().resolve())
|
||||
|
||||
# create 'mega dataframe'
|
||||
self._runs[self.dest_dir].raw_pmc = file_io.create_df_pmc(
|
||||
|
||||
@@ -61,7 +61,7 @@ def multi_bar_chart(
|
||||
|
||||
def create_instruction_mix_bar_chart(display_df: pd.DataFrame, df_unit: str) -> px.bar:
|
||||
display_df = display_df.copy()
|
||||
display_df["Avg"] = display_df["Avg"].apply(lambda x: int(x) if x != "" else 0)
|
||||
display_df["Avg"] = display_df["Avg"].apply(lambda x: int(x) if x != "N/A" else 0)
|
||||
|
||||
return px.bar(
|
||||
display_df,
|
||||
@@ -78,7 +78,7 @@ def create_multi_bar_charts(
|
||||
display_df: pd.DataFrame, table_id: int, df_unit: str
|
||||
) -> list[px.bar]:
|
||||
display_df = display_df.copy()
|
||||
display_df["Avg"] = display_df["Avg"].apply(lambda x: int(x) if x != "" else 0)
|
||||
display_df["Avg"] = display_df["Avg"].apply(lambda x: int(x) if x != "N/A" else 0)
|
||||
|
||||
nested_bar = multi_bar_chart(table_id, display_df)
|
||||
charts = []
|
||||
@@ -103,7 +103,9 @@ def create_multi_bar_charts(
|
||||
|
||||
def create_sol_charts(display_df: pd.DataFrame, table_id: int) -> list[px.bar]:
|
||||
display_df = display_df.copy()
|
||||
display_df["Avg"] = display_df["Avg"].apply(lambda x: float(x) if x != "" else 0.0)
|
||||
display_df["Avg"] = display_df["Avg"].apply(
|
||||
lambda x: float(x) if x != "N/A" else 0.0
|
||||
)
|
||||
|
||||
charts = []
|
||||
|
||||
@@ -144,7 +146,7 @@ def create_sol_charts(display_df: pd.DataFrame, table_id: int) -> list[px.bar]:
|
||||
elif table_id == 1101:
|
||||
# Special formatting reference 'Pct of Peak' value
|
||||
display_df["Pct of Peak"] = display_df["Pct of Peak"].apply(
|
||||
lambda x: float(x) if x != "" else 0.0
|
||||
lambda x: float(x) if x != "N/A" else 0.0
|
||||
)
|
||||
charts.append(
|
||||
px.bar(
|
||||
|
||||
@@ -1290,6 +1290,8 @@ def apply_dispatch_filter(df: pd.DataFrame, workload: schema.Workload) -> pd.Dat
|
||||
# NB: support ignoring the 1st n dispatched execution by '> n'
|
||||
# The better way may be parsing python slice string
|
||||
for dispatch_id in workload.filter_dispatch_ids:
|
||||
if isinstance(dispatch_id, str) and ">" in dispatch_id:
|
||||
dispatch_id = re.match(r"\>\s*(\d+)", dispatch_id).group(1)
|
||||
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.")
|
||||
|
||||
@@ -1297,7 +1299,7 @@ def apply_dispatch_filter(df: pd.DataFrame, workload: schema.Workload) -> pd.Dat
|
||||
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])
|
||||
dispatch_match = re.match(r"\>\s*(\d+)", workload.filter_dispatch_ids[0])
|
||||
df = df[
|
||||
df[schema.PMC_PERF_FILE_PREFIX]["Dispatch_ID"]
|
||||
> int(dispatch_match.group(1))
|
||||
|
||||
Reference in new issue
Block a user