Skip to content

[None][feat] Disable mamba replay by default - #14471

Merged
Wanli-Jiang merged 3 commits into
NVIDIA:mainfrom
tijyojwad:user/williamj/disable-ssu-replay
May 23, 2026
Merged

[None][feat] Disable mamba replay by default#14471
Wanli-Jiang merged 3 commits into
NVIDIA:mainfrom
tijyojwad:user/williamj/disable-ssu-replay

Conversation

@tijyojwad

@tijyojwad tijyojwad commented May 22, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved tensor memory handling in Mamba2 mixer operations for CUDA compatibility
    • Enhanced state tensor handling in selective state update operations
    • Changed Mamba MTP replay feature to be disabled by default

Review Change Stack

Description

This PR overrides the PR from #14439 with an additional bug fix

Test Coverage

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.

Signed-off-by: Wanli Jiang <35160485+Wanli-Jiang@users.noreply.github.com>
The CUDA kernel mamba2_mtp_ssm_cache_update requires contiguous dense
inputs, but x_d_4d, B_d_4d, and C_d_4d arrive as non-contiguous views
from torch.split + rearrange.  Previously this was masked because the
replay path (checked first) handled non-contiguous inputs via explicit
Triton strides.  With replay disabled by default, the custom op path
is now reachable and fails on non-contiguous x.

Add .contiguous() to x, B, C at the custom op call site (and keep the
existing calls in the legacy/flashinfer path).

Signed-off-by: tijyojwad <1127155+tijyojwad@users.noreply.github.com>
@tijyojwad
tijyojwad force-pushed the user/williamj/disable-ssu-replay branch from e9f0b5d to 731d779 Compare May 22, 2026 20:34
@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR enforces tensor memory layout requirements for the Mamba 2 MTP decoder by introducing contiguous staging in the selective state update function, coordinating caller-side contiguity in the Mamba decoder, and adjusting the replay kernel default configuration to disabled.

Changes

Mamba tensor contiguity and state management

Layer / File(s) Summary
State tensor contiguity enforcement in CUDA op
tensorrt_llm/_torch/modules/mamba/selective_state_update.py
The selective_state_update_mtp_ssm_cache_trtllm function stages non-contiguous state inputs into a contiguous state_in copy before calling the CUDA op, then copies the updated result back to the original state when staging was required and state updates are enabled.
Caller-side tensor contiguity for Mamba decoder
tensorrt_llm/_torch/modules/mamba/mamba2_mixer.py
The MTP decode path passes .contiguous() versions of x_d_4d, B_d_4d, and C_d_4d to the selective state update function; an inline comment clarifies that the Triton + flashinfer path requires contiguous/alignment-friendly tensors.
Mamba replay configuration default
tensorrt_llm/_torch/pyexecutor/_util.py
The TRTLLM_USE_MAMBA_REPLAY environment variable default is changed from '1' to '0', disabling replay by default when unset.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete and lacks required sections. The Title field is empty (showing only template placeholder), Description section is minimal without explaining the actual changes or rationale, and Test Coverage section is completely empty. Add a proper PR title following the template format (e.g., [TRTLLM-XXXX][feat] Disable mamba replay by default), expand the Description section to explain what changes were made and why, and document the test coverage for the replay-disabling and contiguity fix changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: disabling mamba replay by default, which aligns with the primary objective of the pull request.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@tijyojwad

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49984 [ run ] triggered by Bot. Commit: 731d779 Link to invocation

@Tabrizian Tabrizian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

approving executor changes.

Comment thread tensorrt_llm/_torch/modules/mamba/selective_state_update.py Outdated
tensor.contiguous() already returns self when contiguous, so the
explicit is_contiguous() check is unnecessary.

Signed-off-by: tijyojwad <1127155+tijyojwad@users.noreply.github.com>
@tijyojwad

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@github-actions

Copy link
Copy Markdown

⚠️ Bot command ignored: The /bot command must appear at the very beginning of the comment (no leading blank lines or spaces). Please post a new comment with /bot as the first character.

@tijyojwad

Copy link
Copy Markdown
Contributor Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49993 [ run ] triggered by Bot. Commit: 8fed4c8 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49984 [ run ] completed with state ABORTED. Commit: 731d779

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49993 [ run ] completed with state FAILURE. Commit: 8fed4c8
/LLM/main/L0_MergeRequest_PR pipeline #39558 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

@Wanli-Jiang

Copy link
Copy Markdown
Collaborator

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50033 [ run ] triggered by Bot. Commit: 8fed4c8 Link to invocation

@Wanli-Jiang
Wanli-Jiang enabled auto-merge (squash) May 23, 2026 10:12
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50033 [ run ] completed with state SUCCESS. Commit: 8fed4c8
/LLM/main/L0_MergeRequest_PR pipeline #39595 completed with status: 'SUCCESS'

CI Report

Link to invocation

@Wanli-Jiang
Wanli-Jiang merged commit d741a66 into NVIDIA:main May 23, 2026
8 checks passed
KleinBlueC pushed a commit to KleinBlueC/TensorRT-LLM that referenced this pull request May 26, 2026
Signed-off-by: Wanli Jiang <35160485+Wanli-Jiang@users.noreply.github.com>
Signed-off-by: tijyojwad <1127155+tijyojwad@users.noreply.github.com>
Co-authored-by: Wanli Jiang <35160485+Wanli-Jiang@users.noreply.github.com>
bmarimuthu-nv pushed a commit to nv-auto-deploy/TensorRT-LLM that referenced this pull request May 28, 2026
Signed-off-by: Wanli Jiang <35160485+Wanli-Jiang@users.noreply.github.com>
Signed-off-by: tijyojwad <1127155+tijyojwad@users.noreply.github.com>
Co-authored-by: Wanli Jiang <35160485+Wanli-Jiang@users.noreply.github.com>
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.

5 participants