Skip to content

feat: serving-role worker-flip mechanism + disaggregated peer CLI (B3b1) - #191

Merged
inureyes merged 1 commit into
mainfrom
feature/issue-126-b3b1-worker-flip-mechanism
Jun 9, 2026
Merged

inureyes merged 1 commit into
mainfrom
feature/issue-126-b3b1-worker-flip-mechanism

Conversation

@inureyes

@inureyes inureyes commented Jun 9, 2026

Copy link
Copy Markdown
Member

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/StreamBridge client path + the real two-process E2E.

Changes

  • --prefill-peers / --decode-peers (both binaries → ServerStartupInput): comma-delimited SocketAddr peer 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 real TcpTransport, and drive the B3a role loop. 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).

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 a 127.0.0.1: address), and drives its role loop to a clean return on a closed intake. Single-threaded and fast — a !Send scheduler can't cross a std::thread and serve_role builds its own runtime, so the two-context handoff is B3b2's real two-process spawn.
  • The B3a (serving_role_loop_parity) and B2b/B2c (serving_handoff_parity) real-model parity tests still pass unchanged (4/4 in the module).
  • Gate: cold clippy -D warnings --all-targets both feature sets (metal,accelerate and +test-utils), fmt, lib unit tests (3081 passed).

Part of #126.

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.
@inureyes
inureyes merged commit 3ef37a6 into main Jun 9, 2026
4 checks passed
@inureyes
inureyes deleted the feature/issue-126-b3b1-worker-flip-mechanism branch June 9, 2026 12:04
@inureyes inureyes self-assigned this Jun 10, 2026
@inureyes inureyes added status:done Completed type:enhancement New features, capabilities, or significant additions priority:medium Medium priority labels Jun 10, 2026
@inureyes inureyes added this to the 0.2 milestone Jun 21, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:medium Medium priority status:done Completed type:enhancement New features, capabilities, or significant additions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant