analytical-viz: autosuggest prefers fewer cubes, tries cp_placement=pe

Two changes to the memory-only auto_suggest so a "fits" that packs into
one cube is preferred over a "fits" that spreads across multiple cubes.

Suggestion dataclass gains cubes_used and cp_placement fields.

_score_candidate: for each (CP,TP,PP) triple, try cp_placement="cube"
(historical default: CP spans cubes) and, when CP·TP fits in one cube's
PE count, also cp_placement="pe" (pack CP into intra-cube PEs). Keep
the placement with fewer cubes; break ties toward "cube".

auto_suggest: switch sort key from (pes_used ↑, pp ↑, tp ↑, cp ↑) to
(cubes_used ↑, pes_used ↑, pp ↑, tp ↑, cp ↑). Fewer cubes wins first
because a cube is the physical die-level unit; PE count is the
tiebreaker.

Sidebar caption now also displays cubes_used + cp_placement so the
user can see the packed layout at a glance. Preset-change auto-reset
also applies the picked cp_placement.

Observed effect (verified):
  Qwen 3 8B / 128K decode:  CP=4 TP=2, "pe" → 1 cube, 8 PEs
                             (was 4 cubes with default "cube")
  Llama 3.1 70B / 128K:      CP=4 TP=16, "cube" → 8 cubes (unchanged;
                             TP=16 > 8 PEs/cube, can't pack)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-07-28 16:04:17 -07:00
parent c2b42999d8
commit a7f39ade7e
2 changed files with 48 additions and 13 deletions
+7 -1
View File
@@ -172,12 +172,18 @@ if st.session_state.get("_last_preset") != preset_name:
st.session_state["pp"] = _snap(_default_suggestion.pp, _PP_OPTS)
st.session_state["dp"] = 1
st.session_state["ep"] = 1
# Apply the picked cp_placement so the sidebar reflects the packed
# config (autosuggest may have chosen "pe" packing to minimize cubes).
st.session_state["cp_placement"] = _default_suggestion.cp_placement
st.session_state["_last_preset"] = preset_name
with st.sidebar.expander("Parallelism", expanded=True):
st.caption(
f"Auto-suggest (memory-min): CP={_default_suggestion.cp}, "
f"TP={_default_suggestion.tp}, PP={_default_suggestion.pp}"
f"TP={_default_suggestion.tp}, PP={_default_suggestion.pp} "
f"→ **{_default_suggestion.cubes_used} cube(s)**, "
f"{_default_suggestion.pes_used} PEs "
f"(cp_placement={_default_suggestion.cp_placement})"
)
# Three latency-optimal apply buttons — pick a scope, load the
# latency-min Pareto config into the sidebar sliders.