Skip to content

[Perf] Warm up hybrid Mamba2 Triton kernels reported by the JIT monitor - #48363

Open
Majid-Taheri wants to merge 1 commit into
vllm-project:mainfrom
Majid-Taheri:warmup-hybrid-jit-kernels
Open

Majid-Taheri wants to merge 1 commit into
vllm-project:mainfrom
Majid-Taheri:warmup-hybrid-jit-kernels

Conversation

@Majid-Taheri

@Majid-Taheri Majid-Taheri commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Purpose

On hybrid Mamba2 models (NemotronH and other MambaMixer2 models), three Triton kernels compile during the first inference request, not at warmup. Each one causes a first-request latency spike (this is a cold-start / tail-latency fix, not a steady-state throughput change):

_zero_kv_blocks_kernel
_compute_slot_mapping_kernel
_causal_conv1d_fwd_kernel

This is tracked in #43009

Why they are unwarmed today (checked on main @ 429f405):

  • _causal_conv1d_fwd_kernel: _warmup_ssd_kernels warms only the SSD chunk kernels, and runs before the conv cache exists.
  • _zero_kv_blocks_kernel: warmed only for Qwen, but every hybrid model needs KV-block zeroing.
  • _compute_slot_mapping_kernel: generic warmup covers strides (3, 16) but not stride 1, which hybrid models hit.

Change

Add hybrid_mamba_triton_warmup, keyed on the presence of MambaMixer2 layers (covers NemotronH, Granite hybrid, Falcon-H1, Codestral Mamba, Zamba). It reuses the Qwen warmup helpers and adds a conv1d warmup that uses the real conv weights, routes a dummy token to the null block, and sweeps the 8 pointer-alignment cases (a single warmup call covers only one, so mixed decode+prefill batches kept recompiling without the sweep).

One new file plus a 1-call hook in kernel_warmup. No-op for models without MambaMixer2 layers.

Test Result

RTX PRO 6000 Blackwell (sm_120), Nemotron-3-Super-120B-NVFP4, --jit-monitor-mode=warn. Before: all 3 warnings on the first request (reproduced in 3 cold serves). After: zero warnings across 12 requests (sequential and concurrent mixed batches). Offline replay of production-shaped calls adds no new JIT keys.

Precedents and relation to #43642

Precedents: #21955, #22215 (DeepGEMM hot-path warmup), #46750/#47546 (Qwen warmup this extends), #46621 (JIT diagnostics).

#43642 warms the GDN/Qwen bucket. This PR is complementary: it covers the MambaMixer2 bucket that #43642 does not. Happy to coordinate the shared kernel_warmup.py touch points with @lesj0610.

On hybrid Mamba2 models (e.g. NemotronH), the JIT monitor reports three
Triton kernels compiling during the first inference request, each causing
a latency spike on an otherwise fully warmed server:

- _causal_conv1d_fwd_kernel: the Mamba2 SSD warmup covers only the SSD
  chunk kernels, and it runs in the profile pass before the conv cache
  exists, so the prefill conv kernel cannot be warmed there.
- _zero_kv_blocks_kernel: warmed only for Qwen model types (vllm-project#46750).
- _compute_slot_mapping_kernel: the generic block-table warmup misses the
  block_table_stride == 1 specialization that hybrid models hit, because
  their mamba-aligned attention block size yields one block per request.

Add a hybrid_mamba_triton_warmup step, mirroring the Qwen Triton warmup
but keyed on the presence of MambaMixer2 layers instead of model_type, so
it covers NemotronH, Granite hybrid, Falcon-H1, Codestral Mamba, etc. The
conv1d warmup uses the layer's real weights and conv cache with a single
dummy token routed to the null block, so the JIT key matches production
prefill without touching a real cache line.

Signed-off-by: Majid Taheri Andani <tahemaji@amazon.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@LopezCastroRoberto LopezCastroRoberto 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.

Hey @Majid-Taheri

We're currently migrating all kernel warmups to a shared warmup contract. See #47451, RFC: #47456.

Would you mind migrating these warmups to conform to that shared contract? It would help keep the warmup infrastructure consistent and make future maintenance easier.

Since you already identified the compile-keys, I think it should be easy for you to do this migration :) Thanks! I add your PR to this list: #49349

@mergify

mergify Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @Majid-Taheri.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants