Skip to content

[Kernel] Warm up hybrid GDN/Mamba/MRoPE kernels - #43642

Closed
lesj0610 wants to merge 26 commits into
vllm-project:mainfrom
lesj0610:lesj/hybrid-gdn-mamba-mrope-jit-warmup-20260526
Closed

lesj0610 wants to merge 26 commits into
vllm-project:mainfrom
lesj0610:lesj/hybrid-gdn-mamba-mrope-jit-warmup-20260526

Conversation

@lesj0610

@lesj0610 lesj0610 commented May 26, 2026

Copy link
Copy Markdown
Contributor

Purpose

Hybrid Qwen-style GDN/Mamba/MRoPE models can trigger Triton compilation during the first inference request when startup warmup does not cover the exact runtime compile keys. This revision migrates the remaining warmups to the shared kernel-owned warmup contract and removes coverage that is already provided by current upstream main.

Changes

  • Merge the latest upstream main and remove duplicate warmups for zero-KV blocks, slot mapping, causal convolution, fused post-convolution, fused sigmoid update, and chunked GDN prefill.
  • Add kernel-owned VllmJitKernel implementations for packed recurrent GDN decode and MRoPE.
  • Route runtime launches and warmup compilation through the same owners and exact CompileKey definitions.
  • Use compile-only warmup calls under enable_jit_warmup; no dummy model execution or startup synchronization is added.
  • Cover the integer specialization buckets used by MRoPE and the static meta-parameters used by packed GDN decode.

Test Plan

.venv/bin/python -m pytest \
  tests/model_executor/test_hybrid_gdn_mamba_mrope_warmup.py -q

CUDA_VISIBLE_DEVICES=1 .venv/bin/python -m pytest \
  tests/kernels/core/test_mrope.py -q

pre-commit run --files \
  vllm/model_executor/layers/mamba/gdn/qwen_gdn_linear_attn.py \
  vllm/model_executor/layers/rotary_embedding/mrope.py \
  vllm/model_executor/warmup/hybrid_gdn_mamba_mrope_warmup.py \
  vllm/model_executor/warmup/kernel_warmup.py \
  vllm/third_party/flash_linear_attention/ops/fused_recurrent.py \
  tests/model_executor/test_hybrid_gdn_mamba_mrope_warmup.py

GPU compile-only and direct numerical smoke tests were run on GPU 1 (RTX 3090).

Test Result

  • Shared-contract unit tests: 3 passed.
  • MRoPE native-versus-CUDA tests: 12 passed.
  • Compile-only smoke compiled both MRoPE keys and the packed recurrent GDN key.
  • Direct packed recurrent GDN runtime comparison had maximum absolute error 0.007812, within the existing test tolerance.
  • All applicable pre-commit hooks, including mypy, passed.

The existing packed recurrent numerical pytest still fails for fp16/bf16 on both this branch and an unmodified latest-upstream worktree; fp32 passes. This is therefore not introduced by this revision.

AI assistance: Codex.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces kernel warmup mechanisms for hybrid GDN/Mamba and MRoPE models to prevent JIT compilation overhead and potential OOM issues during the first real inference requests. It adds dedicated warmup routines for prefill and decode paths, integrates these into the main kernel warmup pipeline, ensures robust cleanup of KV connector states on failure, and adds comprehensive unit tests. No review comments were provided, so there is no feedback to address.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f92cd20cbc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vllm/model_executor/warmup/kernel_warmup.py Outdated
@mergify

mergify Bot commented May 26, 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, @lesj0610.

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

@mergify mergify Bot added the needs-rebase label May 26, 2026
@lesj0610
lesj0610 force-pushed the lesj/hybrid-gdn-mamba-mrope-jit-warmup-20260526 branch from 290e9fa to 8707f60 Compare May 26, 2026 07:14
@mergify mergify Bot removed the needs-rebase label May 26, 2026
@mergify

mergify Bot commented Jun 12, 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, @lesj0610.

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

