Repository navigation
Conversation
Rank 0 plans every admission and round and sends each admission (with the slot and resume point it chose), round, completion and drop to rank 1 over one TCP connection (port published through the rendezvous store); rank 1 runs that plan. Before each admission and round both ranks confirm the plan in one small all-gather, and both refuse a step whose plans differ (OutOfStep: its requests fail, serving goes on, neither rank waits on the other). A stream rank 0 ended alone is named in the next round. Sampling over the split vocabulary per stream (choose_gathered_streams, tp_sample_rows, _picks_tp). A stream decoding alone replays the one-stream CUDA graphs (State.copy_from into the graphs' slot), on one GPU too. Structured output under --tp 2 --parallel is refused with a 400 before generating.
0b40c8e to
c0aaeff
Compare
|
Thank you, this is excellent work, and the evidence is exactly what we asked for: the rank 0 plan with a checked round on both ranks, 180/180 replies equal to their solo runs, and hang-ups that leave neither rank waiting. One thing on our side: 0.6.0 reworked Flash Next's CUDA rounds since 0.5.0 (shared DeltaNet and attention launches, prompt passes inside rounds, caches that grow with use, and #124's prompt states kept one token early), so your change needs porting onto that before it can run. It's first in line for 0.6.1: we'll port it keeping your commit and authorship, run it on two Sparks, and post the numbers here. If anything in the port changes your design, we'll say what and why. |
|
Thanks. It's ported onto 0.6.1 and the host checks pass (192). Our single-Spark run found one mismatch in the port: a greedy reply with the int8 KV cache changed at token 22 when a stream went from alone to mixed and back. The released 0.6.0 passes the same schedule, so the bug was ours, and the fixed port now matches serial there. The last step is the two-rank run, which needs a second Spark. We'll post the results here when it's done. |
|
One finding on the 0.6.1 port ( #180 is a fix against Written with AI assistance (Claude Code). |
|
Ran the two-rank side on two Sparks (GB10 x2, TP2 over the direct link): Flash Next MLX 4-bit,
One thing left on two ranks: a lone request on |
|
Thanks for the two-rank run. It found a bug in #180. On two ranks, rank 0 plans on The lone-request gap on Follow-up on #180: Written with AI assistance (Claude Code). |
|
Ran Setup: 2x GB10 (driver 580.173.02), direct 200G RoCE link (NCCL over IB/RoCE v2), NGC Your bench,
With bf16 KV ( Exactness, by One thing to look at: a single request is 5-10% slower under Extra checks (a small script beside the bench, same token-id comparison), 13/13 on int8 and 13/13 on bf16:
Neither rank logged an error, |
|
see #180 (comment) |
|
Thank you, @BHCC2025. We adapted parts of the scheduler to fit main, and our follow-up commits coordinate prompt pieces, growing caches, fork plans and readiness across the two ranks. We tested it with #180 and #219 on two DGX Sparks: drafted replies matched one-token decoding in all 18 checked cells, 9 resumed conversations matched fresh ones, and 8 truly concurrent requests each matched its solo run. This also answers #123. Thanks for building it. |
|
@ashhart, here are the Flash Next numbers on the released 0.6.4 that you asked for: two Sparks (TP2) and one Spark (TP1), TP4: Flash Next accepts Setup
Every reply is exactOn
Aggregate tok/s
MethodSame checkpoint, same settings and the same bench in every column; each configuration was started fresh and ran its three repetitions in one session. Raw bench JSONs, the pipeline and the logs are available if useful. |
Follows up #123. Flash Next with
--tp 2served one request at a time and refused--parallel. This lets both ranks share each round between several requests. Measured with yourtools/bench_concurrent.py, 8 users get 2.4-3.4x the total throughput and every reply keeps its solo run's token ids. A single request under--parallelgives up 2-4%, which we left as is (details below).What changes
TCP_NODELAY, and its ephemeral port on the--masteraddress is published through the rendezvous store. An admission carries the slot rank 0 chose and the kept prompt end it resumes from, and rank 1 takes exactly those instead of choosing.OutOfStepat the same point, before any of that step's collectives. The requests in that step fail with the error and serving goes on. Checking over the socket alone would have left rank 0 inside NCCL, which has no timeout, if rank 1 stopped. At startup both ranks must also agree on--parallel, beside the settings already checked.choose_gathered_streamspicks every stream's tokens from the step's gathered candidates with one read-back. A rule wider than the gathered candidates goes throughtp_sample_rows, and drafts do the same (_picks_tp).Stateis one of the slots. A stream left decoding alone moves into it withState.copy_from, which copies in place and keeps the captured addresses. This helps one GPU as well.indexed_stream_geometry(world=...). The graphs' buffers are counted as one more stream, which is generous.--tp 2 --parallelis refused with an HTTP 400 before anything is generated. The message says why and what to do instead, and the startup line says so too. Images were already refused because Flash Next on CUDA is text-only. One GPU, and two ranks without--parallel, are unchanged.The checks you listed
followruns rank 0's ops in order, with rank 0's slot and resume point.test_tp_rank_1_takes_rank_0s_slot_and_resume_point_or_both_refuse_the_admissionandtest_tp_ranks_planning_a_different_round_both_refuse_it_and_serve_onput rank 1 out of step on purpose: both ranks refuse that step, the request getsOutOfStep, the next request is exact, and every slot on rank 1 is free at the end"draft": falserun and its solo run by token ids at 1, 2, 4 and 8 userstest_tp_every_reply_equals_its_serial_run_and_its_solo_run_at_1_2_4_8_users, greedy and 7 sampling rules mixed; on two Sparks, belowtest_tp_a_resumed_prompt_equals_the_same_prompt_fresh(same prompt resumed from a kept slot, fresh on a new decoder, and serial); on two Sparks, belowtest_tp_a_client_leaving_in_prefill_or_decode_leaves_neither_rank_hangingthrough the realScheduler, andtest_tp_a_stream_rank_0_ends_at_its_first_token_..., which failed with "out of step" before the round-message change above; both assert every slot free on rank 1 at the endtest_an_engine_refusing_structured_output_says_why_before_generating; on two Sparks, belowEvidence
Measured with your concurrency bench,
tools/bench_concurrent.py, as docs/recipes/README.md describes:--levels 1,2,4,8 --alone --serial --reps 3(256 tokens,ignore_eos), unchanged from 0.5.0. Setup: two DGX Sparks, Qwen3.8 Flash Next MLX 4-bit,--tp 2 --context 65536, int8 KV. We compared 0.5.0 without--parallelagainst this branch with--parallel 8. Figures are aggregate tok/s, 0.5.0 → this PR, medians of 3:The tool's own checks passed in every cell on both versions. Each concurrent reply had the same token ids as its solo run: 45/45 in each of the 4 cells, 180 in all. Each solo run matched
"draft": false.A single request is 2-4% slower than 0.5.0 when the server runs with
--parallel, going through the lone-stream path: 104.9 against 107.1 tok/s for code greedy, and 80.7 against 84.0 for chat sampled. We did not try to close that gap in this PR. Our own 512-token greedy run agrees, at about 107.5 against 111 tok/s. Serving without--parallelis unchanged. Happy to look into it separately if it matters to you. On one Spark, a lone stream ran at 81.4 tok/s against 81.9 before, and two streams ran 19% faster.Our own end-to-end checks on the two Sparks, beside your bench. Each reply was compared by token ids, using the
token_shaevery reply carries intensorfold, with the same request's"draft": falsereply on the same server. Its text was also compared with the serial replies recorded on unmodified 0.5.0. The script isexact3.py; we can add it undertools/if that helps your run.top_k20 and 0, mixed): 15/15 equal to serial by token ids, 15/15 equal to the solo run, and 15/15 equal to 0.5.0's text.exact2.py), 16 cases: greedy,top_k20/0/50,min_p,ignore_eos, stop strings, a 2K-token reply and a ~20K-token prompt. They were run alone, all 16 at once (more than the slots), staggered, mixed with hang-ups and invalid requests, and at once again. All 80 replies and the 4 multi-turn conversations were identical.response_format, streamed or not, andguided_regexgave an HTTP 400 with the reason, in under 10 ms. An image gave a 400 too.Checks
tests/cuda/test_flashnext_tp_multi.pyis new. It runs two ranks in two threads, astest_flashnext_tp.pydoes, with the same fakes.tests/test_cuda_response_format.pyandtests/test_cuda_server*.pygive 342 passed, 18 skipped. The skips are the xgrammar cases, which aren't installed in our container.ruff checkadds no findings on the changed files, compared withmain.--parallel. One more thing: a failure inside a step on one rank only, such as running out of memory on one Spark mid-prefill, still leaves the other rank waiting in NCCL, as it does on the serial two-rank path today.We're happy to rework any of it, for example sending the plan through the store or a collective instead of the socket, if you'd rather.