Skip to content

Commit

Permalink
add smart units in gui/cli
Browse files Browse the repository at this point in the history
Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com>
  • Loading branch information
JoseSantosAMD committed Aug 15, 2023
1 parent f3cec33 commit f64691e
Show file tree
Hide file tree
Showing 5 changed files with 249 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Panel Config:
LDS BW:
value: AVG(((((SQ_LDS_IDX_ACTIVE - SQ_LDS_BANK_CONFLICT) * 4) * TO_INT($LDSBanks))
/ (EndNs - BeginNs)))
unit: GB/sec
unit: Gb/s
peak: (($sclk * $numCU) * 0.128)
pop: AVG((((((SQ_LDS_IDX_ACTIVE - SQ_LDS_BANK_CONFLICT) * 4) * TO_INT($LDSBanks))
/ (EndNs - BeginNs)) / (($sclk * $numCU) * 0.00128)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Panel Config:
LDS BW:
value: AVG(((((SQ_LDS_IDX_ACTIVE - SQ_LDS_BANK_CONFLICT) * 4) * TO_INT($LDSBanks))
/ (EndNs - BeginNs)))
unit: GB/sec
unit: Gb/s
peak: (($sclk * $numCU) * 0.128)
pop: AVG((((((SQ_LDS_IDX_ACTIVE - SQ_LDS_BANK_CONFLICT) * 4) * TO_INT($LDSBanks))
/ (EndNs - BeginNs)) / (($sclk * $numCU) * 0.00128)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Panel Config:
LDS BW:
value: AVG(((((SQ_LDS_IDX_ACTIVE - SQ_LDS_BANK_CONFLICT) * 4) * TO_INT($LDSBanks))
/ (EndNs - BeginNs)))
unit: GB/sec
unit: Gb/s
peak: (($sclk * $numCU) * 0.128)
pop: AVG((((((SQ_LDS_IDX_ACTIVE - SQ_LDS_BANK_CONFLICT) * 4) * TO_INT($LDSBanks))
/ (EndNs - BeginNs)) / (($sclk * $numCU) * 0.00128)))
Expand Down
82 changes: 82 additions & 0 deletions src/omniperf_analyze/utils/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,88 @@ def build_bar_chart(display_df, table_config, norm_filt):
def build_table_chart(
display_df, table_config, original_df, display_columns, comparable_columns, decimal
):
if "Unit" in display_df:
what = display_df["Unit"]
if "Gb/s" in display_df["Unit"].values:
for idx, row in display_df[display_df["Unit"] == "Gb/s"].items():
for curr_metric in row:
curr_row = display_df[display_df["Metric"] == curr_metric]
if not curr_row.empty:
if "Value" in curr_row:
if isinstance(
curr_row["Value"][0],
float,
):
if curr_row.Value[0] < 0.001:
display_df.loc[
(display_df["Metric"] == curr_metric),
"Unit",
] = "Kb/s"
display_df.loc[
(display_df["Metric"] == curr_metric),
"Value",
] = (
1000000 * curr_row.Value
)
elif curr_row.Value[0] < 1:
display_df.loc[
(display_df["Metric"] == curr_metric),
"Unit",
] = "Mb/s"
display_df.loc[
(display_df["Metric"] == curr_metric),
"Value",
] = (
1000 * curr_row.Value
)
elif "Avg" in curr_row:
if isinstance(curr_row["Avg"][0], float):
if curr_row.Avg[0] < 0.001:
display_df.loc[
(display_df["Metric"] == curr_metric),
"Unit",
] = "Kb/s"
display_df.loc[
(display_df["Metric"] == curr_metric),
"Avg",
] = (
1000000 * curr_row.Avg
)
display_df.loc[
(display_df["Metric"] == curr_metric),
"Min",
] = (
1000000 * curr_row.Min
)
display_df.loc[
(display_df["Metric"] == curr_metric),
"Max",
] = (
1000000 * curr_row.Max
)
elif curr_row.Avg[0] < 1:
display_df.loc[
(display_df["Metric"] == curr_metric),
"Unit",
] = "Mb/s"
display_df.loc[
(display_df["Metric"] == curr_metric),
"Avg",
] = (
1000 * curr_row.Avg
)
display_df.loc[
(display_df["Metric"] == curr_metric),
"Min",
] = (
1000 * curr_row.Min
)
display_df.loc[
(display_df["Metric"] == curr_metric),
"Max",
] = (
1000 * curr_row.Max
)
d_figs = []

# build comlumns/header with formatting
Expand Down
165 changes: 164 additions & 1 deletion src/omniperf_analyze/utils/tty.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def show_all(args, runs, archConfigs, output):
float(x) if x != "" else float(0)
for x in base_df[header]
]
# insert unit fix here
cur_df[header] = [
float(x) if x != "" else float(0)
for x in cur_df[header]
Expand Down Expand Up @@ -141,13 +142,175 @@ def show_all(args, runs, archConfigs, output):

df = pd.concat([df, t_df], axis=1)
else:
# insert unit fix here
cur_df[header] = [
round(float(x), args.decimal)
if x != ""
else x
for x in base_df[header]
]

if "Unit" in cur_df.columns:
for idx, row in cur_df[
cur_df["Unit"] == "Gb/s"
].items():
for curr_metric in row:
curr_row = cur_df[
cur_df["Metric"] == curr_metric
]
if not curr_row.empty:
if "Value" in curr_row:
if isinstance(
curr_row["Value"][0],
float,
):
if (
curr_row.Value[0]
< 0.001
):
cur_df.loc[
(
cur_df[
"Metric"
]
== curr_metric
),
"Unit",
] = "Kb/s"
cur_df.loc[
(
cur_df[
"Metric"
]
== curr_metric
),
"Value",
] = (
1000000
* curr_row.Value
)
elif (
curr_row.Value[0] < 1
):
cur_df.loc[
(
cur_df[
"Metric"
]
== curr_metric
),
"Unit",
] = "Mb/s"
cur_df.loc[
(
cur_df[
"Metric"
]
== curr_metric
),
"Value",
] = (
1000
* curr_row.Value
)
elif "Avg" in curr_row:
if isinstance(
curr_row["Avg"][0], float
):
if (
curr_row.Avg[0]
< 0.001
):
cur_df.loc[
(
cur_df[
"Metric"
]
== curr_metric
),
"Unit",
] = "Kb/s"
cur_df.loc[
(
cur_df[
"Metric"
]
== curr_metric
),
"Avg",
] = (
1000000
* curr_row.Avg
)
cur_df.loc[
(
cur_df[
"Metric"
]
== curr_metric
),
"Min",
] = (
1000000
* curr_row.Min
)
cur_df.loc[
(
cur_df[
"Metric"
]
== curr_metric
),
"Max",
] = (
1000000
* curr_row.Max
)
elif curr_row.Avg[0] < 1:
cur_df.loc[
(
cur_df[
"Metric"
]
== curr_metric
),
"Unit",
] = "Mb/s"
cur_df.loc[
(
cur_df[
"Metric"
]
== curr_metric
),
"Avg",
] = (
1000
* curr_row.Avg
)
cur_df.loc[
(
cur_df[
"Metric"
]
== curr_metric
),
"Min",
] = (
1000
* curr_row.Min
)
cur_df.loc[
(
cur_df[
"Metric"
]
== curr_metric
),
"Max",
] = (
1000
* curr_row.Max
)
df = pd.concat([df, cur_df[header]], axis=1)

if not df.empty:
Expand Down

0 comments on commit f64691e

Please sign in to comment.