feat(qwen35): tp2 phase 2a - #870
Conversation
e13cb04 to
10116dc
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10116dc125
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
f67e625 to
9166e00
Compare
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
9166e00 to
e2cc5ee
Compare
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
e2cc5ee to
404bc50
Compare
|
Thanks for putting the Phase 2A path together. The protocol direction looks reasonable, but the PR still needs a smaller, production-verifiable test surface before merge:
The important reduction here is not fewer assertions by itself; it is replacing many local self-checks with a small number of real TP2 gates that exercise the same path users will run. |
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
|
Thanks for the review. All five follow-ups and the Phase 2A merge gates are now resolved: |
Phase 2b ported onto pegainfer-project#870: recurrent/conv state, GDR scratch, and the linear-attention weight surface are allocated and addressed per rank instead of replicated, which is what makes 27B TP2 fit on 2x48 GB cards. - weight_loader: additive stitch/shard loaders (2D row stitch for the fused qkv [q|k|v] segments, 1D element stitch for conv1d channels, bf16/f32 1D shards for dt_bias/A_log) - config: local_linear_* accessors mirroring the full-attn TP style; linear head divisibility fails closed in TensorParallelConfig - weights: per-rank stitched shards for in_proj_qkv/conv1d (head-local slices per segment), row shards for z/b/a, col shard for out_proj, dt_bias/A_log sliced, norm_weight kept replicated (head-shared); loader reserve uses TP-aware estimates - recurrent_state/decode_buffers/prefill_buffers: state and GDR scratch at local value-head/qkv sizes; capacity math derives from local allocation_bytes - batch_decode/prefill: local head counts into the GDR decode/conv/ Triton-AOT prefill chains, gated RMSNorm at local v heads, all-reduce after linear out_proj; batch_decode_full_attention_via_prefill is now TP-local so eager decode routes 27B TP2 group-6 full attention through prefill (was FlashInfer Unsupported group_size: 6) - tp_executor: worker capacity math and per-request state use the rank-local sizes; decode rows still run as a per-request bs=1 loop (batched in a follow-up) Recurrent/conv state is never all-reduced. Signed-off-by: Ziyang Zhang <hafuhafu@qq.com>
Port of the batched eager TP decode step onto pegainfer-project#870's worker structure: decode rows in one command now run as ONE batched forward per step on every rank plus one batched rank-0 sampling pass, instead of a per-request bs=1 loop. - run_decode_batch resolves every decode row's worker state in command order, builds a step-scoped LinearStatePointerTables over the whole batch (from_recurrent_refs(..., bs, ...)), runs one batch_decode_eager_logits forward, then rank 0 snapshots all requested logprob rows before one batched select_batch over per-row params - execute_decode_rows (used by both decode-only and unified steps) calls run_decode_batch once; per-row results fan out in command order - TpRequestState.linear_pointer_tables (capacity-1, decode-only) removed; ensure_prefill_state no longer builds it. The step-scoped table is rebuilt every step, so swap_remove retirement can't stale it Seeded rows keep per-row semantics: select_batch isolates each seeded row into its own single-row philox call keyed on (request seed, step 0), so seeded output stays independent of batch composition. Unseeded rows decorrelate via the per-step command seed, same as the single-GPU batched path. Reference (27B TP2, 2x RTX 4090, eager): 16 concurrent 256-token completions aggregate 24.9 -> 292.3 tok/s; single-request unchanged. Signed-off-by: Ziyang Zhang <hafuhafu@qq.com>
Signed-off-by: Ziyang Zhang <hafuhafu@qq.com>
Description
Part of issue #446 and #694. Follows pr #627 and #450.
This PR completes Qwen3.5 Tensor Parallel Phase 2A (P2A): eager TP2 mixed prefill/decode execution with a strict cross-rank lifecycle and failure contract.
P2A builds on the existing Phase 1 dense TP implementation. It keeps linear-attention/GDR weights and request state replicated; sharding that surface remains P2B.
What Changed
RunUnifiedStepcommand for eager TP mixed prefill and decode.DropAck { existed }handling:MustBeAbsentrequires all ranks to reportfalse;MustExistrequires all ranks to reporttrue;drain -> prune -> publish load -> admission -> planRequestIdalignment:Failure Semantics
Controller-provable structural errors are rejected before dispatch and leave the executor healthy.
After execution is released, worker-local state mismatches, CUDA/NCCL failures, malformed response sets, artifact violations, and lifecycle failures poison the complete TP replica. The scheduler then fails every unresolved request and exits.
Collective or teardown timeout remains process-level fail-stop.
Scope and Non-Goals
This PR does not:
lm_head;Those state-sharding changes belong to P2B.
Validation
Validated in release mode on 2x RTX 3090 (SM86) with real Qwen3.5-4B weights.
14 passed,0 failedmax_batch=641 passed,0 failed2 passed,0 failed0.0260, p990.10810.0267, p990.11670.0228, p990.06891 passed,0 failed-D warnings: passedcargo fmt --all -- --check: passedgit diff --check: passedType of Change
Checklist
docs/conventions/coding-style.md).CLAUDE.md).