Repository navigation
feat: serving-role worker-flip mechanism + disaggregated peer CLI (B3b1) - #191
Merged
Merged
Conversation
Add the worker-flip mechanism that drives a disaggregated serving role loop on a real TCP transport, plus the peer-list CLI for the two-process topology. Foundation for B3b's productionized two-process serving. - --prefill-peers / --decode-peers (both binaries) carry the handoff peer addresses to ServerStartupInput, mirroring --peers. - serve_prefill_role_blocking / serve_decode_role_blocking build a fresh current-thread tokio runtime, bind the node's real TcpTransport, and drive the B3a role loop on it. The role-loop future is !Send (the scheduler owns the per-process MLX pool), so block_on runs it on the current thread while the Send transport accept loop runs on the same runtime. An optional ready channel reports the bound listener address so a caller that bound an ephemeral port can wire it as a peer (the worker passes None). The model-worker non-hybrid branch stays dormant (still scheduler.run(), so a single node serves normally); the live worker flip plus the networked request intake and result routing land in B3b2 with the Router and StreamBridge, which supply the client-facing path a live role loop needs. Additive only. Verified: serve_*_role_blocking bind a real localhost listener and drive their role loop to a clean return on a closed intake (single-threaded, fast); the B3a and B2b/B2c real-model parity tests still pass unchanged. Part of #126.
be-free-snowboy
pushed a commit
to freestylejs/snowbrain-mlxcel
that referenced
this pull request
Oct 27, 2026
…b1) (lablup#191) Add the worker-flip mechanism that drives a disaggregated serving role loop on a real TCP transport, plus the peer-list CLI for the two-process topology. Foundation for B3b's productionized two-process serving. - --prefill-peers / --decode-peers (both binaries) carry the handoff peer addresses to ServerStartupInput, mirroring --peers. - serve_prefill_role_blocking / serve_decode_role_blocking build a fresh current-thread tokio runtime, bind the node's real TcpTransport, and drive the B3a role loop on it. The role-loop future is !Send (the scheduler owns the per-process MLX pool), so block_on runs it on the current thread while the Send transport accept loop runs on the same runtime. An optional ready channel reports the bound listener address so a caller that bound an ephemeral port can wire it as a peer (the worker passes None). The model-worker non-hybrid branch stays dormant (still scheduler.run(), so a single node serves normally); the live worker flip plus the networked request intake and result routing land in B3b2 with the Router and StreamBridge, which supply the client-facing path a live role loop needs. Additive only. Verified: serve_*_role_blocking bind a real localhost listener and drive their role loop to a clean return on a closed intake (single-threaded, fast); the B3a and B2b/B2c real-model parity tests still pass unchanged. Part of lablup#126.
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.
Summary
Epic #116 step #126 B3b1 (foundation, foundation-first per the B3b plan). Adds the worker-flip mechanism that drives a disaggregated serving role loop on a real TCP transport, and the peer-list CLI for the two-process topology.
B3a proved the role loops over a real localhost transport in-process. B3b1 adds the glue a model worker needs to run a role loop on its own runtime, plus the CLI surface; B3b2 wires the live worker flip + the
RequestRouter/StreamBridgeclient path + the real two-process E2E.Changes
--prefill-peers/--decode-peers(both binaries →ServerStartupInput): comma-delimitedSocketAddrpeer lists for the disaggregated topology, mirroring--peers.serve_prefill_role_blocking/serve_decode_role_blocking(coordinator.rs): build a fresh current-thread tokio runtime, bind the node's realTcpTransport, and drive the B3a role loop. The role-loop future is!Send(the scheduler owns the per-process MLX pool), soblock_onruns it on the current thread while theSendtransport accept loop runs on the same runtime. An optional ready channel reports the bound listener address (so a caller that bound an ephemeral port can wire it as a peer; the worker passesNone).Scope (safe-dormant)
The model-worker non-hybrid branch stays dormant (
scheduler.run(), so a single node serves normally, no broken client path). The live worker flip + the networked request intake + result routing land in B3b2 with the Router/StreamBridge, which supply the client-facing path a live role loop needs. Additive only; no existing logic changed.Verification
serve_*_role_blocking_binds_then_returns_on_closed_intake(#[ignore]): each driver builds its runtime, binds a real localhost listener (reports a127.0.0.1:address), and drives its role loop to a clean return on a closed intake. Single-threaded and fast — a!Sendscheduler can't cross astd::threadandserve_rolebuilds its own runtime, so the two-context handoff is B3b2's real two-process spawn.serving_role_loop_parity) and B2b/B2c (serving_handoff_parity) real-model parity tests still pass unchanged (4/4 in the module).-D warnings --all-targetsboth feature sets (metal,accelerateand+test-utils), fmt, lib unit tests (3081 passed).Part of #126.