Repository navigation
Conversation
|
Thanks @jschmied. Logits byte-equal to the single engine at two stages and over the host loop is the exactness half of the #2005 gate. With no stage built, As our 13:15 note on #2005 says, engine stages wait until a placement shows a gain, with its speed beside the best single machine that can hold it, so this stays open until then. Three things for the stage path meanwhile:
On gate 2: across backends, we'd read "tokens equal per placement" as you do, with one addition. That placement's tokens should agree with each single machine's except where the top two are near-tied, with every difference listed with its margin. |
|
Thanks @ashhart. On
One addition you didn't ask for: a stage takes no Neural Engine share, since
On gate 2, understood: near-ties excepted, with every difference listed with its margin. |
|
Thanks @jschmied. |
19350ca to
c6290d9
Compare
|
Thanks @ashhart. Rebased onto main (c5a0448): the branch is now just its two commits, f45beeb (the stage binding) and c6290d9 (
|
|
@jschmied thanks for the rebase: two commits on main, main's As agreed, it stays open until a placement shows a gain over the best single machine that can hold the 27B. When that comes, it'll need one more rebase (
We'll write the CHANGELOG line at landing. |
, ashhart#2464, ashhart#2375, ashhart#2634) and adds row 29, DSpine (ashhart#2633) Rebased onto main after ashhart#2760's row 28 (Scale index), which stays as on main. DSpine is row 29 with ashhart#2633's final GB10 ranges: agent 2-20 % faster, chat and code 10-19 % slower.
…g of the shared driver (RFC ashhart#2005 v1) native/qwen27_stage.zig binds Driver(B) for Metal: the boundary is h and r as bf16 planes of 5120, the same meaning as CUDA's (the stream before the add, and the pending block output). A stage loads only its own layers' projections (Model.loadStage), its forward runs layers [first, end) and hands the boundary through the host at the range's edges, and its keeps touch only those layers. A window a stream has not reported when another round runs is kept whole, and a later report of fewer rows is refused by name (v1). Gate 1, two stages on one Mac (layers 0:32 and 32:64 over loopback): every logits row of tf-qwen27-stage's scenario is byte-equal to the single engine's, across prompt chunks, two streams and drafted windows.
…t Macs and for the Neural Engine check too Other stages' layers hold no tensors, but laneOrder walked every layer on a Mac with tensor units and uniformMlp walked every layer for the Neural Engine check, so a stage on an M5 would read them. Both now walk Weights.mine(), the stage's own layers. A stage also takes no Neural Engine share: the share builds fp16 copies for every layer, its own and the others'. qwen27's test block now runs gpu_weights' tests, which no test step reached before. Refs ashhart#2005.
…ge refuses Lead.pipe by name ashhart#2579 gave fabric/stage's driver Lead.pipe, which asks the binding for Held, hold, unhold, issue and complete. A Metal stage runs one round at a time in v1, so hold returns MetalStagePipe: pipe fails at its first flight, before the inbox starts or any plan is sent. issue and complete return the same error and are not reached. Refs ashhart#2005.
c6290d9 to
c5cb7e0
Compare
This head: c5cb7e0, rebased onto main e6094de on the user's request
decode_round.zig,forward.zig,gpu_weights.zigandmodel.zig. I kept main's change and ours in each:tail_from, keys-only last layer). A stage does not run it:prompt_tail.beginsets no tail on a stage, because the tail's facts read the last layer, which other stages hold asunowned. A stage's rows go on whole.loadMtp,layerAt,norm/logits).Process.getforTF_PROMPT_ROWS/TF_ANE_COLUMNS.stage == nullsits beside the!c.moe()share check.forward.Spanis nowStageSpan, because main has a private rowSpan.forward.holds(span, index)replaces the twoownscopies, which keepsdecode_round.zigat 599 lines.Held/hold/unhold/issue/complete(Lead.pipe, rounds in flight). A Metal stage runs one round at a time in v1, soholdrefusesMetalStagePipeat pipe's first flight, before the inbox starts or any plan is sent. No host test for it yet:Engineneeds a Metal device.qwen3_5/cuda_stage.zig.Rerun on c5cb7e0:
test-qwen27 tf-qwen27-stage: 52/52 steps, 201/203 tests. The 2 skips are env-gated MTP tests.TF_STAGE_LAYOUT=0:32,32:64over loopback: both ranks exit 0, and 47 rows (23,342,080 bytes) arecmp-equal to the single engine's.TF_STAGE_LOOP=64:cmp-equal. The single engine's output is byte-equal to the previous rebase's.test-stage: 49/49.test-stage,test-stage-compileand 11test-qwen27-*-hoststeps, 46/46 steps, 93/93 tests.zig fmt --check,git diff --check,pr_check(0 errors, lean 165 vs 165, 0 new).test-qwen27,tf-qwen27-stageandnative(no SDK, no link) has 0 errors.Gate 2 and speed are still open, as agreed. No served path changes: with no stage built,
spanis null and the prompt tail runs as on main. Still to do from ashhart's 11-09 note: a host test forWindowKeptWhole.Seeded, resume and concurrency: gate 1 compares logits bytes, so sampling seeds do not apply. The scenario already covers two streams at once and drafted windows rolled back. No served resume path changes.
No CHANGELOG commit. Proposed CHANGELOG line:
qwen27 Metal: the 27B as one stage of fabric/stage's ring (RFC #2005 v1) (#2375).What this changes
Qwen3.8-27B on Metal can now run as one stage of an RFC #2005 ring, as #2115 does on CUDA.
zig/src/native/qwen27_stage.zigis its binding of #2241'sDriver(B). The driver itself is unchanged. With no ring, nothing on the served path changes.h, the residual stream before the add, and plane 1r, the pending block output. These mean the same as CUDA's planes:tf_q35_normcomputesH = bf16(H + R), and Metal's normbfloat(float(hidden) + float(pending)).forward.Spanruns layers [first, end). A later stage takes h and r through the host before its first layer. Each stage gives its rows on after its last layer, waiting for its command buffer first. Rank 0 then takes the last stage's rows back for the final norm and the head.laneOrderanduniformMlpread only the stage's own layers throughWeights.mine(), and a stage takes no Neural Engine share.Runner.keepskips the others, andkeepDevicerefuses a stage runner by name.Model.loadStageandgpu_weights.load(..., owned_layers)read only the stage's own layers' projections. The other layers' slots carry only their mixer kind. Each 27B stage peaks at 12.8 GB instead of about 19.6 GB for the whole model.Runner.keepnow ends its encoder when it fails part way. The same one-line fix is offered against main on its own in a separate PR.WindowKeptWhole). The scenario's one-row windows and drafted windows, continued in the next round, are unaffected.forward.zig,decode_round.zigandgpu_weights.zigwill need a rebase once those land.Checks on the earlier head (19350ca)
zig build test --summary all: 623/626 steps, 222/227 tests (4 skipped). The one failure isring_test's "a stop after a send that failed mid-payload hangs up…", which is already in the base. It hangs innet.sendAllat 0 % CPU and was stopped after 5 minutes.zig build test-stageon the untouched base 27e4d7e hangs the same way on this M3 Pro, so it isn't this change. The cause is the olderfabric/stage/net.zigon fabric stage: the protocol layer, boot description, round plan, rows layout and keep-alive, with golden bytes for every message (#2005 step 1b, stacked on #2012) #2060's branch: its sockets are blocking, so on macOS a send to a stalled peer never reaches its deadline. Main fixed this in 5d1bf95. With only main'snet.zigswapped into 27e4d7e,test-stagepasses 44/44, and main itself 20/20. This branch inherits the fix when fabric stage: the protocol layer, boot description, round plan, rows layout and keep-alive, with golden bytes for every message (#2005 step 1b, stacked on #2012) #2060 is rebased;zig fmt --checkon the touched files andgit diff --check: clean;zig build test-qwen27: 145/145 (thegpu_weights.zigtests now run in a step; they ran in none before);cmp-equal, 47 rows, 23,342,080 bytes, both ranks exit 0.Receipt
TF_STAGE_LAYOUT=0:32,32:64over a loopback ring. Every logits row oftf-qwen27-stage's scenario (47 rows) is byte-equal (cmp) to the single Metal engine's.TF_STAGE_LOOP=64) is byte-equal too.laneOrderpath that needs tensor units hasn't either.Open question: gate 2 (GB10 + Mac)
boot.checkrequires every rank to report rank 0's version and backend (bootRingpasses one backend for the ring) and identicalshapes. This binding reportsprompt_chunk = 128, the pre-M5 prompt pass, and CUDA's is larger. So a mixed CUDA + Metal ring is refused at boot today. A per-rank backend and agreed shapes need a change inbootorDriver, and that change waits for #2060 and #2241 to land. Across backends the tokens can legitimately differ from either single machine, so I read "tokens equal per placement" there as one placement giving the same tokens on repeat, at any chunking, and across streams. Is that what you meant, @ashhart?Checklist