Skip to content

[Engine] helper cards given by --expert-cache-device are placement: no auto layer split, no split reorder (v0.2.23 rebase) - #7434

Open
fri-K wants to merge 1 commit into
Niko1221:mainfrom
gospogied:f-helper-placement-0223
Open

fri-K wants to merge 1 commit into
Niko1221:mainfrom
gospogied:f-helper-placement-0223

Conversation

@fri-K

@fri-K fri-K commented Nov 28, 2026

Copy link
Copy Markdown

Problem and result
A multi-helper config — gpu: [0, 1, 2] with --expert-cache-device1 auto --expert-cache-device2 auto (RX 9060 XT primary + two RX 6600 expert-cache tiers; gfx1200 + gfx1032 mixed) — is placement, but serve does not know it.

Before (still true at v0.2.23): --layer-split auto is injected anyway and the GPU order is rewritten so the fastest card (the gfx1200 primary) lands in the LAST split stage. On the board this runs on, the first such request hard-crashed the host twice (GPU reset, power-cycle needed).
After: helper placement is honored end to end — no injection, no reorder, correct announce line — and check_placement() fails at config-check on contradictory placement (helper args beside an explicit layer_split, --peer-device outside the visible set). Split-only and peer-only configs render byte-identical to before.

Repro on pristine v0.2.23 (release-prep commit 4560d03):
cfg = {"gpu": [0,1,2], "backend": "hip", "args": ["--expert-cache-device1", "auto", "--expert-cache-device2", "auto"]}
terminal/serve/server_parts/engines.py:783 (v0.2.23): layer_split_of(cfg) = True -> serve injects --layer-split auto + reorders
branch: layer_split_of(cfg) = False | helper_cache_of(cfg) = True

This supersedes #6324 (closed): the repo moved serve/ to terminal/serve/ and server.py into server_parts/ at 0.2.16; this branch is the same patch rebased onto the 0.2.23 release tag, cherry-pick applied cleanly (3 files, +134/-6). Upstream has since added --peer-device to layer_split_of, but the expert-cache args are still ungated.

Approach
One gate shared by both injection points, in #665's style: helper_cache_of() recognizes every helper arg (--peer-device, --expert-cache-device1..3); layer_split_of() and ordered_gpus() consult it; check_placement() turns silent misplacement into a config-check error.
serve never sets STRATA_PRIMARY_DEVICE, so visible order IS placement — the reorder actively breaks it. No engine-side changes.

Validation
Passed

  • Placement unit tests (11 cases, terminal/serve/test_placement_helpers.py): on PRISTINE v0.2.23 → 4 failures + 7 errors (transcript); on this branch → 11 OK.
  • Production cutover on the mixed gfx1200 + 2xgfx1032 board (anonymized): serve 0.2.23 from this branch + engine 0.1.70 source build (CMAKE_HIP_ARCHITECTURES=gfx1032;gfx1200), ctx 262144, MTP on.
  • Live engine args after start: --expert-cache-device1/--expert-cache-device2 present, --layer-split absent; announce line "[strata] GPUs [0, 1, 2]: the later card(s) serve as helper expert caches (--expert-cache-deviceN); no layer split".
  • Battery on a fresh engine start (same protocol as the 0.2.16-era baseline): deep-prompt markers decode +8% / +12% / +37% / +19% at 120K/150K/180K/210K tokens, marker prefill +7.5..9%, coding decode +1..6%, ladder 44K/90K and conversation ≈ parity; 0 memory errors, guards silent, no swap.
  • Split-only and peer-only regressions: unchanged behavior (unit tests).
    Failed
  • none.
    Not run
  • CUDA / SYCL / Metal / Windows — no such hardware here; the serve gate is backend-agnostic but only HIP paths were exercised. Engine CI matrix — this PR touches no engine build files.

Limits
Single host, single model family. Staged layer-split across gfx1200+gfx1032 stays dangerous on this board — this change makes serve stop silently creating it; it does not make the split itself safe. check_placement() rejects helper+explicit-split rather than reconciling it — stricter than a merge, chosen because the merge already proved fatal here.

… reorder (Niko1221#665, Niko1221#1352)

Niko1221#665 made --peer-device suppress the automatic layer split; the native multi-helper
args --expert-cache-device1..3 were left out, so a multi-GPU helper-cache config got
"--layer-split auto" injected AND the Niko1221#1352 speed reorder applied on top.  On a
mixed-family board (RX 9060 XT primary + 2x RX 6600 expert-cache helpers) that silently
demotes the fastest card to the LAST split stage: the first request then staged a split
across families which hard-crashed that host twice (GPU reset, no recovery).  Helper
mode must never be silently converted into a split.

helper_cache_of() covers every helper arg and check_placement() rejects helper placement
beside an explicit "layer_split" and a --peer-device outside the visible set, at config
check; they live in server_parts/engines.py beside layer_split_of.  ordered_gpus() keeps
the config order when helpers are in play and the startup announce names helper caches
instead of the peer tier.  Plain split and peer configs render exactly as before.

terminal/serve/test_placement_helpers.py: 11 cases incl. the no-reorder regression.  On
unpatched main the suite fails 4+7 against these cases; the full terminal/ discovery
(1947 tests incl. these) shows one pre-existing failure (test_telemetry_adl Windows ADL
reader choice, identical on unpatched main) and nothing else.
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant