From 6f6c07b34f2eed22ee8e3b336f19c3b406fb348c Mon Sep 17 00:00:00 2001 From: colramos425 Date: Wed, 11 Jan 2023 17:28:23 -0600 Subject: [PATCH] Build chart for L2 Cache per channel in GUI Signed-off-by: colramos425 --- src/omniperf_analyze/assets/layout.css | 14 --------- src/omniperf_analyze/utils/gui.py | 43 +++++++++++++++++++++----- src/omniperf_analyze/utils/schema.py | 36 ++++++++++----------- 3 files changed, 53 insertions(+), 40 deletions(-) diff --git a/src/omniperf_analyze/assets/layout.css b/src/omniperf_analyze/assets/layout.css index 44d0f99630..b723d236a3 100644 --- a/src/omniperf_analyze/assets/layout.css +++ b/src/omniperf_analyze/assets/layout.css @@ -593,20 +593,6 @@ button.report:hover { #l2_cache_per_channel a, #l2_cache_per_channel a:visited { color: #fff; } #l2_cache_per_channel a:hover, #l2_cache_per_channel a:focus { color: #11ABB0; } -#l2_cache_per_channel .float-container { - /* border: 3px solid #fff; */ - padding: 20px; -} -#l2_cache_per_channel .float-child { - width: 100%; - float: left; - padding: 20px; - /* border: 2px solid red; */ -} -#l2_cache_per_channel .float-child h3 { - color: #fff; -} - /* ------------------------------------------------------------------ */ /* c. About Section /* ------------------------------------------------------------------ */ diff --git a/src/omniperf_analyze/utils/gui.py b/src/omniperf_analyze/utils/gui.py index 0ed1f63c82..0740c8d4db 100644 --- a/src/omniperf_analyze/utils/gui.py +++ b/src/omniperf_analyze/utils/gui.py @@ -51,15 +51,18 @@ HIDDEN_SECTIONS = ["Memory Chart Analysis", "Kernels"] HIDDEN_COLUMNS = ["Tips", "coll_level"] IS_DARK = True # default dark theme -# Add any elements you'd like displayed as a bar chart +# Define different types of bar charts barchart_elements = { - # organized by barchart type + # Group table ids by chart type "instr_mix": [1001, 1002], "multi_bar": [1604, 1704], "sol": [1101, 1201, 1301, 1401, 1601, 1701], + "l2_cache_per_chan": [1801, 1802], } - +################## +# HELPER FUNCTIONS +################## def filter_df(column, df, filt): filt_df = df if filt != []: @@ -137,8 +140,10 @@ def discrete_background_color_bins(df, n_bins=5, columns="all"): return (styles, html.Div(legend, style={"padding": "5px 0 5px 0"})) - -def build_bar_chart(display_df, table_config): +#################### +# GRAPHICAL ELEMENTS +#################### +def build_bar_chart(display_df, table_config, norm_filt): d_figs = [] # Insr Mix bar chart @@ -182,6 +187,28 @@ def build_bar_chart(display_df, table_config): .update_yaxes(showgrid=False) .update_layout(title_x=0.5) ) + # L2 Cache per channel + elif table_config["id"] in barchart_elements["l2_cache_per_chan"]: + nested_bar = {} + channels = [] + for (colName, colData) in display_df.items(): + if colName == "Channel": + channels = list(colData.values) + else: + display_df[colName] = [ + x.astype(float) if x != "" and x != None else float(0) for x in display_df[colName] + ] + nested_bar[colName] = list(display_df[colName]) + for group, metric in nested_bar.items(): + d_figs.append( + px.bar( + title=group[0:group.rfind("(")], + x=channels, + y=metric, + labels={"x": "Channel", "y":group[group.rfind("(")+1: len(group)-1].replace("per", norm_filt)} + ) + .update_yaxes(rangemode="nonnegative") + ) # Speed-of-light bar chart elif table_config["id"] in barchart_elements["sol"]: @@ -383,7 +410,7 @@ def build_layout( def generate_from_filter( disp_filt, kernel_filter, gcd_filter, norm_filt, div_children ): - if verbose <= 1: + if verbose >= 1: print("normalization is ", norm_filt) base_data = initialize_run(args, norm_filt) # Re-initalize everything @@ -475,9 +502,9 @@ def build_layout( if table_config["id"] in [ x for i in barchart_elements.values() for x in i ]: - d_figs = build_bar_chart(display_df, table_config) + d_figs = build_bar_chart(display_df, table_config, norm_filt) # Smaller formatting if barchart yeilds several graphs - if len(d_figs) > 2: + if len(d_figs) > 2 and not table_config["id"] in barchart_elements["l2_cache_per_chan"]: temp_obj = [] for fig in d_figs: temp_obj.append( diff --git a/src/omniperf_analyze/utils/schema.py b/src/omniperf_analyze/utils/schema.py index 005afba02b..87394da339 100644 --- a/src/omniperf_analyze/utils/schema.py +++ b/src/omniperf_analyze/utils/schema.py @@ -84,24 +84,24 @@ supported_field = [ "Alias", # Special keywords for L2 channel "Channel", - "Hit Rate", - "Req", - "Read Req", - "Write Req", - "AtomicReq", - "EA Read Req", - "EA Write Req", - "EA AtomicReq", - "EA Read Lat - cycles", - "EA Write Lat - cycles", - "EA Atomic Lat - cycles", - "EA Read Stall - IO", - "EA Read Stall - GMI", - "EA Read Stall - DRAM", - "EA Write Stall - IO", - "EA Write Stall - GMI", - "EA Write Stall - DRAM", - "EA Write Stall - Starve", + "L2 Cache Hit Rate (%)", + "Requests (Requests)", + "L1-L2 Read (Requests)", + "L1-L2 Write (Requests)", + "L1-L2 Atomic (Requests)", + "L2-EA Read (Requests)", + "L2-EA Write (Requests)", + "L2-EA Atomic (Requests)", + "L2-EA Read Latency (Cycles)", + "L2-EA Write Latency (Cycles)", + "L2-EA Atomic Latency (Cycles)", + "L2-EA Read Stall - IO (Cycles per)", + "L2-EA Read Stall - GMI (Cycles per)", + "L2-EA Read Stall - DRAM (Cycles per)", + "L2-EA Write Stall - IO (Cycles per)", + "L2-EA Write Stall - GMI (Cycles per)", + "L2-EA Write Stall - DRAM (Cycles per)", + "L2-EA Write Stall - Starve (Cycles per)", ] # The prefix of raw pmc_perf.csv