Skip to content

[Engine] helper cards given by --expert-cache-device are placement: no auto layer split, no split reorder - #6324

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

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

Conversation

@fri-K

@fri-K fri-K commented Nov 19, 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 did not know it. #665 made --peer-device suppress the automatic --layer-split auto injection;
the expert-cache helper args never got the same treatment, and serve also applied the #1352 speed
reorder on top. Before: --layer-split auto was injected anyway and the GPU order rewritten so the
fastest card (the gfx1200 primary) landed in the LAST split stage. On this board 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.

cfg = {"gpu": [0,1,2], "backend": "hip",
       "args": ["--expert-cache-device1", "auto", "--expert-cache-device2", "auto"]}
pristine v0.2.15: layer_split_of(cfg) = True    -> serve injects --layer-split auto + reorders
branch:           layer_split_of(cfg) = False   | helper_cache_of(cfg) = True

Related discussion

#665 — the peer-vs-split gate this extends to the native multi-helper args; #1352/#1576 — the reorder
that misfires here (it assumes split semantics; helper configs are not splits). Bugfix, no behavior
change for non-helper configs, so no prior scope agreement sought.

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. The board this was validated on mixes gfx1200 and gfx1032; a docs-only note about wheel /
lib_dirs ordering on such mixed boards may follow separately.

Validation

Environment for everything below: one mixed-family production server — Xeon E5-2697 v3, 64 GiB RAM,
RX 9060 XT (gfx1200, x16 Gen5) + 2x RX 6600 (gfx1032); Python 3.12 venv, TheRock 7.13.0a20260515
wheels (core + devel + gfx103X_all), no system ROCm. Engines 0.1.60 and 0.1.62 built from this tree with
-DCMAKE_HIP_ARCHITECTURES="gfx1032;gfx1200", native MMQ (build flags + binary sha attached). Model:
Qwen3.8-Flash-Next IQ3_XXS, 262144 ctx, KV int8 / resident 32768, MTP.

Passed:

  • Full stack running in production since 2026-11-19 on the current main layout itself
    (branch rebased at 58ee32277, engine built from this tree's engine/ dir — 0.1.62,
    gfx1032;gfx1200): launched engine cmdline shows --expert-cache-device1 auto --expert-cache-device2 auto and no --layer-split despite both helper cards;
    full ladder 4k → 211,427-token markers (all 3/3) + 30-min soak passed, CE 0, VmSwap 0.
  • terminal/serve/test_placement_helpers.py (new, 11 cases) against pristine current main:
    Ran 11 tests ... FAILED (failures=4, errors=7) — this is the reproduction; same suite on the
    branch: OK.
  • Full terminal/ discovery on the branch (cd terminal && python -m unittest discover -s . -p "test_*.py"):
    Ran 1947 tests — the only failure is serve.test_telemetry_adl.OnlyTheMonitor.test_reader_choice
    (a Windows ADL reader-choice test under Linux), identical on unpatched main on this host;
    88 skips are platform-conditional. Everything else passes, including test_split,
    test_split_fallback and test_server.
  • Live service on the branch (patched serve + 0.1.60 engine): r4k 6.3 s, 16k 11.8 s, 44k 26.3 s,
    90k 57.9 s; marker requests at 120,875 / 151,059 / 181,243 / 211,427 prompt-tokens all answered
    finish=stop in 89.1 / 102.9 / 131.3 / 150.0 s — 20-25 % faster than the 0.1.59 engine running
    weeks at the same settings (112.5 / 140.2 / 164.4 / 184.5 s); CE delta 0 and major-fault delta 0 at
    every stage; effective engine args captured from /proc contain no --layer-split.
  • The same serve patch carried weeks of production on the 0.1.59 engine before the bump: 524 + 189
    soak requests, zero exceptions, zero guard trips, decode expert-cache hit 90.0 %, KV streaming
    99.5 % VRAM. (Soak flags with exec-test failures were classified by direct reply inspection as a
    model-side artifact — the model sometimes returns the prompt's code skeleton — identical rate on
    the unpatched engine.)

Failed: none observed on the branch. (The pristine 4 failures + 7 errors are the expected
reproduction, listed above.)

Not run: CUDA / SYCL / Metal / Windows — no such hardware here; the serve gate is backend-agnostic
but only HIP paths were exercised. Subprocess integration test for placement — the new cases are
unit-level against serve's arg rendering. 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.
---
@fri-K

fri-K commented Nov 19, 2026

Copy link
Copy Markdown
Author

Repro config + build provenance (text form — API asset upload is not available to outside contributors)

With the config below (paths replaced by placeholders, nothing else changed), pristine main renders --layer-split auto into the engine args and reorders gpu [0,1,2] to [1,2,0] (the gfx1200 primary lands in the last split stage); on this branch the order is kept and nothing is injected. The 11 unit cases in terminal/serve/test_placement_helpers.py fail on pristine main (4F+7E — that is the reproduction) and pass on the branch.

{
  "backend": "hip",
  "gpu": [0, 1, 2],
  "gpus_asked": [0, 1, 2],
  "port": 18018,
  "host": "0.0.0.0",
  "exe": "<dual-arch strata 0.1.62 built from this tree's engine/ dir>",
  "cwd": "<repo>/terminal",
  "lib_dirs": [
    "<venv site-packages>/_rocm_sdk_hybrid_all/lib",
    "<venv site-packages>/_rocm_sdk_devel/lib"
  ],
  "args": [
    "--pack", "<packs>/iq3_xxs",
    "--native", "<models>/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf",
    "--ple-gguf", "<models>/IQ3_XXS/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf",
    "--expert-profile", "<data>/expert-profile.bin",
    "--expert-cache", "auto",
    "--prefill", "auto",
    "--spec", "4",
    "--spec-min-p", "0.5",
    "--mtp", "<mtp>/rt",
    "--max-context", "262144",
    "--kv", "int8",
    "--kv-resident", "32768",
    "--expert-cache-device1", "auto",
    "--expert-cache-device2", "auto"
  ]
}

Engine build behind the production-validation row (reproducible):

cmake 3.28.3 + Ninja, Release; clang from TheRock 7.13.0a20260515 devel wheel (no system ROCm)
-DCMAKE_HIP_ARCHITECTURES="gfx1032;gfx1200" -DSTRATA_GEOMETRY=flash_next -DSTRATA_ENABLE_HIP=ON
CUDA/SYCL/tests OFF; MMQ is default-on in 0.1.62 (no cmake toggle anymore)
sha256 strata (0.1.62) = 0b267928859fb70ae2f5406550ffd45051f925110fa22ae2a91a47df1ceff3d1

The first lib_dirs entry (_rocm_sdk_hybrid_all, a symlink union of the devel wheel and the gfx103X_all Tensile data) is what makes the gfx1200 primary and both gfx1032 helpers work in one process — the gfx1200-only devel TensileLibrary.dat hard-refuses RDNA2 at GEMM init.

@fri-K

fri-K commented Nov 28, 2026

Copy link
Copy Markdown
Author

Superseded by #7434: the same patch rebased onto the v0.2.23 release tag (this branch predates the terminal/serve/ restructure and had drifted). Fresh proof pair recorded on v0.2.23 itself: pristine tag -> 4 failures + 7 errors in the placement suite; patched branch -> 11 OK, and layer_split_of on the expert-cache repro still returns True on v0.2.23, so the gap is still live upstream.

@fri-K fri-K closed this Nov 28, 2026
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