Repository navigation
[None][perf] Helix CP: MLA V up-projection before the all-to-all, O(prompt/cp) prompt partition, FIFO all-to-all sender fence, Helix test harness fix - #20939
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Prepare the Helix V-projection weight tensorrt_llm/_torch/attention/mla.py, tests/unittest/_torch/attention/multi_gpu/test_mla_helix.py, tests/unittest/_torch/attention/test_mla_locality_domain.py, tests/unittest/_torch/executor/test_model_loader_mx.py |
MLA prepares the Helix V-projection weight for supported BF16 and FP8 layouts. Tests check weight construction and the unsupported packed-scale case. |
Project partials before exchange tensorrt_llm/_torch/attention/mla.py, tensorrt_llm/_torch/attention/attention.py, tests/unittest/_torch/attention/multi_gpu/helix_test_utils.py, tests/unittest/_torch/attention/multi_gpu/test_mla_helix.py |
When enabled, MLA projects partial outputs before the Helix exchange and copies the combined result to the output. Tests compare projection order and exercise distributed exchanges across scenarios and communication modes. |
Helix request partitioning
| Layer / File(s) | Summary |
|---|---|
Pass token arrays into Helix partitioning cpp/tensorrt_llm/nanobind/executor/request.cpp, tensorrt_llm/_torch/pyexecutor/request_utils.py, tests/unittest/_torch/executor/test_request_utils.py |
The request binding exposes an owned NumPy array of input token IDs. Request merging passes it to a NumPy-based partitioner, which returns tokens and positions with padding length reported separately. Tests check partition results and array ownership. |
FIFO all-to-all shared memory
| Layer / File(s) | Summary |
|---|---|
Fence FIFO shared-memory transfers cpp/tensorrt_llm/kernels/helixAllToAll.cu, tests/unittest/_torch/attention/test_helix_alltoall_fifo.py |
The sender and receiver fence shared-memory operations around S2G transfers. FIFO-v2 tests check exact entries for dense inputs and masked zero-KV rows. |
Priority:
Estimated code review effort: 4 (Complex) | ~45 minutes
Change: Refactor
Sequence Diagram(s)
sequenceDiagram
participant Transform as MLA.transform_weights
participant Forward as MLA._attn_forward_gen
participant Exchange as _helix_post_process
participant Output as output
Transform->>Forward: prepare the Helix V-projection weight
Forward->>Forward: project partial outputs when enabled
Forward->>Exchange: pass projected partials with v_head_dim
Exchange->>Output: return the combined result
Merge Risk: 
Minimal · up to adf01
-
The reviewed test-only changes introduce no identified merge-blocking risk.
Pre-merge checks: 
5
-
Full details: Description check
-
Explanation
The description follows the required template and clearly explains the motivation, implementation, test coverage, measured results, and checklist. It distinguishes results for this PR from results for the full series.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
@yihwang-nv, could you help to review this PR as trt-llm-torch-attention-devs? Thanks~ Assignment explanation
Affinity and workload are snapshots at selection, not live counters. Existing reservations on this PR are counted once. |
yihwang-nv
left a comment
There was a problem hiding this comment.
LGTM for attention changes
|
Automatically added "ci: full pre-merge approved" because this PR has satisfied the required GitHub review approvals. Unresolved review conversations and other required checks remain independent merge requirements. |
4e0a744 to
c7162c8
Compare
…efore the next bulk load The fifo all-to-all sender writes each entry's shared memory with ordinary stores (zero-KV sanitize, protoPack) and reads it with ordinary loads (the register S2G copy), then loads the next entry into the same shared memory with cp.async.bulk, an async-proxy write. Only __syncwarp() separated them, which orders the generic proxy but not the async proxy, so the bulk load could race with the previous entry's stores. The receiver side already has this fence after protoUnpack; add the same fence.proxy.async.shared::cta (tensorrt_llm::common::fence_view_async_shared) before the sender's end-of-iteration __syncwarp(). Always on, no measurable cost. Evidence (reference f372e27): Kimi K3 GSM8K with Helix CP16 and the V-up-before-all-to-all path dropped to 0.9075 (0.9613 with the fences); the reference test captured the V-up GEMM and the all-to-all in one CUDA graph and failed before / passed after the fences at 2 and 4 ranks. The receiver half of that fix landed in base separately; this is the missing sender half. Platform: N (shared kernel, all SM90+ paths). Tests: test_helix_alltoall_fifo.py now also runs with a zero-KV mask, so the sender's generic shared-memory stores precede every next bulk load under the same shared-memory pressure kernel; masked rows must arrive as the no-op contribution and all others bit-exact. Signed-off-by: Jonas Li <[email protected]>
… cp_size) Every Helix CP rank turns each fetched request into its LlmRequest with merge_helix_requests. partition_context_for_helix built an int64 tensor of the whole prompt, split it into per-block tensors and concatenated the blocks this rank owns, and the prompt came from Request.input_token_ids, which builds one Python int per token. That cost grows with the full prompt on every GEN rank, on the critical path of the step that fetches the request. The partition now gathers only the positions of the blocks this rank owns (it takes the prompt as a numpy array; same round-robin layout; the padding of the last block is never built), so only this rank's tokens become Python ints, and merge_helix_requests reads the prompt through a new binding accessor, Request.get_input_token_ids_array(): an int32 numpy array owning one memcpy'd copy of the tokens. Outputs are identical. Always on. Evidence (reference 11ff6c8d18, GB300 host): merge_helix_requests 12.6 ms -> 0.55 ms at 131k tokens and 91 ms -> 3.9 ms at 996k tokens per request; Kimi K3 16p2d c500 AgentX steps that fetch a request took +9.8 ms p50. The reference read the prompt by parsing Request.__getstate__() bytes (also one memcpy); this uses a proper binding accessor instead. Platform: N (host side). Tests: test_request_utils.py adds test_partition_context_for_helix_matches_block_layout (numpy input vs a block-by-block reference over prompt lengths, cp sizes and block sizes) and test_request_input_token_ids_array_matches_prompt; the existing merge_helix_requests tests cover the merged requests. GB300 (OCI AGA) job 1369036. Signed-off-by: Jonas Li <[email protected]>
…o-all Under Helix CP every rank exchanges the per-head kv_lora_rank (512) latent partial outputs of all heads, combines them, and only then applies the v_head_dim (128) V up-projection of its head chunk. The CP combine is a per-head weighted sum of the ranks' partials, so it commutes with the per-head linear V projection. Whenever Helix CP is on, MLA builds the BF16 V weight of every tp-local head itself in transform_weights from kv_b_proj: a view of the V rows of a BF16 kv_b_proj, or one dequantized copy of FP8 block-scale codes (12.6 MB per K3 MLA layer), of which this rank's dequantized V chunk becomes a view. This applies to every BF16/FP8 MLA model under Helix (DeepSeek-V3 included): every rank runs the V BMM for its num_heads_tp heads, and where v_b_proj_dequant was absent the FP8 block-scale V BMM becomes a BF16 BMM of the dequantized weight. Absorbed generation then projects every head's partial output before the exchange (_helix_project_v_partials, the existing BF16 BMM helper); the all-to-all and the combine move 128 instead of 512 values per head (the Helix post-process works on v_head_dim) and the post-combine V BMM is skipped. Memory per MLA layer and rank: num_heads_tp * v_head_dim * kv_lora_rank * 2 bytes, none for a BF16 kv_b_proj (a view; a copy under the locality-domain BF16 partition); for FP8 kv_b_proj on SM100f, where the rank's v_b_proj_dequant becomes a view of it, num_heads_tp * (1 - 1/cp_size) * 128 KiB net: DeepSeek-V3 (61 layers, 128 heads) at tp1 cp2 / cp4 / cp8 488 / 732 / 854 MiB per rank, DeepSeek-V3-Lite FP8 at tp2 cp2 30 MiB, BF16 DeepSeek-V3-Lite none. Numerics: reassociation of the combine and the V projection (not bit-exact). Evidence (reference fbd16e3, TRTLLM_HELIX_V_UP_BEFORE_A2A=1, part of the reference helix GEN env): GB300 K3 at 896 decode tokens moves ~88 MB less per layer per rank (helixAllToAll ~150 us + combine ~42 us per layer, ~4.6 ms per step at batch 128 before). Rubin: part of the Tier-0 bundle, helix16 b1 -6.4% device step as a group (773254); not isolated. Small CP: GB300 micro benchmark of the reordered ops (fifo_v2, CUDA graph, job 1389995), new / old per layer at 1-256 tokens: cp2 16 heads 0.71-0.93, cp4 16 heads 0.72-1.01, cp2 128 heads 0.63-0.85, cp4 128 heads 0.52-0.83 (batch 1: cp2 16 heads 8.0 -> 7.3 us, cp2 128 heads 13.6 -> 9.4 us). Accuracy relies on the Helix FIFO all-to-all sender fence (earlier commit in this series): GSM8K helix CP16 with V-up 0.9075 without it, 0.9613 with it. Evidence beyond K3: test_mla_helix.py (generic MLA, GB300 job 1387325); the DeepSeek-V3-Lite Helix accuracy test of l0_dgx_b200 pre-merge (8x B200, base vs this change, all four parametrizations pass; MMLU / GSM8K, thresholds 69.583 / 61.537: pp1tp2cp2 overlap off 71.004 / 64.481 vs 71.394 / 64.481, overlap on 71.248 / 64.177 vs 71.442 / 64.139; pp1dp2cp2 overlap off 71.199 / 64.936 vs 71.418 / 64.481, overlap on 71.028 / 64.708 vs 71.442 / 64.481). Platform: N. Tests: test_mla_helix.py test_helix_v_up_commutes_with_combine (one GPU, real combine kernel, declared tolerance 2e-2), test_mla_helix_v_up_before_alltoall (2 GPUs, nccl / fifo_v1 / fifo_v2 vs the single-rank reference), test_helix_v_up_weight_{from_fp8_kv_b, views_bf16_kv_b, needs_loaded_fp8_scales}, and the sender-fence regression test test_helix_alltoall_after_v_up_gemm_in_cuda_graph (V-up GEMM + fifo_v2 all-to-all in one CUDA graph, bitwise over 20 replays). GB300 (OCI AGA) job 1368987: test_mla_helix.py 50 passed; job 1390083 (MLA Helix suites). Signed-off-by: Jonas Li <[email protected]>
…window-tensor scope run_helix_test runs each rank's check function with no NCCL window-tensor scope. The NCCL collectives of the check (cp_allgather of the reference output, the NCCL Helix all-to-all) can return NCCL-window tensors, and with TLLM_NCCL_WINDOW_LIFECYCLE_ASSERT=1 (the default) a lease released by its tensor destructor instead of a scope aborts the process. Every test_mla_helix_distributed / test_mla_helix_v_up_before_alltoall case therefore aborted in its MPI workers after computing the correct result, the MPIPoolExecutor future never completed, and executor shutdown blocked the pytest process. The worker now calls the check function inside discard_nccl_window_tensor_outputs, the scope the model engine opens around every forward (run_in_nccl_window_tensor_scope). The scope is opened on a one-element CUDA tensor, since it only becomes active with a CUDA tensor among its inputs. The other users of run_single_rank, which capture plain CUDA graphs of the FIFO all-to-all, are unchanged. Signed-off-by: Jonas Li <[email protected]>
c7162c8 to
598649a
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #80845 [ run ] triggered by Bot. Commit: |
|
PR_Github #80845 [ run ] completed with state
|
MLA.transform_weights() now builds the Helix V up-projection weight and reads self.mapping to check for Helix CP. A real MLA always has a mapping, but the unit-test stubs created with MLA.__new__ did not, so transform_weights() raised AttributeError. Give these stubs a default non-CP Mapping, which matches a real non-Helix MLA. Signed-off-by: Jonas Li <[email protected]>
5fb65a2 to
adf0128
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #80901 [ run ] triggered by Bot. Commit: |
|
PR_Github #80901 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #80982 [ run ] triggered by Bot. Commit: |
|
PR_Github #80982 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #81018 [ run ] triggered by Bot. Commit: |
|
PR_Github #81018 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #81026 [ run ] triggered by Bot. Commit: |
|
PR_Github #81026 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #81049 [ run ] triggered by Bot. Commit: |
|
PR_Github #81049 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #81092 [ run ] triggered by Bot. Commit: |
|
PR_Github #81092 [ run ] completed with state |
Signed-off-by: Zhenhuan Chen <[email protected]> NVIDIA#20939: main's Request.get_input_token_ids_array() replaces our input_token_ids_i32 binding. NVIDIA#20597: the spec worker takes mapping_for_full_rows() plus our key_exchange. NVIDIA#21132: the shared eager GDN output buffer is allocated after the fused-verify early returns.
… fence the Helix sender before refilling shared memory (#9379) <!-- .github/pull_request_template.md --> ## 📌 Description Two fixes to the TRT-LLM-derived communication kernels, from upstream TensorRT-LLM commits FlashInfer's copies predate. - **Lamport clear size kept in elements of the writer's dtype** ([NVIDIA/TensorRT-LLM#21283](NVIDIA/TensorRT-LLM#21283)). `LamportComm` in `trtllm_allreduce_fusion.cuh` and `trtllm_moe_allreduce_fusion.cuh` recorded `params.size * NRanks` elements for the next kernel to clear, and that kernel divided by its own `VEC_SIZE`. Every Lamport kernel on a workspace shares the slot. The Python wrapper refuses a call whose dtype disagrees with the workspace's `use_fp32_lamport`, so the mismatch needs a lower-level call that bypasses that check on a workspace created with `use_fp32_lamport=True`: a bf16 kernel following an fp32 one then cleared half the bytes and read stale data, and the reverse over-cleared. Within one dtype the old count was right; the fix makes the slot's unit independent of the writer. The slot now counts 16-bit units and readers round up to whole 16-byte stores. Upstream switched the slot to bytes; FlashInfer cannot, because the cake kernels on the same workspace (`csrc/cake_trtllm_moe_allreduce_union/`, `csrc/cake_moe_finalize_allreduce_fusion/`, 36 generated files) write bf16 / fp16 element counts and read `clear_size / 8`. Two-byte units keep bf16 / fp16 bitwise as before, stay compatible with cake, and still fix fp32. The workspace layout is unchanged (`kernel_flag_ptr[4]`, initialized to 0); its docstring now names the unit (`5da38d8bc`). - **Lamport clear stores wrote the clearing kernel's own `-0`** (FlashInfer-side, found in review). A bf16 / fp16 kernel cleared with `0x8000` pairs, which an fp32 kernel two calls later reads as `0x80008000`, not fp32 `-0`, and takes as arrived data. The clear now writes the fp32 `-0` pattern (`0x80000000` per word) whatever the dtype: fp32 readers see `-0`, bf16 / fp16 readers (trtllm and cake both test each 16-bit half) see `0x8000` in the high half. Remaining gap, not touched here: the cake kernels still clear with bf16 `-0` pairs, so cake followed by an fp32 trtllm kernel on one workspace is still unsafe; no caller does that today. - **Helix all-to-all sender refill ordering** ([NVIDIA/TensorRT-LLM#20939](NVIDIA/TensorRT-LLM#20939), fence part). In `helixAllToAll.cu` the sender's `protoPack` stores and the register S2G loads go through the generic proxy, and the next iteration refills the same shared memory with `cp.async.bulk` (async proxy) without a fence between them. A `fence.proxy.async.shared::cta` before the `__syncwarp` orders them, matching the receiver side that #5172 already fenced. ## 🔍 Related Issues [NVIDIA/TensorRT-LLM#21283](NVIDIA/TensorRT-LLM#21283), [NVIDIA/TensorRT-LLM#20939](NVIDIA/TensorRT-LLM#20939). ## 🚀 Pull Request Checklist Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete. ### ✅ Pre-commit Checks - [x] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [x] I have installed the hooks with `pre-commit install`. - [x] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## 🧪 Tests - [ ] Tests have been added or updated as needed. - [ ] All tests are passing (`unittest`, etc.). The existing multi-rank tests (`tests/comm/test_trtllm_allreduce_fusion*.py`, `test_trtllm_moe_allreduce_fusion*.py`, `test_dcp_alltoall.py`) cover the touched kernels; they need 2+ GPUs, which the development node does not have, so this PR relies on the GitLab multi-GPU lane. Local: the `trtllm_comm` and DCP all-to-all JIT modules build on the branch (CUDA 13.0 CI container). `trtllm_comm`, `dcp_alltoall` and `dcp_alltoall_generated` built on B200 in the CUDA 13.0 CI container. ## 🔬 Experimental Track <!-- Only for PRs submitted under the experimental policy (CONTRIBUTING.md → "Experimental APIs and Backends"). Leave this section untouched for normal PRs. --> - [ ] This PR is **experimental**: it adds or changes code under `flashinfer/experimental/` and/or an `@flashinfer_experimental_api`. Tracking issue: # - [ ] The tracking issue names an owner, the reason for the experimental path, and a graduation plan with a target release. - [ ] Core changes are limited to a thin entry point (signature, shared validation, feature-gate check, backend selection, handoff). - [ ] Tests live in `tests/experimental/` and were validated on the intended hardware; a runnable example is included. - [ ] Nothing is registered in `flashinfer/aot.py`, and no experimental backend is reachable from `backend="auto"` without `FLASHINFER_ALLOW_EXPERIMENTAL_AUTO_BACKENDS=1`. (Calling an `@flashinfer_experimental_api` or naming a backend explicitly is itself the opt-in and needs no environment variable.) - [ ] **Test scope declared below.** The experimental CI lane runs exactly these targets, so keep them as narrow as the change allows. <!-- Required for experimental PRs. Replace the commented lines below with your targets. Do not delete the fence or change its `experimental-tests` tag — the experimental-track watcher reads it verbatim to decide which targets to ask CI for. --> ```experimental-tests # One target per line: a directory or a file. (A pytest ::selector is not # supported -- the sharding runner cannot consume one.) Must be under # tests/experimental/ and must exist. Delete these comment lines and add yours, e.g. # # tests/experimental/test_my_backend.py # tests/experimental/my_backend/ # # Declaring the whole tree (tests/experimental/) is allowed but means every # experimental PR pays for every other feature's tests, in every matrix cell. ``` ## Reviewer Notes Upstream also moved the clear size to a 64-bit slot in a new workspace word; FlashInfer keeps the existing `int` slot because `clear_size <= lamport_comm_size`, which the Python side caps at `MAX_COMM_SIZE`. The bf16-after-fp32 case needs a workspace used with both dtypes, and the cake interplay a workspace alternating `backend="trtllm"` / `"cake"` with different inputs; no existing test does either, and same-input A/B runs pass even when stale data is read. A mixed-dtype / mixed-backend case would be the regression test if reviewers want one. The GitLab lane for the latest push includes `test_cake_moe_allreduce_union.py` and `test_cake_moe_finalize_allreduce.py`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Improved synchronization for data transfers on supported GPUs, helping ensure copied data is available in the correct order. * Standardized temporary-buffer clearing across data types, with sizes rounded to the required alignment. * **Documentation** * Clarified how temporary-buffer clear sizes are measured. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Dev Engineer Review
Request.get_input_token_ids_array()exposes an owning NumPy array of prompt token IDs.partition_context_for_helixnow accepts that array and uses NumPy indexing instead of padded Torch tensors.QA Engineer Review
tests/integration/test_lists/test-db/ortests/integration/test_lists/qa/files. The supplied evidence does not establish whether these unit tests require list entries.Per-File QA Perspective
cpp/tensorrt_llm/kernels/helixAllToAll.cu— Verify that the new fences correctly order shared-memory writes, buffer reuse, and receiver reads during asynchronous transfers.cpp/tensorrt_llm/nanobind/executor/request.cpp— Verify thatget_input_token_ids_array()returns a contiguous copy that remains valid after the request is deleted.tensorrt_llm/_torch/attention/attention.py— The docstring clarifies the dimension used when MLA applies V projection before exchange. No runtime change is reported.tensorrt_llm/_torch/attention/mla.py— Verify the BF16 V-up path, supported weight layouts, fallback behavior, and numerical accuracy after the projection moves before exchange.tensorrt_llm/_torch/pyexecutor/request_utils.py— Verify NumPy-based block selection, padding lengths, and empty-rank behavior. The function input type changed tonp.ndarray.tests/unittest/_torch/attention/multi_gpu/helix_test_utils.py— The utility runs Helix worker functions inside an NCCL window-tensor scope. Its filename was not found in the inspected CI or manual-QA lists.tests/unittest/_torch/attention/multi_gpu/test_mla_helix.py— Tests cover V-weight preparation, projection/combine behavior, communication modes, and CUDA-graph overlap. The filename was not found in the inspected CI or manual-QA lists.tests/unittest/_torch/attention/test_helix_alltoall_fifo.py— The parameterized test checks FIFO results for dense and zero-KV-row inputs. The filename was not found in the inspected CI or manual-QA lists.tests/unittest/_torch/executor/test_request_utils.py— Tests cover prompt partitioning and request-array values and ownership. The filename was not found in the inspected CI or manual-QA lists.tests/unittest/_torch/attention/test_mla_locality_domain.py— The fixture now initializesmla.mapping; verify the locality-domain test setup with this mapping.tests/unittest/_torch/executor/test_model_loader_mx.py— The MLA idempotence test now initializesMappingbefore weight transformation; verify this setup against the updated transform lifecycle.Description
This PR is part of a series that lands Kimi-K3 optimizations, re-implemented for production use (wave 1 of 8 PRs). It applies on main by itself and does not depend on the other wave-1 PRs (serving runtime, spec decode, KDA/DWDP, low-M GEMM).
It has 4 commits. Each commit message gives the full rationale, measurements and tests. None of the changes adds a switch: all of them are always on when Helix CP is used.
[fix] Helix FIFO all-to-all: fence the sender's shared memory before the next bulk load. The sender writes each entry's shared memory with generic-proxy stores (zero-KV sanitize, protoPack). It then loads the next entry into the same buffer with
cp.async.bulk, which goes through the async proxy, and only__syncwarp()sat between the two. This addsfence.proxy.async.shared::cta(fence_view_async_shared) on the sender side. The receiver side already has this fence. Without the fence, Kimi-K3 GSM8K with Helix CP16 and the V-up path below dropped to 0.9075, vs 0.9613 with it. This affects all SM90+ paths of the shared kernel and has no measurable cost.[perf] Helix CP: partition a new request's prompt in O(prompt / cp_size).
partition_context_for_helixnow gathers only the positions of the blocks this rank owns, from an int32 numpy prompt. The prompt comes from a new nanobind accessor,Request.get_input_token_ids_array(), which makes one memcpy instead of building one Python int per token. Outputs are identical. On the GB300 host,merge_helix_requestswent from 12.6 ms to 0.55 ms at 131k tokens, and from 91 ms to 3.9 ms at 996k tokens.[perf] Helix MLA: apply the V up-projection before the CP all-to-all, for all MLA models. The CP combine is a per-head weighted sum, so it commutes with the per-head V projection. Each rank now projects its partial outputs to
v_head_dim(128) before the exchange, instead of exchangingkv_lora_rank(512) values per head. The all-to-all and the combine therefore move 4x less data, and the post-combine V BMM is skipped. MLA builds the BF16 V weight intransform_weightsfromkv_b_proj:kv_b_proj: a view, with no extra memory.kv_b_proj: one dequantized copy,num_heads_tp * (1 - 1/cp_size) * 128 KiBnet per layer and rank on SM100f. Examples: DeepSeek-V3 tp1 at cp2 / cp4 / cp8 needs 488 / 732 / 854 MiB per rank, and DeepSeek-V3-Lite FP8 at tp2 cp2 needs 30 MiB.Numerics: the combine and the V projection are reassociated, so results are not bit-exact. Measurements:
This change needs the sender fence from commit 1 to stay accurate.
[test] Helix test harness: run Helix MLA checks inside an NCCL window-tensor scope.
helix_test_utils.run_helix_testran each rank's check with no NCCL window-tensor scope. With main's defaultTLLM_NCCL_WINDOW_LIFECYCLE_ASSERT=1, everytest_mla_helix_distributedcase (an existing test) and the newtest_mla_helix_v_up_before_alltoallaborted in the MPI workers after computing correct results (NCCL window lease ... was released by its tensor destructor), and the pytest process then hung inexecutor.shutdown. The worker now runs the check insidediscard_nccl_window_tensor_outputs, the scope the model engine opens around every forward. This affectstest_mha_helix.pytoo, which uses the same harness. Test-only change.Accuracy on a non-Kimi MLA model. DeepSeek-V3-Lite
TestDeepSeekV3Lite::test_auto_dtype_with_helix(registered inl0_dgx_b200) was run on 8x B200, base vs this change. All 4 parametrizations pass on both.Whole-series end-to-end results. These numbers are for the full series of 8 PRs, not for this PR alone. Per-PR attribution is in the commit messages.
Setup: GB300 NVL72 (NSC LHR), Kimi-K3 NVFP4 with the DSpark drafter, AgentX agentic traces, the same dev image and autotuner state on both sides. Base is main f298722, compared with main + all 8 PRs. NSC jobs: base 362316–362321, series 361375–361379.
Test Coverage
New and changed tests, with where CI picks them up (
tests/integration/test_lists/test-db):tests/unittest/_torch/attention/test_helix_alltoall_fifo.pyunittest/_torch/attention(l0_b200,l0_b300,l0_h100,l0_cpu,l0_gb300_multi_gpus)tests/unittest/_torch/executor/test_request_utils.pytest_partition_context_for_helix_matches_block_layout,test_request_input_token_ids_array_matches_promptunittest/_torch/executor(l0_cpu,l0_h100,l0_b300,l0_dgx_b300,l0_gb300_multi_gpus)tests/unittest/_torch/attention/multi_gpu/helix_test_utils.pyrun_helix_testruns each rank inside an NCCL window-tensor scopetest_mla_helix.py/test_mha_helix.py(unittest/_torch/attentiondirectory entry)tests/unittest/_torch/attention/multi_gpu/test_mla_helix.pytest_helix_v_up_commutes_with_combine(1 GPU),test_mla_helix_v_up_before_alltoall(2 GPUs; nccl, fifo_v1, fifo_v2),test_helix_v_up_weight_*,test_helix_alltoall_after_v_up_gemm_in_cuda_graph(sender-fence regression, bitwise over 20 graph replays)unittest/_torch/attentiondirectory entry of the post-mergel0_gb300_multi_gpusstagetests/integration/defs/accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helixl0_dgx_b200Results:
pytest unittest/_torch/attention/multi_gpu/test_mla_helix.py -vv --timeout=1800, run fromtests/in one pytest process as the CI directory collection runs it, on one GB300 node (NSC LHR):Before the harness fix, the same file aborted in the MPI workers at the first
test_mla_helix_distributed[nccl-...]case and hung, on main's image with main's sources too (jobs 365736, 365761, 365789).PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.🤖 Generated with Claude Code