Skip to content

[None][feat] Support Helix CP with MTP - #16003

Open
brb-nv wants to merge 6 commits into
NVIDIA:mainfrom
brb-nv:user/brb/helix-cp-mtp-support-per-request
Open

[None][feat] Support Helix CP with MTP#16003
brb-nv wants to merge 6 commits into
NVIDIA:mainfrom
brb-nv:user/brb/helix-cp-mtp-support-per-request

Conversation

@brb-nv

@brb-nv brb-nv commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Description

This MR adds support for Helix CP with MTP. Some implementation details:

  • All draft tokens if verification forward pass are allocated on the same context-parallel rank for a given request. This makes the implementation simpler and more tractable to debug.
  • For the attention computation, we treat each query token as its own q_len=1 request at the attention metadata layer. Alternative is to add trtllm-gen kernel support for per-query-token KV lengths where the attn mask is driven entirely by per-token seqlenKv (we decided to not modify trtllm-gen kernels for this).

Test Coverage

$ pytest accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[mtp_nextn=3-fifo_v2-cudagraph:with_padding-pp1tp1cp4] -s -v
$ pytest tests/unittest/_torch/speculative/hw_agnostic/test_helix_eagle3_ownership.py -s -v

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-compatible or api-breaking. For api-breaking, include BREAKING in 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.

Summary by CodeRabbit

  • New Features

    • Added broader support for Helix context-parallel speculative decoding, including improved handling of multi-token verification, overlap scheduling, and draft-token ownership.
    • Expanded compatibility for selected model paths so generation and sampling use the correct parallel mapping in more configurations.
  • Bug Fixes

    • Improved correctness for Helix-based decoding, including request state tracking, KV-cache updates, and replay consistency during generation.
    • Refined overlap scheduler behavior so unsupported Helix setups are automatically disabled instead of running inconsistently.
  • Tests

    • Added and updated coverage for Helix ownership, positioning, and accuracy scenarios.

@brb-nv
brb-nv force-pushed the user/brb/helix-cp-mtp-support-per-request branch 2 times, most recently from 94405a6 to 8e54404 Compare July 6, 2026 21:28
@brb-nv
brb-nv marked this pull request as ready for review July 6, 2026 23:05
@brb-nv
brb-nv requested review from a team as code owners July 6, 2026 23:05
@brb-nv

brb-nv commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #57845 [ run ] triggered by Bot. Commit: 43b0189 Link to invocation

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds Helix context-parallel (CP) support for one-model speculative decoding (MTP/Eagle3). Changes span flattened generation attention metadata, KV cache decode-group ownership/reserve/rewind, request bookkeeping fields, sampler mapping repurposing (CP-to-TP), overlap-scheduler compatibility gating, model wiring, and associated tests/docs/CI updates.

Changes

Helix CP speculative decoding support

