[https://nvbugs/6221483][fix] Revert auto_deploy _mamba_ssm_prepare_metadata to pre-#13566 state - #14640
Conversation
…etadata to pre-NVIDIA#13566 state PR NVIDIA#13566 (998f418, "Switch to cu_seqlens_to_chunk_indices_offsets_triton with total_seqlens/extra_chunks") introduced a CUDA-graph-capture-time crash on NemotronSuperV3 MTP. The new `_mamba_ssm_prepare_metadata` trusts CPU-side `batch_info_host.get_num_tokens()` and `seq_len_host` for the `total_seqlens`, `extra_chunks`, and `output_size` shortcuts that were added to avoid GPU->CPU sync. During CUDA-graph warmup the CPU host tensors carry dummy values that do not match GPU-side `seq_len`/`cu_seqlen`, so the internal `index_select` in `repeat_interleave(..., output_size=k)` walks off the source tensor and fires `Indexing.cu:1515 indexSelectSmallIndex: srcIndex < srcSelectDimSize`. Bisection on upstream/main + full repro_nvbug6221483.yaml showed every smaller revert (S1-only, S2-only, S3-only, S1+S2, S1+S2+S3, function-swap-only, keep signature only) still crashes. Reverting mamba_backend_common.py in full to its pre-NVIDIA#13566 contents passes the repro (10/10 prompts, 0 asserts). mamba2_metadata.py and waives.txt parts of NVIDIA#13566 are left untouched. This re-introduces the GPU->CPU sync that NVIDIA#13566 was trying to remove (nvbug 6120981 EP-deadlock prevention). A follow-up can restore that optimization by branching on torch.cuda.is_current_stream_capturing(). Fixes NVIDIA#14595 Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com>
📝 WalkthroughWalkthroughThis PR simplifies the cached SSM metadata preparation in the Mamba backend by removing the ChangesSSM metadata computation simplification
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/bot run --extra-stage "DGX_B200-4_GPUs-AutoDeploy-1, DGX_H100-4_GPUs-AutoDeploy-1" |
|
PR_Github #50597 [ run ] triggered by Bot. Commit: |
…ixed by previous commit Removes the two SKIP entries from tests/integration/test_lists/waives.txt that were tagged with NVBUG 6221483: - accuracy/test_llm_api_autodeploy.py::TestNemotronSuperV3::test_mtp[nvfp4_ws4_80gb-trtllm] - accuracy/test_llm_api_autodeploy.py::TestNemotronUltraV3::test_accuracy[nvfp4-4] Both share the same mamba_backend_common.py code path that was reverted to its pre-NVIDIA#13566 state in the previous commit, so the fix should cover both. The fp8 variant (TestNemotronSuperV3::test_mtp[fp8_ws4_80gb-trtllm]) was never in waives.txt - it was running and failing on DGX_H100-4_GPUs stage already; the AutoDeploy CI stages triggered on this PR exercise it. Fixes NVIDIA#14595 Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com>
|
/bot run --extra-stage "DGX_B200-4_GPUs-AutoDeploy-1, DGX_H100-4_GPUs-AutoDeploy-1" |
|
PR_Github #50597 [ run ] completed with state
|
Signed-off-by: Gal Hubara-Agam <96368689+galagam@users.noreply.github.com>
|
/bot run --stage-list "DGX_B200-4_GPUs-AutoDeploy-1, DGX_H100-4_GPUs-AutoDeploy-1" |
|
PR_Github #50687 [ run ] triggered by Bot. Commit: |
|
PR_Github #50687 [ run ] completed with state
|
|
/bot run --stage-list "DGX_B200-4_GPUs-AutoDeploy-1, DGX_H100-4_GPUs-AutoDeploy-1" |
|
PR_Github #50723 [ run ] triggered by Bot. Commit: |
|
PR_Github #50723 [ run ] completed with state |
|
/bot run |
|
PR_Github #50748 [ run ] triggered by Bot. Commit: |
|
PR_Github #50748 [ run ] completed with state |
PR NVIDIA#14640 (merged 2026-05-28) fixed the mamba-revert bug that caused these AutoDeploy 4-GPU tests to be moved to post_merge. The "Move to post-merge due to https://nvbugspro.nvidia.com/bug/6221483" gate is no longer needed. Move back to pre_merge AutoDeploy 4-GPU blocks in both DGX_B200 and DGX_H100: TestNemotronSuperV3::test_accuracy[bf16-4-attn_dp_off-trtllm] TestNemotronSuperV3::test_accuracy[bf16-4-attn_dp_on-trtllm] (h100 only) TestNemotronSuperV3::test_accuracy[fp8-4-attn_dp_on-trtllm] TestNemotronSuperV3::test_accuracy[nvfp4-4-attn_dp_on-trtllm] (b200 only) TestNemotronSuperV3::test_mtp[nvfp4_ws4_80gb-trtllm] (b200 only) TestNemotronNanoV3::test_accuracy[nvfp4-4-trtllm] (b200 only) Importantly, this brings the only end-to-end MoE all-to-all + attention-DP coverage (TestNemotronSuperV3::test_accuracy[*-attn_dp_on-*]) into pre-merge CI for PR NVIDIA#13723. The post_merge B200 block keeps only the bf16_ws4_180gb MTP variants and the perf-sanity tests, which are gated for separate hardware-availability reasons. Drops a duplicate UltraV3 nvfp4-4 entry that already lived in pre_merge B200. Signed-off-by: greg-kwasniewski1 <213329731+greg-kwasniewski1@users.noreply.github.com>
Summary
tensorrt_llm/_torch/auto_deploy/custom_ops/mamba/mamba_backend_common.pyto its pre-[https://nvbugs/6120981][fix] Switch to cu_seqlens_to_chunk_indices_offsets_triton with total_seqlens/extra_ch #13566 contents._mamba_ssm_prepare_metadatatrusts stale CPU host tensors (batch_info_host.get_num_tokens()andseq_len_host) during CUDA-graph capture warmup; therepeat_interleave(..., output_size=k)shortcut hitsIndexing.cu:1515 indexSelectSmallIndex: srcIndex < srcSelectDimSizewhen the host shadow disagrees with the GPU-sideseq_len/cu_seqlendummies emitted by warmup.upstream/mainshowed every smaller revert (S1-only, S2-only, S3-only, S1+S2, S1+S2+S3, function-swap-only, keep-signature-only) still crashes; only the full file revert passes (see bisection comment on [Bug Report] SuperV3 MTP regression on main introduced by #13566 (NVBUG 6221483) #14595).Changes
tensorrt_llm/_torch/auto_deploy/custom_ops/mamba/mamba_backend_common.py: restore pre-[https://nvbugs/6120981][fix] Switch to cu_seqlens_to_chunk_indices_offsets_triton with total_seqlens/extra_ch #13566 contents (-22 / +4 lines), reverting the imports, theseq_len_hostsignature additions, and the body changes (_extra = compute_extra_chunks_cpu(...), thetotal_seqlens=/extra_chunks=kwargs, and theoutput_size=num_prefill_tokenskwarg). Themamba2_metadata.pyandwaives.txtparts of [https://nvbugs/6120981][fix] Switch to cu_seqlens_to_chunk_indices_offsets_triton with total_seqlens/extra_ch #13566 are intentionally left untouched.Test plan
build_and_run_ad.py --yaml-extra repro_nvbug6221483.yaml(full repro mirroringTestNemotronSuperV3::test_mtp[fp8_ws4_80gb-trtllm]) onupstream/mainwith this fix applied: 10/10 prompts generated, 0Indexing.cuasserts, clean MPI shutdown.DGX_H100-4_GPUs-AutoDeploy-1(ownsfp8_ws4_80gb-trtllm) andDGX_B200-4_GPUs-AutoDeploy-1(ownsnvfp4_ws4_80gb-trtllm) — triggered below.Risk
library-visible — affects the AutoDeploy SSM prepare-metadata custom op. Re-introduces the GPU->CPU sync that #13566 was trying to remove for EP-deadlock prevention (nvbug 6120981). A follow-up that restores that optimization safely (e.g. by branching on
torch.cuda.is_current_stream_capturing()) is a separate task.Fixes #14595
Summary by CodeRabbit
Release Notes