Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions onnx_diagnostic/_command_lines_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,13 +718,13 @@ def get_parser_agg() -> ArgumentParser:
"peak_gpu_torch,peak_gpu_nvidia,n_node_control_flow,"
"n_node_constant,n_node_shape,n_node_expand,"
"n_node_function,n_node_initializer,n_node_scatter,"
"time_export_unbiased",
"time_export_unbiased,onnx_n_nodes_no_cst,n_node_initializer_small",
help="Columns to compute after the aggregation was done.",
)
parser.add_argument(
"--views",
default="agg-suite,agg-all,disc,speedup,time,time_export,err,cmd,"
"bucket-speedup,raw-short,counts,peak-gpu",
"bucket-speedup,raw-short,counts,peak-gpu,onnx",
help="Views to add to the output files.",
)
parser.add_argument(
Expand All @@ -734,13 +734,13 @@ def get_parser_agg() -> ArgumentParser:
)
parser.add_argument("-v", "--verbose", type=int, default=0, help="verbosity")
parser.add_argument(
"--filter_in",
"--filter-in",
default="",
help="adds a filter to filter in data, syntax is\n"
'``"<column1>:<value1>;<value2>/<column2>:<value3>"`` ...',
)
parser.add_argument(
"--filter_out",
"--filter-out",
default="",
help="adds a filter to filter out data, syntax is\n"
'``"<column1>:<value1>;<value2>/<column2>:<value3>"`` ...',
Expand Down
43 changes: 37 additions & 6 deletions onnx_diagnostic/helpers/log_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def apply_excel_style(
co: Dict[int, int] = {}
sizes: Dict[int, int] = {}
cols = set()
for i in range(1, n_rows):
for i in range(1, n_rows + 1):
for j, cell in enumerate(sheet[i]):
if j > n_cols:
break
Expand All @@ -335,7 +335,7 @@ def apply_excel_style(
c = get_column_letter(k)
sheet.column_dimensions[c].width = 15

for i in range(1, n_rows):
for i in range(1, n_rows + 1):
for j, cell in enumerate(sheet[i]):
if j > n_cols:
break
Expand Down Expand Up @@ -516,13 +516,14 @@ def _to_images_bar(
df = self.df.T if self.orientation == "row" else self.df
title_suffix = f"\n{title_suffix}" if title_suffix else ""

nn = len(df.columns) // 2
nn += nn % 2
fig, axs = plt.subplots(nn, 2, figsize=(12, nn * df.shape[0] / 4))
n_cols = 3
nn = df.shape[1] // n_cols
nn += int(df.shape[1] % n_cols != 0)
fig, axs = plt.subplots(nn, n_cols, figsize=(6 * n_cols, nn * df.shape[0] / 5))
pos = 0
imgs = []
for c in self._make_loop(df.columns, verbose):
ax = axs[pos // 2, pos % 2]
ax = axs[pos // n_cols, pos % n_cols]
(
df[c].plot.barh(title=f"{c}{title_suffix}", ax=ax)
if self.kind == "barh"
Expand Down Expand Up @@ -1427,9 +1428,11 @@ def __init__(
"n_node_scatter",
"n_node_function",
"n_node_initializer",
"n_node_initializer_small",
"n_node_constant",
"n_node_shape",
"n_node_expand",
"onnx_n_nodes_no_cst",
"peak_gpu_torch",
"peak_gpu_nvidia",
"time_export_unbiased",
Expand Down Expand Up @@ -1597,6 +1600,9 @@ def first_err(df: pandas.DataFrame) -> pandas.Series:
n_node_function=lambda df: gpreserve(
df, "onnx_n_functions", gdf(df, "onnx_n_functions")
),
n_node_initializer_small=lambda df: gpreserve(
df, "op_onnx_initializer_small", gdf(df, "op_onnx_initializer_small")
),
n_node_initializer=lambda df: gpreserve(
df, "onnx_n_initializer", gdf(df, "onnx_n_initializer")
),
Expand All @@ -1615,6 +1621,10 @@ def first_err(df: pandas.DataFrame) -> pandas.Series:
), f"Unexpected formula={formula!r}, should be in {sorted(lambdas)}"
return lambdas[formula]

if formula == "onnx_n_nodes_no_cst":
return lambda df: gdf(df, "onnx_n_nodes", 0) - gdf(
df, "op_onnx__Constant", 0
).fillna(0)
if formula == "peak_gpu_torch":
return lambda df: gdf(df, "mema_gpu_5_after_export") - gdf(df, "mema_gpu_4_reset")
if formula == "peak_gpu_nvidia":
Expand Down Expand Up @@ -1766,6 +1776,8 @@ def mean_geo(gr):
"onnx_weight_size_torch",
"onnx_weight_size_proto",
"onnx_n_nodes",
"onnx_n_nodes_no_cst",
"op_onnx__Constant",
"peak_gpu_torch",
"peak_gpu_nvidia",
],
Expand Down Expand Up @@ -1795,6 +1807,7 @@ def mean_geo(gr):
"onnx_weight_size_torch",
"onnx_weight_size_proto",
"onnx_n_nodes",
"onnx_n_nodes_no_cst",
"peak_gpu_torch",
"peak_gpu_nvidia",
],
Expand Down Expand Up @@ -1887,6 +1900,24 @@ def mean_geo(gr):
name="cmd",
order=order,
),
"onnx": lambda: CubeViewDef(
key_index=index_cols,
values=self._filter_column(
[
"onnx_filesize",
"onnx_n_nodes",
"onnx_n_nodes_no_cst",
"onnx_weight_size_proto",
"onnx_weight_size_torch",
"op_onnx_initializer_small",
],
self.values,
),
ignore_unique=True,
keep_columns_in_index=["suite"],
name="onnx",
order=order,
),
"raw-short": lambda: CubeViewDef(
key_index=self.keys_time,
values=[c for c in self.values if c not in {"ERR_std", "ERR_stdout"}],
Expand Down
Loading