From afa103f33141f9f54ae800b64fb22d88e1c3c14b Mon Sep 17 00:00:00 2001 From: colramos425 Date: Thu, 19 Jan 2023 12:41:13 -0600 Subject: [PATCH] Add BW label to all roof plots Signed-off-by: colramos425 [ROCm/rocprofiler-compute commit: 15ed9317dd55991340b76339baa1faa6a7cd980a] --- .../utils/gui_components/roofline.py | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/projects/rocprofiler-compute/src/omniperf_analyze/utils/gui_components/roofline.py b/projects/rocprofiler-compute/src/omniperf_analyze/utils/gui_components/roofline.py index 669dc284a1..c86c8365b8 100644 --- a/projects/rocprofiler-compute/src/omniperf_analyze/utils/gui_components/roofline.py +++ b/projects/rocprofiler-compute/src/omniperf_analyze/utils/gui_components/roofline.py @@ -40,6 +40,7 @@ def generate_plots(roof_info, ai_data, verbose, fig=None): if fig is None: fig = go.Figure() line_data = roofline_calc.empirical_roof(roof_info, verbose) + print("Line data:\n", line_data) ####################### # Plot BW Lines @@ -49,12 +50,12 @@ def generate_plots(roof_info, ai_data, verbose, fig=None): x=line_data["hbm"][0], y=line_data["hbm"][1], name="HBM-{}".format(roof_info["dtype"]), - mode="lines", + mode="lines+text", hovertemplate="%{text}", text=[ "{} GB/s".format(to_int(line_data["hbm"][2])), - "{} GFLOP/s".format(to_int(line_data["hbm"][2])), ], + textposition="top center" ) ) fig.add_trace( @@ -62,12 +63,12 @@ def generate_plots(roof_info, ai_data, verbose, fig=None): x=line_data["l2"][0], y=line_data["l2"][1], name="L2-{}".format(roof_info["dtype"]), - mode="lines", + mode="lines+text", hovertemplate="%{text}", text=[ "{} GB/s".format(to_int(line_data["l2"][2])), - "{} GFLOP/s".format(to_int(line_data["l2"][2])), ], + textposition="top center" ) ) fig.add_trace( @@ -75,12 +76,12 @@ def generate_plots(roof_info, ai_data, verbose, fig=None): x=line_data["l1"][0], y=line_data["l1"][1], name="L1-{}".format(roof_info["dtype"]), - mode="lines", + mode="lines+text", hovertemplate="%{text}", text=[ "{} GB/s".format(to_int(line_data["l1"][2])), - "{} GFLOP/s".format(to_int(line_data["l1"][2])), ], + textposition="top center" ) ) fig.add_trace( @@ -88,12 +89,12 @@ def generate_plots(roof_info, ai_data, verbose, fig=None): x=line_data["lds"][0], y=line_data["lds"][1], name="LDS-{}".format(roof_info["dtype"]), - mode="lines", + mode="lines+text", hovertemplate="%{text}", text=[ "{} GB/s".format(to_int(line_data["lds"][2])), - "{} GFLOP/s".format(to_int(line_data["lds"][2])), ], + textposition="top center" ) ) if roof_info["dtype"] != "FP16" and roof_info["dtype"] != "I8": @@ -102,25 +103,32 @@ def generate_plots(roof_info, ai_data, verbose, fig=None): x=line_data["valu"][0], y=line_data["valu"][1], name="Peak VALU-{}".format(roof_info["dtype"]), - mode="lines", + mode="lines+text", hovertemplate="%{text}", text=[ - "{} GFLOP/s".format(to_int(line_data["valu"][2])), + None, "{} GFLOP/s".format(to_int(line_data["valu"][2])), ], + textposition="top center" ) ) + + if roof_info["dtype"] == "FP16": + pos = "bottom center" + else: + pos = "top center" fig.add_trace( go.Scatter( x=line_data["mfma"][0], y=line_data["mfma"][1], name="Peak MFMA-{}".format(roof_info["dtype"]), - mode="lines", + mode="lines+text", hovertemplate="%{text}", text=[ - "{} GFLOP/s".format(to_int(line_data["mfma"][2])), + None, "{} GFLOP/s".format(to_int(line_data["mfma"][2])), ], + textposition=pos ) ) ####################### @@ -164,7 +172,7 @@ def generate_plots(roof_info, ai_data, verbose, fig=None): return fig -def get_roofline(path_to_dir, ret_df, dev_id, verbose, isStandalone=False): +def get_roofline(path_to_dir, ret_df, verbose, dev_id=None, isStandalone=False): # Roofline settings # TODO: Make "sort" attribute dynamic so user can select desired sort fp32_details = { @@ -198,8 +206,8 @@ def get_roofline(path_to_dir, ret_df, dev_id, verbose, isStandalone=False): if isStandalone: dev_id = "ALL" if dev_id == -1 else str(dev_id) - fp32_fig.write_image(path_to_dir + "/empirRoof_gpu-{}_fp32".format(dev_id)) - ml_combo_fig.write_image(path_to_dir + "empirRoof_gpu-{}_fp8_fp16".format(dev_id)) + fp32_fig.write_image(path_to_dir + "/empirRoof_gpu-{}_fp32.pdf".format(dev_id)) + ml_combo_fig.write_image(path_to_dir + "/empirRoof_gpu-{}_fp8_fp16.pdf".format(dev_id)) else: return html.Section( id="roofline",