diff --git a/tests/analytical_visualization/app.py b/tests/analytical_visualization/app.py index bf4e97b..c7b4c50 100644 --- a/tests/analytical_visualization/app.py +++ b/tests/analytical_visualization/app.py @@ -521,6 +521,9 @@ with tab_layout: } st.session_state["ffn_scope_label"] = \ _pl_ffn_map[_pl_best.ffn_shard_scope] + # Persist the chosen scope so subsequent layout renders filter + # stage tables (attn/ffn/full). + st.session_state["_pl_active_scope"] = _pl_scope st.success( f"Loaded latency-optimal {_pl_lbl} config: CP={_pl_best.cp} " f"TP={_pl_best.tp} PP={_pl_best.pp} DP={_pl_best.dp} → " @@ -529,6 +532,14 @@ with tab_layout: ) st.rerun() + # Determine the effective scope for filtering the tables below. Default + # to "full" so a fresh page load / sidebar-driven config shows everything. + _pl_active_scope = st.session_state.get("_pl_active_scope", "full") + _pl_show_attn = _pl_active_scope in ("attn", "full") + _pl_show_ffn = _pl_active_scope in ("ffn", "full") + _pl_active_label = _pl_scope_meta[_pl_active_scope][2] + st.markdown(f"### Layout scope: **{_pl_active_label}**") + st.divider() # Row A: pipeline diagram (color-coded) + per-stage table (formulas). @@ -688,8 +699,10 @@ with tab_layout: f"blue=compute, orange=memory, red=comm, grey=trivial." ) - _render_table(_stages_attn, "Attention") - _render_table(_stages_ffn, "FFN") + if _pl_show_attn: + _render_table(_stages_attn, "Attention") + if _pl_show_ffn: + _render_table(_stages_ffn, "FFN") with st.expander("Symbol glossary (what does T_q, d_h, div... mean?)", expanded=False):