Add Mamba-2 kernels (causal-conv1d + mamba-ssm) to slime image for Nemotron-H - #5225
Open
yeshsurya wants to merge 1 commit into
Open
Add Mamba-2 kernels (causal-conv1d + mamba-ssm) to slime image for Nemotron-H#5225yeshsurya wants to merge 1 commit into
yeshsurya wants to merge 1 commit into
Conversation
…motron-H The slime-pytorch-2.9-cuda12.8 image does not ship the Mamba CUDA kernels, so Megatron's MambaMixer aborts with "MambaSSM is not installed" at model-build time. This blocks training hybrid Mamba-2/MoE models such as Nemotron-H (model_type nemotron_h), whose bridge is already registered in the bundled megatron.bridge and whose rollout is already supported by sglang 0.5.11. Build causal-conv1d v1.5.0.post8 and mamba-ssm v2.3.2.post1 from their pinned git tags (the PyPI sdists omit csrc/*.cpp and fail the ninja build). Version 2.3.2.post1 imports the modern transformers.generation.GenerateDecoderOnlyOutput symbol and guards its optional TileLang (Mamba-3 MIMO) import, so it loads cleanly on this image's transformers with no source patch; --no-deps keeps the curated torch / sglang / tilelang stack pinned. TORCH_CUDA_ARCH_LIST covers A100 (8.0) and H100 (9.0). This pair was validated end-to-end on the cluster (kernels import, Megatron wires the mamba params). smoke_test.py now asserts the causal_conv1d and mamba_ssm.ops.triton kernels Megatron's MambaMixer uses import, and spec.yaml advertises Mamba: "2". Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5999648c-af8f-455b-b1cd-2e9451320aeb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The
slime-pytorch-2.9-cuda12.8curated image does not ship the Mamba CUDA kernels, so Megatron'sMambaMixeraborts withImportError: MambaSSM is not installedat model-build time. This blocks training hybrid Mamba-2 / MoE models such as Nemotron-H (model_type: nemotron_h), even though the image already contains:nemotron_hbridge in the bundledmegatron.bridge(megatron/bridge/models/nemotronh/nemotron_h_bridge.py), andnemotron_hrollout support insglang 0.5.11.Kernels were the only missing piece for end-to-end Nemotron-H post-training.
What
causal-conv1d v1.5.0.post8andmamba-ssm v2.3.2.post1from their pinned git tags after the apex step.csrc/*.cppand fail the ninja build (missing and no known rule to make it).mamba-ssm 2.3.2.post1imports the moderntransformers.generation.GenerateDecoderOnlyOutputsymbol and guards its optional TileLang (Mamba-3 MIMO) import, so it loads cleanly on this image'stransformerswith no source patch.--no-depskeeps the curated torch / sglang / tilelang stack pinned (the image installs a cu128-nightly tilelang for flash-linear-attention; the Mamba-2 path Nemotron-H uses does not need tilelang).TORCH_CUDA_ARCH_LIST="8.0;9.0"covers A100 + H100. Kernel refs are overridableARGs.causal_conv1d+mamba_ssm.ops.tritonkernels Megatron'sMambaMixeruses import, andmamba_ssm >= 2.3.2.Mamba: "2".Validation
The
causal-conv1d 1.5.0.post8+mamba-ssm 2.3.2.post1pair was validated end-to-end against:7on a cluster: both kernels import, and Megatron wires the mamba params (mamba_num_heads=64,mamba_num_groups=8,mamba_state_dim=128,spec=mamba_stack_spec). Image auto-versions viaasset.yaml(version: auto).