Repository navigation
split ceiling: the M-split decision as arithmetic, and the hybrid route's reason not to take it (refs #754) - #1274
Conversation
…te's reason not to take it (refs #754) engine#754 has been blocked on one number, and that number has been written down three times with three different answers because the iGPU side moved under it (40.7 TFLOP/s pre-reset, 12.1-12.4 with the engine#782 regression, ~44 after the pinned kernel set stopped using the slow tiles). A ceiling quoted without the rates it came from is either stale or unfalsifiable, so this makes the formula executable: tools/split_ceiling.py --gpu-ms <iGPU ms for M rows> --npu-tile-ms <NPU ms per 256-row tile> --rows M [--gemm-share <split-able share of prefill device time>] It returns the optimum integer NPU tile count, the per-GEMM ceiling and (with --gemm-share) the end-to-end factor. The optimum is a scan over tile counts, not a rounded continuous one: at 12.4 TFLOP/s the continuous optimum is 6.8 tiles and 7 is *worse* than 6, because the NPU becomes the critical path -- the test pins that. Measured decision, on this box: at a 30:1 row-cost asymmetry (iGPU 18.4 ms against our 8.61 ms per tile at M=16384) a perfect concurrent split is worth 1.032x per GEMM and, with attention at 47.7 % of pp16384 device time, 1.017x end to end. On the engine#782 build it was 1.103x / 1.052x against a 3.3x regression that has since been fixed. So the split is not built: the feature would buy ~1.7 % of prefill on the iGPU we now ship. docs/hybrid.md says the other half, which is a property of the route rather than of the kernels: the handoff here is sequential (provider, restore, decoder), so a prefix split costs provider(m) + decoder(M-m) and the optimum is m=0 -- the split is only meaningful in the concurrent shape, which needs the one weight layout and the buffer bridge that docs/hetero-prefill.md already lists. Refs, not closes: #754's build condition is unmet at 1.03x, and the issue should be closed as 'bar recorded' by whoever owns that call, not by this PR. tests/split_ceiling_test.py pins all three recorded iGPU states plus the refusals (a zero rate, a share outside [0,1], a ceiling below 1) so a change to the arithmetic cannot quietly make the split look worth building. No model, no device, stdlib only.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 217badab — the tool reproduces all three rows of the new table exactly when I run it on the page's own inputs, the test is green, and the arithmetic is the same arithmetic #1270 derived by hand this evening. Two citations in the caveat paragraph point at numbers that are not in the record; both are one-line fixes.
The three rows, recomputed with the shipped tool (--gemm-share 0.523, --rows 16384 --tile 256, NPU 8.61 ms):
--gpu-ms 20.03 -> 2 tiles (3.1 %) -> 19.40 ms ceiling 1.032x e2e 1.017x [table: 1.032x / 2 of 64 / 1.017x]
--gpu-ms 65.71 -> 6 tiles (9.4 %) -> 59.55 ms ceiling 1.103x e2e 1.052x [table: 1.103x / 6 of 64 / 1.052x]
--gpu-ms 18.4 -> 2 tiles (3.1 %) -> 17.82 ms ceiling 1.032x e2e 1.017x [table: 1.032x / 2 of 64 / 1.017x]
and by hand, independently of the tool: g = 20.03/64 = 0.313, n* = 20.03/(8.61+0.313) = 2.24 → 2 tiles → iGPU 62 × 0.313 = 19.40, max(17.22, 19.40) = 19.40, 20.03/19.40 = 1.032 ✔; g = 1.0267 → n* = 6.8, and the integer optimum is 6 not 7 (7 tiles = 60.27 ms is worse than 59.55) which is what the test's "integer-tile optimum is 6, not the rounded 7" row pins ✔. python3 tests/split_ceiling_test.py → split_ceiling: PASS, --self-test PASS, refusals (gpu_ms=0, negative tile, rows=0, share>1, ceiling<1) all fire. This is also the same answer the #1270 review derived from the page's per-256-row cost (1.03x at 2 groups, 1.12x at the 2.15 ms bar), from the other direction.
Registration and hygiene: CMakeLists.txt adds split_ceiling next to the other stdlib-only tests with a comment naming what it pins; tools/copyright.py --check rc 0; docs and tool in one PR; no model, no device, no network.
Two nits, both in the same "honest caveats" sentence, and both are citations rather than arithmetic:
- "it predicts 1.103x where the split measured 1.134x" —
1.134appears nowhere in the record.docs/hetero-prefill.md's measured split rows are 1.098x (4B up_gate), 1.111x (4B down) and 1.128x (0.6B up_gate), and its own summary sentence says the formula "puts it at m≈14600 and 1.10-1.13x (measured 1.098-1.128x)". Either the 1.134 is a scratch number or a typo for 1.128 — naming the row it came from would make the caveat checkable. - "at M<=2048 … every split measured on this box loses 3-5x" — the page's own words for that regime are "still 0 at M≤2048" and, for a larger NPU share, "loses 2-12x". 3-5x is in neither.
Neither changes the ceiling the page computes, and the page's conclusion (this route offers no split; the bar is on the NPU GEMM) does not rest on them — but a caveat that cites unrecorded figures is the one thing a reader cannot falsify.
… recorded kernel shares (refs #754) (#1287) PR #1274 merged before this paragraph landed on the branch, so it comes as its own change. The 47.7 % attention figure quoted there is Qwen3-4B's; using each compared model's largest measured prefill kernel as the split-able share (EXP-49's captures: 39.8 / 46.2 / 30.8 / 43.8 / 26.2 %) the end-to-end ceiling is 1.008x-1.015x, i.e. at most 1.5 % of prefill everywhere - the number that settles #754 on this box rather than the per-GEMM one. Amdahl over numbers already measured; no device work. Co-authored-by: bong-water-water-bong <[email protected]>
Refs #754 (deliberately not
Fixes: the issue's own build condition is unmet, at 1.03x — see the table).What this PR adds
tools/split_ceiling.py— the M-split decision as executable arithmetic, plusdocs/hybrid.md's half of theanswer (why this route cannot take it) and a test that pins the arithmetic to every iGPU state the page records.
It returns the optimum integer NPU tile count, the per-GEMM ceiling, and with
--gemm-sharethe end-to-endfactor. Inputs are two measurements; nothing is modelled beyond "both engines run to the same finish time",
which is what a concurrent M-split is.
Measured decision
up_gateM=16384end to enduses the measured 47.7 % attention share of this model's pp16384 device time (so 52.3 % is GEMM asplit could touch). On the iGPU the box now ships, a perfect split dispatcher is worth ~1.7 % of prefill; on
the bad build it was ~5 %, against a 3.3x regression that has since been fixed. That is the number #754 is
blocked on, and it is why this PR does not build the split.
Two things the arithmetic caught, both in the test:
is worse than 6 because the NPU becomes the critical path — 60.27 ms against 59.55 ms. A rounded
implementation reports the worse one.
mosaic_bench --mode splitmeasured1.134x on the same pair (the iGPU's time is not exactly proportional to its row count), and it is wrong at
M≤2048 where every measured split loses 3–5x. The test asserts the gap, and the doc says so.
Re-measured for this PR on the release-rc libs (
mosaic_bench, one 9-minute joint hold,amdxdnaerrors 0 → 0):4B
up_gateM=16384 iGPU 73.71 ms / 11.07 TFLOP/s, NPU 10.67 ms/tile / 1.20 TFLOP/s, best split66.08 ms = 1.115x; 4B
down77.97 ms, 10.22 ms/tile, best split 68.74 ms = 1.134x; 0.6Bup_gate12.46 ms vs split 12.39 ms = 1.006x; at M=2048 every shape loses (0.24–0.35x). Those libs carry the
pre-#782 kernel set — which is exactly why the ratio, and not the ceiling, has to be quoted with its build.
The route half
docs/hybrid.mdgains one section: the handoff here is sequential (provider → restore → decoder), so a prefixsplit costs
provider(m) + decoder(M−m)and the optimum ism = 0, i.e.--device hrx. A split is onlymeaningful in the concurrent shape, which needs the one weight layout and the buffer bridge that
docs/hetero-prefill.mdalready lists as the parts worth building.Verification
python3 tools/split_ceiling.py --self-test→ PASS (four recorded points, three refusals).python3 tests/split_ceiling_test.py→ PASS, 16 checks: the three recorded iGPU ceilings, the integer-tileoptimum, the Amdahl shape (all-GEMM = the per-GEMM ceiling, no-GEMM = 1.0, monotone between), the refusals (a zero
rate, a
--gemm-shareoutside [0,1], a ceiling below 1) and the CLI contract (--self-testexit 0,--jsoncarrying
ceilingandend_to_end). It is registered as thesplit_ceilingctest.ctest -R split_ceilingin a configured build dir of this branch → Passed 0.20 s (Test #58: split_ceiling),i.e. the registration, the target name and the test all work through ctest, not just by hand.
ctest -j1on a fullninjaof this branch: not run, and that is a decision rather than anoversight. c31 was the take stick and pi-release's gate chain ran until 15:34 (rule 1 held device work to ≤10 min
tickets, which the measurement above respected); after READY the box stayed at load 52-83, and this branch's build
reached 97 of 166 targets in 38 minutes. I stopped it rather than compete with seven other lanes for cores, and the
PR says so instead of implying a suite row. Nothing in this change is compiled code:
CI buildpassed on this head,and the new test is stdlib-only with no build of its own.
:18097and the owner's serve untouched.Why not
Fixes #754The issue says it should not be built until an NPU prefill GEMM clears a bar, and the bar now has a number:
even at the public target class the end-to-end win is ~1.7 % on the healthy iGPU. Closing it as "bar recorded"
is the right end state, but that call is the owner's/orchestrator's, so this PR delivers the measurement, the
tool and the route rationale and leaves the close to them. Coordination with pi-hrx-sched's HRX half is an
inbound block in
~/briefs/THRX-SCHED-STATE.md(three concrete questions, no device work asked of them).cc @pi-prs