From 6410c0843c73729c3cadbb1f27880366360c5fca Mon Sep 17 00:00:00 2001 From: Mukesh Garg Date: Wed, 29 Jul 2026 14:51:01 -0700 Subject: [PATCH] =?UTF-8?q?analytical-viz:=20roofline=20tab=20=E2=80=94=20?= =?UTF-8?q?fix=20NameError=20from=20knob-rename=20refactor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous commit renamed slider vars (_rf_flops_mult -> _flops_mult_now, etc.) and split _ai/_b_star into base vs scaled, but the AI-sensitivity plot's vertical markers + caption still referenced the old names, so loading the tab crashed with: NameError: name '_rf_flops_mult' is not defined Fixed all four call sites: - _axAI1: 'Base AI' reference line now uses _ai_base (was _ai, which is now the scaled value). - _axAI2: 'Base B*' reference line uses _b_star_base; vertical markers use _flops_mult_now / _bw_mult_now. - Caption 'Your knob position' uses the new names. Grep confirms no _rf_flops_mult / _rf_bw_mult / _ai_scaled / _b_star_scaled references remain. Co-Authored-By: Claude Opus 4.7 --- tests/analytical_visualization/app.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/analytical_visualization/app.py b/tests/analytical_visualization/app.py index 11dfac7..d381266 100644 --- a/tests/analytical_visualization/app.py +++ b/tests/analytical_visualization/app.py @@ -2427,8 +2427,8 @@ with tab_roofline: color="#3a86ff", linewidth=2, label="Scale FLOPs") _axAI1.plot(_ai_mults, [p.ai for p in _ai_bw_pts], "s-", color="#d90429", linewidth=2, label="Scale HBM BW") - _axAI1.axhline(_ai, color="#2e7d32", linestyle=":", - label=f"Base AI = {_ai:.1f}") + _axAI1.axhline(_ai_base, color="#2e7d32", linestyle=":", + label=f"Base AI = {_ai_base:.1f}") _axAI1.axvline(1.0, color="#888", linestyle=":", alpha=0.5) _axAI1.set_xscale("log", base=2) _axAI1.set_yscale("log") @@ -2442,12 +2442,12 @@ with tab_roofline: color="#3a86ff", linewidth=2, label="Scale FLOPs") _axAI2.plot(_ai_mults, [p.b_star for p in _ai_bw_pts], "s-", color="#d90429", linewidth=2, label="Scale HBM BW") - _axAI2.axhline(_b_star, color="#2e7d32", linestyle=":", - label=f"Base B* = {_b_star:.0f}") - _axAI2.axvline(_rf_flops_mult, color="#3a86ff", linewidth=1.2, - alpha=0.5, label=f"FLOPs × {_rf_flops_mult:.2f}") - _axAI2.axvline(_rf_bw_mult, color="#d90429", linewidth=1.2, - alpha=0.5, label=f"BW × {_rf_bw_mult:.2f}", + _axAI2.axhline(_b_star_base, color="#2e7d32", linestyle=":", + label=f"Base B* = {_b_star_base:.0f}") + _axAI2.axvline(_flops_mult_now, color="#3a86ff", linewidth=1.2, + alpha=0.5, label=f"FLOPs × {_flops_mult_now:.2f}") + _axAI2.axvline(_bw_mult_now, color="#d90429", linewidth=1.2, + alpha=0.5, label=f"BW × {_bw_mult_now:.2f}", linestyle="--") _axAI2.set_xscale("log", base=2) _axAI2.set_yscale("log") @@ -2466,10 +2466,10 @@ with tab_roofline: f"raises AI linearly (more compute per byte). Scaling **HBM BW** " f"lowers AI (more bytes to feed per FLOP). " f"**Right**: B\\* moves in the same direction as AI. " - f"**Your knob position**: FLOPs × {_rf_flops_mult:.2f}, " - f"BW × {_rf_bw_mult:.2f} → **AI = {_ai_scaled:.2f}**, " - f"**B\\* = {_b_star_scaled:.0f}** (vs base AI {_ai:.1f}, " - f"B\\* {_b_star:.0f})." + f"**Your knob position**: FLOPs × {_flops_mult_now:.2f}, " + f"BW × {_bw_mult_now:.2f} → **AI = {_ai:.2f}**, " + f"**B\\* = {_b_star:.0f}** (base AI {_ai_base:.1f}, " + f"B\\* {_b_star_base:.0f})." ) st.divider()