@mergify mergify Bot added the needs-rebase label Jun 12, 2026
lesj0610 added 3 commits June 20, 2026 09:55
Warm the runtime GDN/Mamba, MRoPE, scheduler-output, single-request decode, and KV block zeroing variants used by hybrid models before the first request.

Co-authored-by: OpenAI Codex <codex@openai.com>

Co-authored-by: Claude <noreply@anthropic.com>

Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
@lesj0610
lesj0610 force-pushed the lesj/hybrid-gdn-mamba-mrope-jit-warmup-20260526 branch from 8707f60 to 3dde6c6 Compare June 20, 2026 01:03
@mergify mergify Bot removed the needs-rebase label Jun 20, 2026
lesj0610 and others added 9 commits June 20, 2026 15:51
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
This reverts commit f837c9d.

Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Keep the direct GDN/Mamba/MRoPE model-internal warmup, but drop the V1 scheduler-output and single-request synthetic warmup path from kernel_warmup.

Move the remaining KV connector failure coverage to the generic V1 warmup tests.

Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Remove KV block zeroer warmup from the hybrid GDN/Mamba/MRoPE PR so zeroing remains owned by the dedicated KV zeroer warmup PR. The hybrid PR now covers only model-specific GDN/Mamba and MRoPE startup warmup.

Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: SeongJun Lee <lesj0610@gmail.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
lesj0610 added 2 commits June 30, 2026 09:00
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
@mergify mergify Bot removed the needs-rebase label Jun 30, 2026
@mergify

mergify Bot commented Jun 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, @lesj0610.

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

@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 @lesj0610

Similar thing to what I mentioned in another of your PRs. 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.

However, I think a sync with upstream is needed. Some of the kernels warmed up on this PR are already covered upstream, while some of them are not. Thanks!

Adding your PR to the list: #49349

lesj0610 added 3 commits July 22, 2026 20:05
…ontract-20260722

# Conflicts:
#	vllm/model_executor/warmup/kernel_warmup.py
#	vllm/model_executor/warmup/qwen_triton_warmup.py
#	vllm/model_executor/warmup/sparse_mla_triton_warmup.py

Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
lesj0610 and others added 2 commits July 28, 2026 12:38
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
@mergify

mergify Bot commented Jul 28, 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, @lesj0610.

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

@mergify mergify Bot added the needs-rebase label Jul 28, 2026
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
@mergify mergify Bot removed the needs-rebase label Jul 29, 2026
@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, @lesj0610.

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

@mergify mergify Bot added the needs-rebase label Jul 30, 2026
Preserve both hybrid GDN/Mamba/MRoPE and Kimi K3 JIT warmup hooks.

Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: lesj0610 <lesj0610@users.noreply.github.com>
@mergify mergify Bot removed the needs-rebase label Aug 1, 2026
@mergify

mergify Bot commented Aug 13, 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, @lesj0610.

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

@mergify mergify Bot added the needs-rebase label Aug 13, 2026
@mergify mergify Bot removed the needs-rebase label Aug 14, 2026
lesj0610 added a commit to lesj0610/vllm that referenced this pull request Aug 22, 2026
Upstream's warmup infrastructure (vllm-project#50174) registers these kernels through
its own provider registry, so the fork-side warmup hooks are redundant.
Reverse-apply the deltas of the upstream warmup PRs (vllm-project#42193, vllm-project#42215,
vllm-project#43642, vllm-project#46446) so every file they touched matches origin/main:

- Drop the fused MoE, TurboQuant, hybrid GDN/Mamba/MRoPE and block-table
  warmup modules plus their tests and kernel_warmup wiring.
- Restore triton_decode_attention, triton_turboquant_decode,
  fused_recurrent and fused_moe to upstream (removes the VllmJitKernel
  wrappers those PRs introduced).
- Keep `import math` in mrope.py: it is used by the bounded M-RoPE cache
  work, not by the reverted warmup code.
@lesj0610 lesj0610 closed this Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants