From 1bce080d79b0bf1cd486c0ea7e9caf96c3d4653e Mon Sep 17 00:00:00 2001 From: Mukesh Garg Date: Tue, 28 Jul 2026 22:23:34 -0700 Subject: [PATCH] analytical-viz: buttons pick smallest-fit Pareto point, not fastest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sidebar Attention/FFN/Attn+FFN buttons and Physical Layout tab buttons now select the SMALLEST-FIT config from the scope's Pareto set — key changed from (latency ↑, pes_used ↑, hbm_utilization ↑) to (pes_used ↑, hbm_utilization ↑, latency ↑). Answers "smallest deployment that's still Pareto-optimal for this scope" instead of "fastest deployment achievable". Left unchanged: - "Best latency" metric displays in Auto Suggest / Auto Hardware tabs still show the fastest number (informational; the metric labels say "Best latency"). - auto_hardware._best_parallelism_for_hw stays latency-min: it's inside HW co-design, where "how fast can each HW candidate go" is the primary question. Verified: 24 pytest tests pass. Co-Authored-By: Claude Opus 4.7 --- tests/analytical_visualization/app.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/analytical_visualization/app.py b/tests/analytical_visualization/app.py index 43ade29..df07fcb 100644 --- a/tests/analytical_visualization/app.py +++ b/tests/analytical_visualization/app.py @@ -237,12 +237,15 @@ with st.sidebar.expander("Parallelism", expanded=True): "`pe_hbm_gb` or reducing `s_kv`." ) else: - # Compound key: min latency, then fewer PEs, then lower HBM %. - # Prefer smaller-footprint configs when they tie on latency. + # Smallest-fit Pareto point: fewest PEs first, then lowest + # HBM utilization, then fastest latency as final tiebreaker. + # Gives the smallest deployment that's still Pareto-optimal + # for the chosen scope (matches how the memory-min autosuggest + # thinks — but restricted to this scope's Pareto set). _sb_best = min(_sb_res.pareto_scores, - key=lambda s: (s.total_latency_ns, - s.pes_used, - s.hbm_utilization)) + key=lambda s: (s.pes_used, + s.hbm_utilization, + s.total_latency_ns)) st.session_state["cp"] = _snap(_sb_best.cp, _CP_OPTS) st.session_state["tp"] = _snap(_sb_best.tp, _TP_OPTS) st.session_state["pp"] = _snap(_sb_best.pp, _PP_OPTS) @@ -584,11 +587,11 @@ with tab_layout: "`s_kv`." ) else: - # Compound tiebreaker: min latency, then fewer PEs, then lower HBM %. + # Smallest-fit Pareto point (see sidebar apply comment). _pl_best = min(_pl_res.pareto_scores, - key=lambda s: (s.total_latency_ns, - s.pes_used, - s.hbm_utilization)) + key=lambda s: (s.pes_used, + s.hbm_utilization, + s.total_latency_ns)) # Load the winning config into the sidebar's session state. st.session_state["cp"] = _pl_best.cp st.session_state["tp"] = _pl_best.tp