Skip to content

[None][feat] Support Nemotron dynamic-tree MTP decoding#15582

Merged
sunnyqgg merged 24 commits into
NVIDIA:mainfrom
sunnyqgg:nemotron_dynamic_tree_0724
Jul 22, 2026
Merged

[None][feat] Support Nemotron dynamic-tree MTP decoding#15582
sunnyqgg merged 24 commits into
NVIDIA:mainfrom
sunnyqgg:nemotron_dynamic_tree_0724

Conversation

@sunnyqgg

@sunnyqgg sunnyqgg commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Support dynamic-tree MTP decoding in the PyTorch speculative decoding path.
  • Wire dynamic-tree metadata through attention, MTP, and model execution plumbing.
  • Add slot storage coverage for dynamic-tree speculative decoding.

Changes

  • tensorrt_llm/_torch/speculative/mtp_dynamic_tree.py: add dynamic-tree MTP state and mask management.
  • tensorrt_llm/_torch/speculative/mtp.py, spec_tree_manager.py, and utils.py: integrate dynamic-tree MTP flow.
  • tensorrt_llm/_torch/models/modeling_nemotron_h.py, Mamba cache/model engine, and attention backend files: propagate dynamic-tree metadata.
  • C++ attention params/bindings: expose the metadata needed by the dynamic-tree path.
  • tests/unittest/_torch/speculative/hw_agnostic/test_dynamic_tree_slot_storage.py: add slot storage regression coverage.

Test plan

  • pytest tests/unittest/_torch/speculative/hw_agnostic/test_dynamic_tree_slot_storage.py

Summary by CodeRabbit

  • New Features

    • Added support for dynamic-tree speculative decoding, including new configuration options and metadata passed through the attention path.
    • Expanded MTP-Eagle one-model flows to build, verify, and refresh dynamic draft trees during generation.
    • Added support for forwarding accepted leaf positions in Mamba cache updates.
  • Bug Fixes

    • Improved CUDA graph warmup handling to avoid out-of-bounds issues in dynamic-tree speculative decoding.
    • Updated tree-mask preparation behavior so it can be triggered more reliably when needed.

@sunnyqgg

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #55465 [ run ] triggered by Bot. Commit: 1214b53 Link to invocation

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR implements greedy dynamic-tree one-model MTP-Eagle speculative decoding. It adds new MTPDecodingConfig knobs (use_dynamic_tree, dynamic_tree_max_topK), updates DynamicTreeSlotStorage with linear-chain fallback initialization, introduces MTPEagleDynamicTreeWorker and MTPEagleDynamicTreeResourceManager, wires dynamic-tree SSU/conv1d into Mamba-2 hybrid, and propagates force_prepare_spec_dec_tree_mask through the C++ attention stack.

Changes

MTP-Eagle Dynamic-Tree Speculative Decoding