Layer / File(s) Summary
Flattened generation attention metadata
tensorrt_llm/_torch/attention_backend/trtllm.py
Adds flattened per-row KV/prompt length buffers, _maybe_prepare_helix_flatten, apply_helix_overlap_flatten_correction, and helix_flattened_generation context manager; updates helix_is_inactive_rank semantics and assertions.
MLA generation forward using flattened context
tensorrt_llm/_torch/modules/mla.py
_attn_forward_gen optionally executes inside the flattened generation context and passes flattened cumulative seqlens to the attention backend.
Request-level Helix bookkeeping
tensorrt_llm/_torch/pyexecutor/llm_request.py, tensorrt_llm/_torch/pyexecutor/request_utils.py
Adds committed decode length, reserve/rewind group indices, and prior-group ownership fields to requests; documents their use in merge logic.
KV cache decode-group ownership, reserve, and rewind
tensorrt_llm/_torch/pyexecutor/resource_manager.py
Adds deterministic ownership helpers and owner-gated reserve/rewind KV logic wired into resource lifecycle methods.
Model engine Helix position/overlap correction wiring
tensorrt_llm/_torch/pyexecutor/model_engine.py
Applies/undoes on-device overlap corrections around pre/postprocess, derives global decode positions via a new helper, and owner-gates overlap-scheduler KV offset updates.
Model construction threading of mapping_with_cp
tensorrt_llm/_torch/models/modeling_deepseekv3.py, tensorrt_llm/_torch/models/modeling_speculative.py
DeepseekV3MTP and MTPForCausalLM thread mapping_with_cp for CP-aware attention and TP sharding.
Sampler mapping repurposing for Helix draft sampling
tensorrt_llm/_torch/speculative/interface.py, tensorrt_llm/_torch/speculative/mtp.py, tensorrt_llm/_torch/speculative/eagle3.py, tensorrt_llm/_torch/speculative/utils.py
Adds cached sampler_mapping property repurposing CP to TP; draft sampling paths and worker construction use it instead of model_config.mapping.
Eagle3 draft loop owner-mask KV growth and metadata restore
tensorrt_llm/_torch/speculative/eagle3.py
Computes a per-request owner mask to gate KV length growth in the draft loop and restores additional Helix buffers after the loop for CUDA graph capture.
Overlap scheduler compatibility gating
tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
Validates overlap-scheduler compatibility for Helix CP against attention backend and speculative decoding mode, disabling it when unsupported.
Ownership/FIFO invariant unit tests
tests/unittest/_torch/speculative/hw_agnostic/test_helix_eagle3_ownership.py
New standalone tests validate decode-index/group ownership formulas and reserve/rewind FIFO consistency.
Docs, accuracy parametrization, and CI list updates
docs/source/features/feature-combination-matrix.md, tests/integration/defs/accuracy/*, tests/integration/test_lists/*
Updates docs matrix, GSM8K debug env-var handling, Helix test parametrization by mtp_nextn, and QA/CI test-list/waiver entries.

Estimated code review effort: 4 (Complex) | ~75 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ModelEngine as PyTorchModelEngine
  participant AttnMetadata as TrtllmAttentionMetadata
  participant KVCacheManager as KVCacheManager
  participant MLA as MLA._attn_forward_gen

  ModelEngine->>AttnMetadata: prepare() -> _maybe_prepare_helix_flatten()
  AttnMetadata->>AttnMetadata: fill flattened per-row KV/prompt buffers
  ModelEngine->>ModelEngine: _preprocess_inputs -> apply overlap corrections (sign=1)
  ModelEngine->>KVCacheManager: prepare_resources -> _helix_prepare_generation_kv
  KVCacheManager->>KVCacheManager: reserve tokens only on owning rank
  ModelEngine->>MLA: forward generation attention
  MLA->>AttnMetadata: enter helix_flattened_generation()
  AttnMetadata-->>MLA: flattened cu_q_seqlens/cu_kv_seqlens
  MLA->>MLA: attn_backend.forward(kwargs)
  AttnMetadata-->>MLA: restore original runtime metadata
  ModelEngine->>KVCacheManager: update_resources -> _helix_rewind_generation_kv (on rejection)
  KVCacheManager->>KVCacheManager: rewind_kv_cache only if owner
  ModelEngine->>ModelEngine: _postprocess_inputs -> undo overlap corrections (sign=-1)
Loading

Possibly related PRs

  • NVIDIA/TensorRT-LLM#15902: Both PRs modify tests/integration/test_lists/waives.txt for TestDeepSeekV3Lite::test_auto_dtype_with_helix waiver identifiers.

Suggested reviewers: syuoni, mikeiovine, xinhe-nv, yizhang-nv, yechank-nvidia, jieli-matrix

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: adding Helix CP support with MTP.
Description check ✅ Passed The description includes a clear summary, implementation notes, test coverage, and a completed checklist.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
tests/unittest/_torch/speculative/hw_agnostic/test_helix_eagle3_ownership.py (3)

25-26: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Duplicate ownership formula defined twice.

owns_decode_index (Line 25-26) and owns_decode_group (Line 117-119) are identical implementations of (idx // tpb) % cp_size == cp_rank. Consider defining a single shared helper and aliasing/reusing it for both the verify-token and decode-group test sections to avoid drift between the two copies.

♻️ Proposed consolidation
-def owns_decode_index(decode_index, tpb, cp_size, cp_rank):
-    return (decode_index // tpb) % cp_size == cp_rank
+def owns_decode_index(decode_index, tpb, cp_size, cp_rank):
+    """Mirror of the shared Helix CP ownership formula."""
+    return (decode_index // tpb) % cp_size == cp_rank
+
+
+# Verify-group and decode-group ownership use the same formula in production
+# (see resource_manager._helix_owns_decode_group / model_engine helpers).
+owns_decode_group = owns_decode_index

Also applies to: 117-119

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unittest/_torch/speculative/hw_agnostic/test_helix_eagle3_ownership.py`
around lines 25 - 26, The ownership check is duplicated in both
owns_decode_index and owns_decode_group, so consolidate the shared `(idx // tpb)
% cp_size == cp_rank` logic into one helper and reuse or alias it from both the
verify-token and decode-group test sections. Update the tests to call the single
shared function instead of maintaining two identical implementations, keeping
the existing names if needed for readability.

25-46: 🎯 Functional Correctness | 🔵 Trivial | 🏗️ Heavy lift

Tests validate mirror formulas, not the actual production implementations.

owns_decode_index/owns_decode_group/verify_token_params are explicitly labeled as mirrors of resource_manager._helix_owns_decode_group and model_engine._helix_verify_token_params (Line 39, Line 118), but the tests only check internal consistency of these local re-implementations. If the production formulas change or diverge (e.g., a future edit to _helix_owns_decode_group in resource_manager.py), this "hardware-agnostic" suite would keep passing without detecting the drift, per <ai_summary> and the provided context snippet from resource_manager.py:738-750 showing the real _helix_owns_decode_group.

Given this is meant to guard the ownership/FIFO invariants underpinning Helix CP correctness, consider either:

  • Importing and testing the real _helix_owns_decode_group (with a lightweight stub Mapping/self object) directly instead of a hand-rolled mirror, or
  • Adding at least one assertion elsewhere (e.g., in the resource_manager/model_engine test suites) that pins the production formula's behavior against this mirror, so regressions in either file are caught.

As per path instructions for tests/**, flagging coverage as insufficient given the risk of silent drift between mirror and production logic; a follow-up outside this PR that exercises the real implementations would close the gap.

Also applies to: 117-166

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unittest/_torch/speculative/hw_agnostic/test_helix_eagle3_ownership.py`
around lines 25 - 46, The test helpers here are only re-implementing production
logic, so they can drift without catching regressions. Update the ownership
coverage in test_helix_eagle3_ownership to exercise the real
resource_manager._helix_owns_decode_group and
model_engine._helix_verify_token_params (using a lightweight stub object if
needed) instead of only asserting the local mirror functions agree with
themselves. If direct import is not practical, add a production-facing assertion
in the resource_manager/model_engine test suite that pins the real formulas
against these expectations.

Source: Path instructions


25-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Missing return-type/parameter annotations on module-level functions and helper class.

Functions such as owns_decode_index, verify_token_params, owns_decode_group, and _FifoRankState.__init__/reserve/rewind lack type annotations. As per coding guidelines, "Always annotate functions with return types (use None if no return); annotate class members and variables when necessary."

🏷️ Example annotations
-def owns_decode_index(decode_index, tpb, cp_size, cp_rank):
+def owns_decode_index(decode_index: int, tpb: int, cp_size: int, cp_rank: int) -> bool:
     return (decode_index // tpb) % cp_size == cp_rank
-def verify_token_params(total_input_len, g, num_draft, tpb, cp_size, cp_rank):
+def verify_token_params(
+    total_input_len: int, g: int, num_draft: int, tpb: int, cp_size: int, cp_rank: int
+) -> tuple[list[int], list[bool], int]:
-    def __init__(self, tpb, cp_size, cp_rank):
+    def __init__(self, tpb: int, cp_size: int, cp_rank: int) -> None:
         self.tpb = tpb
         self.cp_size = cp_size
         self.cp_rank = cp_rank
-        self.group_index = 0
-        self.pending = []
-        self.reserve_log = []
-        self.rewind_log = []
+        self.group_index: int = 0
+        self.pending: list[bool] = []
+        self.reserve_log: list[bool] = []
+        self.rewind_log: list[bool] = []

Also applies to: 38-46, 117-119, 144-166

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unittest/_torch/speculative/hw_agnostic/test_helix_eagle3_ownership.py`
around lines 25 - 26, Add explicit type annotations to the untyped module-level
helpers and FIFO state methods in the Helix Eagle3 ownership test module. Update
owns_decode_index, verify_token_params, and owns_decode_group with parameter and
return types, and annotate _FifoRankState’s __init__, reserve, and rewind
signatures (including any instance attributes they set). Keep the fixes
localized to those named symbols so the test helpers follow the project’s
annotation guidelines.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tensorrt_llm/_torch/attention_backend/trtllm.py`:
- Around line 513-523: The `_helix_flat_block_offsets` allocation is using
`kv_cache_manager.num_pools`, but the flatten/copy path follows
`kv_cache_block_offsets` and may use `num_attention_op_pools` instead. Update
the buffer shape in the `kv_cache_manager is not None` branch of `trtllm.py` to
size `_helix_flat_block_offsets` from `num_attention_op_pools` so it matches the
source tensor and remains valid when the two pool counts differ.

In `@tensorrt_llm/_torch/speculative/interface.py`:
- Around line 874-892: The new cache field and accessor in sampler_mapping need
explicit type annotations so mypy does not infer None-only or Any. Annotate
self._sampler_mapping_cache with the concrete optional mapping type used by
mapping.repurpose_helix_cp_to_tp(), and add an explicit return type to the
sampler_mapping property consistent with the surrounding members in this class.
Use the existing model_config/mapping logic to determine the precise annotation
and keep the cache behavior unchanged.

---

Nitpick comments:
In
`@tests/unittest/_torch/speculative/hw_agnostic/test_helix_eagle3_ownership.py`:
- Around line 25-26: The ownership check is duplicated in both owns_decode_index
and owns_decode_group, so consolidate the shared `(idx // tpb) % cp_size ==
cp_rank` logic into one helper and reuse or alias it from both the verify-token
and decode-group test sections. Update the tests to call the single shared
function instead of maintaining two identical implementations, keeping the
existing names if needed for readability.
- Around line 25-46: The test helpers here are only re-implementing production
logic, so they can drift without catching regressions. Update the ownership
coverage in test_helix_eagle3_ownership to exercise the real
resource_manager._helix_owns_decode_group and
model_engine._helix_verify_token_params (using a lightweight stub object if
needed) instead of only asserting the local mirror functions agree with
themselves. If direct import is not practical, add a production-facing assertion
in the resource_manager/model_engine test suite that pins the real formulas
against these expectations.
- Around line 25-26: Add explicit type annotations to the untyped module-level
helpers and FIFO state methods in the Helix Eagle3 ownership test module. Update
owns_decode_index, verify_token_params, and owns_decode_group with parameter and
return types, and annotate _FifoRankState’s __init__, reserve, and rewind
signatures (including any instance attributes they set). Keep the fixes
localized to those named symbols so the test helpers follow the project’s
annotation guidelines.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 257c5863-2838-49e8-ac88-f120133f34cf

📥 Commits

Reviewing files that changed from the base of the PR and between a0c406f and 43b0189.

📒 Files selected for processing (20)
  • docs/source/features/feature-combination-matrix.md
  • tensorrt_llm/_torch/attention_backend/trtllm.py
  • tensorrt_llm/_torch/models/modeling_deepseekv3.py
  • tensorrt_llm/_torch/models/modeling_speculative.py
  • tensorrt_llm/_torch/modules/mla.py
  • tensorrt_llm/_torch/pyexecutor/llm_request.py
  • tensorrt_llm/_torch/pyexecutor/model_engine.py
  • tensorrt_llm/_torch/pyexecutor/py_executor_creator.py
  • tensorrt_llm/_torch/pyexecutor/request_utils.py
  • tensorrt_llm/_torch/pyexecutor/resource_manager.py
  • tensorrt_llm/_torch/speculative/eagle3.py
  • tensorrt_llm/_torch/speculative/interface.py
  • tensorrt_llm/_torch/speculative/mtp.py
  • tensorrt_llm/_torch/speculative/utils.py
  • tests/integration/defs/accuracy/accuracy_core.py
  • tests/integration/defs/accuracy/test_disaggregated_serving.py
  • tests/integration/test_lists/qa/llm_function_core.txt
  • tests/integration/test_lists/test-db/l0_dgx_b200.yml
  • tests/integration/test_lists/waives.txt
  • tests/unittest/_torch/speculative/hw_agnostic/test_helix_eagle3_ownership.py

Comment thread tensorrt_llm/_torch/attention_backend/trtllm.py
Comment thread tensorrt_llm/_torch/speculative/interface.py
@brb-nv

brb-nv commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #57875 [ run ] triggered by Bot. Commit: 9aa8f3c Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #57845 [ run ] completed with state ABORTED. Commit: 43b0189

Link to invocation

@brb-nv

brb-nv commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@brb-nv
brb-nv requested review from syuoni and removed request for hlu1 July 7, 2026 02:32
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #57892 [ run ] triggered by Bot. Commit: 45bc291 Link to invocation

@brb-nv
brb-nv requested review from cascade812 and removed request for sunnyqgg July 7, 2026 02:33
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #57875 [ run ] completed with state ABORTED. Commit: 9aa8f3c

Link to invocation

py_helix_is_inactive_rank, set at KV reserve time. Overlap corrections
run on-device in _preprocess_inputs.
"""
del tokens_per_block

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this deleted right away?

kv_len_offsets_device[previous_slots],
non_blocking=True)
if _has_cp_helix:
# Owner-gated kv-length correction for overlap scheduling.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is called at every forward pass, right? Could we pre-allocate helix_prev_owned_cuda once?

Comment on lines +565 to +568
seg_starts = torch.cumsum(seg_lens, 0) - seg_lens
row_incl = (torch.arange(total_q, dtype=torch.int64) -
torch.repeat_interleave(seg_starts, seg_lens) + 1)
owned_incl = row_incl * torch.repeat_interleave(active, seg_lens)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These might create new buffers in a hot path, could we pre-allocate them?

for i in range(runtime_draft_len):
# Set per-token global positions and ownership before draft forward.
helix_owner_mask = self._helix_draft_owner_mask(
attn_metadata, inputs["position_ids"], batch_size)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be casted to attn_metadata.kv_lens_cuda.dtype directly here (or done by helix_draft_owner_mask)

with launch_disaggregated_llm(disaggregated_server_config,
ctx_server_config, gen_server_config,
self.MODEL_PATH) as llm:
run_accuracy_test(llm, self.MODEL_NAME, ["MMLU", "GSM8K"])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the removal of MMLU intended here?

Comment on lines +219 to +242
# Optional GSM8K debug env vars: TRTLLM_GSM8K_NUM_SAMPLES, TRTLLM_GSM8K_OUTPUT_DIR.
# A custom sample count skips the accuracy hypothesis test.
gsm8k_num_samples = None
gsm8k_output_dir = None
if self.DATASET == "gsm8k":
gsm8k_output_dir = os.getenv("TRTLLM_GSM8K_OUTPUT_DIR") or None
num_samples_env = os.getenv("TRTLLM_GSM8K_NUM_SAMPLES")
if num_samples_env is not None:
gsm8k_num_samples = int(num_samples_env)
if gsm8k_num_samples <= 0:
raise ValueError(
"TRTLLM_GSM8K_NUM_SAMPLES must be a positive integer, "
f"got {num_samples_env!r}.")

if gsm8k_num_samples is not None:
logger.info(
f"Running GSM8K on a deterministic subset of {gsm8k_num_samples} "
"sample(s) (TRTLLM_GSM8K_NUM_SAMPLES) and skipping accuracy "
"verification.")
hypothesis_testing_params = HypothesisTestingParams(
ref_accuracy=0 if self.HIGHER_IS_BETTER else math.inf,
num_samples=gsm8k_num_samples,
metric_name=self.METRIC_NAME,
higher_is_better=self.HIGHER_IS_BETTER)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could be in a separate PR

return
off_rows = per_request_kv_offset[self._helix_flat_row_to_seq[:n].to(
torch.long)].to(self._helix_flat_kv_lens_cuda.dtype)
self._helix_flat_kv_lens_cuda[:n] += sign * off_rows

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might also need to update _helix_flat_kv_lens_cpu ?

@syuoni syuoni left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the DeepSeek modeling part. Thanks!

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #57892 [ run ] completed with state FAILURE. Commit: 45bc291
/LLM/main/L0_MergeRequest_PR pipeline #46587 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

brb-nv added 6 commits July 7, 2026 17:23
Signed-off-by: Balaram Buddharaju <169953907+brb-nv@users.noreply.github.com>
Signed-off-by: Balaram Buddharaju <169953907+brb-nv@users.noreply.github.com>
Signed-off-by: Balaram Buddharaju <169953907+brb-nv@users.noreply.github.com>
Signed-off-by: Balaram Buddharaju <169953907+brb-nv@users.noreply.github.com>
Signed-off-by: Balaram Buddharaju <169953907+brb-nv@users.noreply.github.com>
Signed-off-by: Balaram Buddharaju <169953907+brb-nv@users.noreply.github.com>
@brb-nv
brb-nv force-pushed the user/brb/helix-cp-mtp-support-per-request branch from 45bc291 to 3b9f67b Compare July 7, 2026 17:27
@brb-nv

brb-nv commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58048 [ run ] triggered by Bot. Commit: 3b9f67b Link to invocation

| Disaggregated Serving | Yes | Yes | Yes | Yes | Yes | Yes | Yes | --- | | | | | | | | | | | |
| Chunked Prefill | Yes | Yes | Yes | Untested | Yes | Yes | Yes | Yes | --- | | | | | | | | | | |
| Speculative Decoding — Linear | Yes | Yes | Yes | No | Yes | No | Yes | Yes | Yes | --- | | | | | | | | | |
| Speculative Decoding — Linear | Yes | Yes | Yes | No | Yes | Yes (Eagle3 one-model) | Yes | Yes | Yes | --- | | | | | | | | | |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the PR support Eagle3+Helix as well?

- accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v1-cudagraph:with_padding-pp1tp1cp4] TIMEOUT (60)
- accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v1-cudagraph:with_padding-pp1tp2cp2-mtp_nextn=0] TIMEOUT (60)
- accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v1-cudagraph:with_padding-pp1tp1cp4-mtp_nextn=0] TIMEOUT (60)
- accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v2-cudagraph:with_padding-pp1tp1cp4-mtp_nextn=3] TIMEOUT (60)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test doesn't cover TP + Helix + MTP. could it be changed to pp1tp2cp2-mtp_nextn=3 since it's the only one that would actually catch the allgather bug that motivated the sampler_mapping change?

with launch_disaggregated_llm(disaggregated_server_config,
ctx_server_config, gen_server_config,
self.MODEL_PATH) as llm:
run_accuracy_test(llm, self.MODEL_NAME, ["MMLU", "GSM8K"])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any particular reason to drop MMLU?

is_separate_draft_engine: bool = False,
mapping_with_cp: Optional[Mapping] = None):
# Thread mapping_with_cp into attention so MLA keeps the full head count.
super().__init__(model_config,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we have compared acceptance rate with and without Helix offline.

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #58048 [ run ] completed with state SUCCESS. Commit: 3b9f67b
/LLM/main/L0_MergeRequest_PR pipeline #46717 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@nvpohanh
nvpohanh requested a review from thorjohnsen July 9, 2026 06:32
@nvpohanh

nvpohanh commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

[by Codex] @SimengLiu-nv Could you review this PR? Thanks!

@Shixiaowei02 Shixiaowei02 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @brb-nv , given that some Helix CP issues have recently only been caught at the dis-agg E2E test stage, would it be possible to add more modularized test coverage? For example, adding tests between the agg layer and individual modules may help catch these issues earlier. Thank you!

accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[nccl-cudagraph:with_padding-pp1tp1cp4]
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[nccl-cudagraph:with_padding-pp1tp2cp2]
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[nccl-cudagraph:with_padding-pp2tp1cp2]
accuracy/test_disaggregated_serving.py::TestDeepSeekV3Lite::test_auto_dtype_with_helix[fifo_v1-cudagraph:with_padding-pp1dp2cp2-mtp_nextn=0]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To help reduce resource consumption, could we kindly consider reducing the number of DeepSeek-V3 test cases mentioned above? In addition, since several DeepSeek-V3 issues are currently being tracked as P1, it would be greatly appreciated if the issues related to the newly added tests could be addressed (or appropriately reassigned) before introducing additional test coverage. Thank you for your support!

@nvpohanh

Copy link
Copy Markdown
Collaborator

[by Codex] @SimengLiu-nv Friendly reminder to review this PR as the primary KV-cache-manager reviewer when you have a chance. Thanks!

@nvpohanh

Copy link
Copy Markdown
Collaborator

[by Codex] @SimengLiu-nv Could you please review this PR? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants