Repository navigation
Conversation
…line Take only the deadline-bounded endpoint calls and their tests from ashhart#3293. The hunks for these two files are byte-identical to ashhart#3293 so either change can land first.
Keep explicit residency and probes while allowing callers to omit automatic queue attachment. Cover attachment policy and cleanup through the recording owner.
Give handoff tests independent event values and ordered encoder operations. Retain the dispatch type when recording a reopened compute encoder.
End each producer encoder, post its full-width job epoch, and wait for the host relay before reopening the consumer. Publish valid epochs only after bounded send and arrival phases; terminal releases leave payload epochs invalid. Cover late and stale peer words, failed or expired sends, terminal silence, encoder order and kernel source guards.
Map all seven pair kernels to their production shader and launch records. Add stale-epoch mutation controls and a real GPU handoff loopback under the metal flashnext tp selection.
…g owners Coordinate idle keepalive with request ownership, stop followers before callbacks disappear, and detect terminal failures in the final drain. Bound reciprocal startup and idle peer checks without changing request or step agreement words.
Request and retain the model set in pair mode without attaching it to the queue. Keep single-Mac attachment and test both native inventory paths and cleanup.
TF_TP_LOCAL marks newly encoded jobs submitted after the existing stop and failure checks. Skip the endpoint and peer-readiness clock, and cover a broken endpoint with a full-width job sequence.
Keep host-held timing and add per-kind release-to-post histograms, send time and peer-arrival wait under TF_TP_STATS. Serialize publication with reply snapshots, close partial jobs on failure, and reset at every reply including short replies. Leave the disabled service path without timing clocks or collector locks and preserve GPU work.
Shorten inherited comments and remove measurement history without changing executable statements. Keep the leading fabric prerequisite unchanged; its later comment-only cleanup is separate.
The real relay uses the macOS clock and thread service class. Skip those host probes on other platforms while keeping source, encoding and pure timing checks available.
… runs A paired request left the model unused by any queue: the set is not attached to the engine queue and idle probes stop at the request gate, so macOS unwired the model mid-reply and expert launches stalled on re-wiring. Commit the busy probe through the set on a second queue at the served keepalive interval while the gate is held.
…hange In decode each Mac computes every row's experts and both ranks' branch rows with the exchange's kernels and arguments, then merges them locally: the stream update reads the same values and no exchange job or seam is encoded. Prompt processing, the DeltaNet reduce and the picks are unchanged.
…p by acknowledged agreement In decode each Mac makes both ranks' DeltaNet launches, partials and vocabulary halves with the owning rank's kernels and arguments, sums the partials in rank order and picks locally, so a decode round queues no job and encodes no seam. Rank 0 waits for rank 1's acknowledgement of the previous step before it publishes the next.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
On the pair, a decode round paid one host handoff per split stage: 48 expert exchanges, 36 DeltaNet reduces and the picks, about 0.4 ms each on two M5 Ultra Studios, where one Mac computes a whole layer in about 0.2 ms. With this change each Mac computes the whole decode round itself, using the owning rank's kernels and arguments for each half and the pair's order of sums, so the replies are the ones the pair gives today and a decode round queues no job and encodes no seam. Prompt processing keeps its split. The two Macs stay on the same step through an acknowledged agreement word.
--speed-upon two M5 Ultras (macOS 27.2): warm-up failsPeerSilent; with shared-event handoffs it serves, but drafted replies intermittently drop to 1 to 5 tok/s #3408 (the speed half: the pair against one Mac).b4ee01293. This adds:1c0ab7d57flash next pair: run decode's expert stage on each Mac without an exchange4dc9a23bcflash next pair: run decode whole on each Mac and keep the two in step by acknowledged agreementatc overlap --json: not run yet.Why the tokens do not change:
tp_branchindex every read and write by absolute row. In decode each Mac runs them for every row, writes both ranks' branch rows where the owner's send slot would hold them, and runs the sametp_mergewith the same split.tp_plain: rank 0's partial plus rank 1's, rounded once. Each rank's step runs right after its own in-projection.tp_argmax_partlaunches and the sametp_pickrule;tp_idsas before.Step agreement: rank 0 used to overwrite one control word per step; the per-layer handoffs kept the Macs within a round of each other. Now rank 1 writes the last step it took to a new
STEP_ACKword and rank 0 waits, up to the existing 10 s limit, until that is at most one step behind before it publishes the next step.No new switch.
TF_TP_TRACE,TF_TP_LOCALandTF_TP_STATSsee no decode jobs.Checks on this head
4dc9a23bc.811c38473e, 321 on this head, 0 new.python3 tools/pr_check.py --base 811c38473e: 0 errors, one advisory warning (no Unreleased bullet).zig fmt --check build.zig zig,git diff --check: pass.zig build test-flashnext-pair-host test-flashnext-host test-flashnext-cleanup-host test-flashnext-batch-host test-metal-residency-owners-host test-kernel-contract test-tp -Dcpu=apple_m1 -j4 --summary all: 104/104 steps, 674 passed, 3 skipped.zig build native tf-kernel-contract -Dcpu=apple_m1 -j4 --summary all: 69/69 steps.zig build test test-golden -Dcpu=apple_m1 -j4 --summary all: 868/870 steps; the one failing test iscore.paced_read"aligned spans copy the bytes asked for", which also fails on811c38473e;test-goldenpasses. Most steps were served from the build cache in this run, so the pass count is not quoted.TpPeerSilent, and the control words stay distinct. They fail with the production change neutralised.atc overlap --json; thetools/bench_*.pyscripts (the runs use the sequential driver from Flash Next--speed-upon two M5 Ultras (macOS 27.2): warm-up failsPeerSilent; with shared-event handoffs it serves, but drafted replies intermittently drop to 1 to 5 tok/s #3408's archives); the full Metal numerical suite (no kernel source changes); any chip other than M5 Ultra and M4 Pro.Receipt
Two M5 Ultra Mac Studios, 256 GiB each, macOS 27.2
26B118, one Thunderbolt 5 link, checkpointTensorFold/Qwen3.8-Flash-Next-MLX-6bit-MTPat45032a193a5d4126ba8534822cbaf8fb30b3e368,--no-thinking, temperature 0, one request at a time. 49 requests, replies of at least 32 tokens:b4ee012931c0ab7d574dc9a23bc5d0b9bfe15b4ee01293): the same reply hash and length on 18 of 18 (the exactness set), 49 of 49 with the prompt cache off and 49 of 49 with it on. Drafted equals"draft": falsein every group, rank 1's hashes equal rank 0's on every reply, and eight requests sent at once equal the same eight alone.b4ee01293, both ranks agree on all 147, drafted median 115.2 tok/s (min 105.3), plain median 86.6 (min 83.9), and wired memory stays at 169 to 179 GiB on both Macs for all 415 seconds.TpPeerSilent10 s later (HTTP 500) and the server stays up and stops cleanly; with rank 0 killed, rank 1 reportsTpPeerSilentand exits 12 s later. No process or lock is left. Onb4ee01293the same kill is noticed in about 2 s (TpTransferTimeout), because every layer sent something; here only the step agreement crosses the link in decode, so a dead peer is noticed at the agreement's 10 s limit.Not done, and known gaps
Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.--drafter, no slower than without it, greedy and sampled. Prompt processing is faster than one Mac; decode is about 10% slower.