Layer / File(s) Summary
MTPDecodingConfig dynamic-tree config knobs and public API
tensorrt_llm/llmapi/llm_args.py, examples/llm-api/quickstart_advanced.py
MTPDecodingConfig gains use_dynamic_tree, dynamic_tree_max_topK, and _max_batch_size fields with a revised set_max_total_draft_tokens validator handling dynamic-tree vs. linear-chain cases. The quickstart example wires these new args through.
force_prepare_spec_dec_tree_mask through the C++ attention stack
cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/xqaParams.h, cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/fmhaRunnerParams.h, cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/fmhaKernels.h, cpp/tensorrt_llm/common/attentionOp.h, cpp/tensorrt_llm/common/attentionOp.cpp, cpp/tensorrt_llm/thop/attentionOp.h, cpp/tensorrt_llm/thop/attentionOp.cpp, cpp/tensorrt_llm/kernels/xqaDispatcher.cpp, cpp/tensorrt_llm/nanobind/thop/bindings.cpp
New boolean flag added to XQAParams, TllmGenFmhaRunnerParams, and AttentionOp, then propagated through xqaDispatcher, the thop attention function signature, and the nanobind binding. fmhaKernels mask-preparation condition now incorporates the flag alongside mForcePrepareSpecDecTreeMask and mSpecDecodingTargetMaxGenLen mismatch.
DynamicTreeSlotStorage linear-chain fallback and apply_no_tree_linear_chain
tensorrt_llm/_torch/speculative/spec_tree_manager.py, tests/unittest/_torch/speculative/hw_agnostic/test_dynamic_tree_slot_storage.py
DynamicTreeSlotStorage.__init__ replaces zero/sentinel initialization with a precomputed linear-chain CUDA template; the dummy slot gets a K-ary tree template. mark_invalid restores cached no-tree metadata. New apply_no_tree_linear_chain selectively overwrites no-tree rows. Unit tests validate chain template validity, selective rewriting, and in-bounds indices.
MTPSpecMetadata dynamic-tree fields and prepare logic
tensorrt_llm/_torch/speculative/mtp.py, tensorrt_llm/_torch/attention_backend/trtllm.py
MTPSpecMetadata gains use_dynamic_tree, dynamic_tree_max_topK, spec_tree_manager, and retrieval link tensor fields. __post_init__ sets spec-dec tree flags. prepare() branches on dynamic-tree for num_tokens adjustment and populates retrieve_next_token/retrieve_next_sibling via slot storage with linear-chain fallback. TrtllmAttentionMetadata gains force_prepare_spec_dec_tree_mask.
MTPEagleDynamicTreeWorker — init, metadata helpers, and sampling/verification
tensorrt_llm/_torch/speculative/mtp_dynamic_tree.py (lines 1–659)
New MTPEagleDynamicTreeWorker subclasses MTPEagleWorker: allocates CUDA-graph-safe buffers for draft history, masks, and verification output. Adds attention metadata snapshot/restore helpers, a mask-repack utility, greedy top-K sampling with TP all-gather desync mitigation, tree-growth bookkeeping (update_draft_tokens_and_scores, resampling_final_draft_tokens), and sample_and_accept_draft_tokens using verify_dynamic_tree_greedy_out_packed.
MTPEagleDynamicTreeWorker — forward orchestration, draft loop, and resource manager
tensorrt_llm/_torch/speculative/mtp_dynamic_tree.py (lines 660–1303)
forward ensures spec_tree_manager, runs verification and KV relocation, snapshot/restores attn metadata around _forward_draft_loop, and returns accepted tokens, lengths, and indices. _forward_draft_loop iterates MTP layers, builds the dynamic tree, and scatters results into slot_storage. MTPEagleDynamicTreeResourceManager wires SpecTreeManager and MTPHiddenStatesManager with full lifecycle management.
Mamba-2 mixer and cache manager dynamic-tree SSU/conv1d wiring
tensorrt_llm/_torch/modules/mamba/mamba2_mixer.py, tensorrt_llm/_torch/pyexecutor/mamba_cache_manager.py, tensorrt_llm/_torch/models/modeling_nemotron_h.py
Mamba2Mixer decode-verify branch detects dynamic-tree mode, passes tree link tensors to causal_conv1d_update_triton and selective_state_update_native via ssu_extra. MambaCacheManager and MambaHybridCacheManager update_mamba_states accept accepted_leaf_positions and use it for SSM and conv-window Triton promotion kernels. NemotronHMTPDecoderLayer receives spec_metadata and mamba_metadata.
Integration wiring: utils, model engine, attention backend
tensorrt_llm/_torch/speculative/utils.py, tensorrt_llm/_torch/pyexecutor/model_engine.py, tensorrt_llm/_torch/attention_backend/fmha/fallback.py
utils.py routes dynamic-tree requests to MTPEagleDynamicTreeWorker/ResourceManager and adjusts MTPSampler nextn. model_engine.py adds a copyright header and caps effective_max_seq_len to max_num_tokens for dynamic-tree CUDA-graph capture. FallbackFmha.forward passes force_prepare_spec_dec_tree_mask to thop.attention.

Sequence Diagram

sequenceDiagram
  rect rgba(100, 149, 237, 0.5)
    note over MTPEagleDynamicTreeWorker: Target-Verify Step
    MTPEagleDynamicTreeWorker->>MTPEagleDynamicTreeWorker: sample_and_accept_draft_tokens
    MTPEagleDynamicTreeWorker->>verify_dynamic_tree_greedy_out_packed: tree logits, packed mask
    verify_dynamic_tree_greedy_out_packed-->>MTPEagleDynamicTreeWorker: accepted tokens, lengths, indices
    MTPEagleDynamicTreeWorker->>MambaHybridCacheManager: update_mamba_states(accepted_leaf_positions)
    MambaHybridCacheManager->>MambaHybridCacheManager: SSM + conv Triton promotion w/ accepted_positions
  end
  rect rgba(60, 179, 113, 0.5)
    note over MTPEagleDynamicTreeWorker: Draft-Build Step
    MTPEagleDynamicTreeWorker->>MTPEagleDynamicTreeWorker: _prepare_attn_metadata_for_spec_dec (snapshot)
    loop MTP draft layers
      MTPEagleDynamicTreeWorker->>NemotronHMTPDecoderLayer: forward(spec_metadata, mamba_metadata)
      NemotronHMTPDecoderLayer->>Mamba2Mixer: forward w/ retrieve_next_token/sibling/parent
      Mamba2Mixer->>causal_conv1d_update_triton: dynamic-tree link tensors
      Mamba2Mixer->>selective_state_update_native: ssu_extra(retrieve_parent_token)
      MTPEagleDynamicTreeWorker->>MTPEagleDynamicTreeWorker: sample top-K, update_draft_tokens_and_scores
    end
    MTPEagleDynamicTreeWorker->>SpecTreeManager: build_dynamic_tree → scatter slot_storage
    MTPEagleDynamicTreeWorker->>MTPEagleDynamicTreeWorker: _restore_attn_metadata_from_spec_dec
  end
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Suggested reviewers

  • yizhang-nv
  • mingyangHao
  • hyukn
  • lfr-0531
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.78% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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 is specific and matches the main change: adding dynamic-tree MTP decoding support.
Description check ✅ Passed The PR description covers the summary, changes, and test plan, matching the template well enough despite missing some optional sections.
✨ 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_dynamic_tree_slot_storage.py (1)

23-77: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for mask/position fallback and invalidation.

Coverage in tests/unittest/_torch/speculative/hw_agnostic/test_dynamic_tree_slot_storage.py is insufficient for this PR: the tests cover retrieve links, but not the changed no-tree position_offsets / packed_mask, dummy-slot K-ary mask, or mark_invalid() restoration. Please add those cases in this file; no follow-up outside this PR should be needed.

As per path instructions, tests/**: “Act as a QA engineer reviewing test changes and coverage for TensorRT-LLM.”

🤖 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_dynamic_tree_slot_storage.py`
around lines 23 - 77, The current tests in DynamicTreeSlotStorage only validate
next-link chaining and miss the new no-tree fallback and invalidation behavior.
Extend test_dynamic_tree_slot_storage to cover position_offsets and packed_mask
for no-tree rows, verify the dummy-slot K-ary mask path, and add a case that
calls mark_invalid() and checks the original state is restored. Use the existing
DynamicTreeSlotStorage helper methods and slot_ids-based setup so the new
assertions exercise the same no-tree and real-tree branches.

Source: Path instructions

tensorrt_llm/_torch/speculative/mtp_dynamic_tree.py (1)

72-77: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Add missing type annotations on the new methods.

Several new methods omit return annotations, and many helper parameters remain untyped. This makes the new dynamic-tree surface harder to validate with static tooling.

As per coding guidelines, “Always annotate functions. Make the return type None if the function does not return anything.”

Also applies to: 209-210, 240-241, 267-270, 272-286, 288-300, 302-331, 367-375, 426-432, 434-436, 490-497, 546-546, 637-658, 660-729, 735-745, 845-853, 958-972, 1163-1173, 1238-1245, 1263-1303

🤖 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 `@tensorrt_llm/_torch/speculative/mtp_dynamic_tree.py` around lines 72 - 77,
Add the missing type annotations throughout the new dynamic-tree surface in
mtp_dynamic_tree.py: every new function/method should have explicit return types
(use None for non-returning methods), and any currently untyped helper
parameters should be annotated. Update the affected methods in the MTP dynamic
tree implementation, including the __init__ constructor and the other new
helpers listed in the review, so the full API is statically type-checkable and
consistent with the coding guidelines.

Source: Coding guidelines

tensorrt_llm/_torch/pyexecutor/model_engine.py (1)

1-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the newly added header from this pyexecutor Python file.

This path follows a no-header convention for Python modules, so adding this block creates inconsistency.

Suggested diff
-# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.

Based on learnings, files under tensorrt_llm/_torch/pyexecutor/ should not add NVIDIA copyright headers.

🤖 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 `@tensorrt_llm/_torch/pyexecutor/model_engine.py` around lines 1 - 15, Remove
the newly added license header from the pyexecutor Python module because this
package follows the no-header convention for Python files. Update the top of
model_engine.py to match other files under tensorrt_llm/_torch/pyexecutor/ and
ensure no NVIDIA copyright block is present.

Source: Learnings

🤖 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 `@cpp/tensorrt_llm/thop/attentionOp.cpp`:
- Line 1183: The `force_prepare_spec_dec_tree_mask` assignment in `AttentionOp`
is happening before the `op_cache` lookup, but `AttentionOp::data()` does not
include that field, so cached instances can reuse a stale value. Update the
cache key by adding `mForcePrepareSpecDecTreeMask` to `AttentionOp::data()` (and
any matching equality/hash logic used by the cache) so the pre-cache
`AttentionOp` is selected/initialized with the correct flag instead of
discarding it on cache hits.

In `@tensorrt_llm/_torch/speculative/mtp_dynamic_tree.py`:
- Around line 797-820: The attention metadata mutation around
_forward_draft_loop in mtp_dynamic_tree should always be undone even when draft
execution fails. Wrap the call sequence that sets
force_prepare_spec_dec_tree_mask and updates all_rank_num_tokens in a
try/finally so _restore_attn_metadata_from_spec_dec and the original
attn_metadata fields are restored unconditionally. Keep the fix localized to the
speculative decoding path in the same method that prepares draft tree metadata.

---

Nitpick comments:
In `@tensorrt_llm/_torch/pyexecutor/model_engine.py`:
- Around line 1-15: Remove the newly added license header from the pyexecutor
Python module because this package follows the no-header convention for Python
files. Update the top of model_engine.py to match other files under
tensorrt_llm/_torch/pyexecutor/ and ensure no NVIDIA copyright block is present.

In `@tensorrt_llm/_torch/speculative/mtp_dynamic_tree.py`:
- Around line 72-77: Add the missing type annotations throughout the new
dynamic-tree surface in mtp_dynamic_tree.py: every new function/method should
have explicit return types (use None for non-returning methods), and any
currently untyped helper parameters should be annotated. Update the affected
methods in the MTP dynamic tree implementation, including the __init__
constructor and the other new helpers listed in the review, so the full API is
statically type-checkable and consistent with the coding guidelines.

In
`@tests/unittest/_torch/speculative/hw_agnostic/test_dynamic_tree_slot_storage.py`:
- Around line 23-77: The current tests in DynamicTreeSlotStorage only validate
next-link chaining and miss the new no-tree fallback and invalidation behavior.
Extend test_dynamic_tree_slot_storage to cover position_offsets and packed_mask
for no-tree rows, verify the dummy-slot K-ary mask path, and add a case that
calls mark_invalid() and checks the original state is restored. Use the existing
DynamicTreeSlotStorage helper methods and slot_ids-based setup so the new
assertions exercise the same no-tree and real-tree branches.
🪄 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: e7d46d6c-db64-470c-aa0a-ae60be69d872

📥 Commits

Reviewing files that changed from the base of the PR and between 4a88020 and 1214b53.

📒 Files selected for processing (22)
  • cpp/tensorrt_llm/common/attentionOp.cpp
  • cpp/tensorrt_llm/common/attentionOp.h
  • cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/xqaParams.h
  • cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/fmhaKernels.h
  • cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/fmhaRunnerParams.h
  • cpp/tensorrt_llm/kernels/xqaDispatcher.cpp
  • cpp/tensorrt_llm/nanobind/thop/bindings.cpp
  • cpp/tensorrt_llm/thop/attentionOp.cpp
  • cpp/tensorrt_llm/thop/attentionOp.h
  • examples/llm-api/quickstart_advanced.py
  • tensorrt_llm/_torch/attention_backend/fmha/fallback.py
  • tensorrt_llm/_torch/attention_backend/trtllm.py
  • tensorrt_llm/_torch/models/modeling_nemotron_h.py
  • tensorrt_llm/_torch/modules/mamba/mamba2_mixer.py
  • tensorrt_llm/_torch/pyexecutor/mamba_cache_manager.py
  • tensorrt_llm/_torch/pyexecutor/model_engine.py
  • tensorrt_llm/_torch/speculative/mtp.py
  • tensorrt_llm/_torch/speculative/mtp_dynamic_tree.py
  • tensorrt_llm/_torch/speculative/spec_tree_manager.py
  • tensorrt_llm/_torch/speculative/utils.py
  • tensorrt_llm/llmapi/llm_args.py
  • tests/unittest/_torch/speculative/hw_agnostic/test_dynamic_tree_slot_storage.py

Comment thread cpp/tensorrt_llm/thop/attentionOp.cpp
Comment thread tensorrt_llm/_torch/speculative/mtp_dynamic_tree.py
@sunnyqgg sunnyqgg changed the title [None][feat] Support dynamic-tree MTP decoding [None][feat] Support Nemotron dynamic-tree MTP decoding Jun 24, 2026
@sunnyqgg
sunnyqgg marked this pull request as draft June 24, 2026 10:55
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #55465 [ run ] completed with state SUCCESS. Commit: 1214b53
/LLM/main/L0_MergeRequest_PR pipeline #44393 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

@sunnyqgg
sunnyqgg force-pushed the nemotron_dynamic_tree_0724 branch from b9ba07f to 40043da Compare June 29, 2026 06:49
@sunnyqgg

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56326 [ run ] triggered by Bot. Commit: 40043da Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56326 [ run ] completed with state SUCCESS. Commit: 40043da
/LLM/main/L0_MergeRequest_PR pipeline #45175 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

@sunnyqgg
sunnyqgg marked this pull request as ready for review July 2, 2026 03:28
@sunnyqgg

sunnyqgg commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #57098 [ run ] triggered by Bot. Commit: 17c5df4 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #57098 [ run ] completed with state SUCCESS. Commit: 17c5df4
/LLM/main/L0_MergeRequest_PR pipeline #45886 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

@sunnyqgg
sunnyqgg force-pushed the nemotron_dynamic_tree_0724 branch from 98a7f63 to 024d237 Compare July 17, 2026 06:22
@sunnyqgg

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

1 similar comment
@sunnyqgg

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60163 [ run ] triggered by Bot. Commit: 024d237 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60163 [ run ] completed with state FAILURE. Commit: 024d237
/LLM/main/L0_MergeRequest_PR pipeline #48538 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

@sunnyqgg

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

Signed-off-by: qgai <qgai@nvidia.com>
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60210 [ run ] triggered by Bot. Commit: 9bd515a Link to invocation

@sunnyqgg

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60262 [ run ] triggered by Bot. Commit: 9bd515a Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60210 [ run ] completed with state ABORTED. Commit: 9bd515a

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60262 [ run ] completed with state SUCCESS. Commit: 9bd515a
/LLM/main/L0_MergeRequest_PR pipeline #48622 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

@sunnyqgg

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60332 [ run ] triggered by Bot. Commit: 9bd515a Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60332 [ run ] completed with state FAILURE. Commit: 9bd515a
/LLM/main/L0_MergeRequest_PR pipeline #48677 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

@sunnyqgg

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60849 [ run ] triggered by Bot. Commit: 9bd515a Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #60849 [ run ] completed with state SUCCESS. Commit: 9bd515a
/LLM/main/L0_MergeRequest_PR pipeline #49122 completed with status: 'SUCCESS'

CI Report

Link to invocation

@sunnyqgg
sunnyqgg merged commit 858fd17 into NVIDIA:main Jul 22, 2026
7 checks passed
@longcheng-nv

Copy link
Copy Markdown
Collaborator

Heads-up: this PR appears to have merged with a semantic conflict against a guard that landed on main after this branch's CI ran, and current main tip is import-broken as a result.

  • [https://nvbugs/6442074][fix] Make one-model spec-dec attn-metadata save/restore exception-safe #16382 (d97397437f, merged earlier) added an __init_subclass__ guard on SpecWorkerBase that rejects any subclass overriding forward (subclasses must implement _forward_impl, so SpecWorkerBase.forward can guarantee spec-dec attn-metadata cleanup on failure, https://nvbugs/6442074).
  • MTPEagleDynamicTreeWorker in tensorrt_llm/_torch/speculative/mtp_dynamic_tree.py (added here, 858fd17b79) overrides forward, so the guard raises TypeError at class-definition time.
  • tensorrt_llm/_torch/speculative/utils.py imports mtp_dynamic_tree at module level, so any import of the PyTorch backend now fails:
tensorrt_llm/_torch/speculative/interface.py:1037: in __init_subclass__
    raise TypeError(
E   TypeError: MTPEagleDynamicTreeWorker must not override SpecWorkerBase.forward; implement _forward_impl instead. SpecWorkerBase.forward guarantees spec-dec attn-metadata cleanup when a forward fails (https://nvbugs/6442074).

Repro: python -c "import tensorrt_llm._torch.speculative.utils" on main tip (9095cc11d1).

Effect: every PR CI run (which tests the PR merged with latest main) currently fails at test collection for anything importing the PyTorch backend. The likely fix is renaming the override to _forward_impl per the guard's contract. Could you take a look?

longcheng-nv added a commit to longcheng-nv/TensorRT-LLM that referenced this pull request Jul 22, 2026
…d conflict (drop after upstream fix)

MTPEagleDynamicTreeWorker overrides SpecWorkerBase.forward, which the
__init_subclass__ guard from NVIDIA#16382 rejects at class-definition time,
breaking all backend imports on current main (see
NVIDIA#15582 (comment)).
Rename the override to _forward_impl per the guard's contract;
SpecWorkerBase.forward forwards *args/**kwargs unchanged.

Temporary carry so this PR's CI can run; becomes a no-op once the
equivalent fix lands on main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: longcheng-nv <243710427+longcheng-nv@users.noreply.github.com>
yuanjingx87 pushed a commit to yuanjingx87/TensorRT-LLM that referenced this pull request Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-compatible Accepted LLM API contract change that is backwards-compatible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants