Skip to content

[Kernel] Add support for Flashinfer Mamba SSU algorithm selection - #50157

Merged
vllm-bot merged 6 commits into
vllm-project:mainfrom
amitz-nv:perf/flashinfer-mamba-ssu-algorithm
Aug 4, 2026
Merged

[Kernel] Add support for Flashinfer Mamba SSU algorithm selection#50157
vllm-bot merged 6 commits into
vllm-project:mainfrom
amitz-nv:perf/flashinfer-mamba-ssu-algorithm

Conversation

@amitz-nv

@amitz-nv amitz-nv commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Purpose

Allow choosing the Flashinfer Mamba SSU algorithm.
The new command line argument is --mamba-ssu-algorithm.

On some use-cases of Nemotron 3 Nano NVFP4 (like ISL/OSL=1k/8k), using "horizontal" instead of "auto" (which eventually chooses "vertical") improves throughput.

Test Plan

On Nemotron 3 Nano NVFP4 with & without --mamba-ssu-algorithm horizontal:

  • Throughput benchmark with aiperf (3 runs to account for variance), on a single H100 GPU
  • Accuracy test with GSM8K, on TP=2

Test Result

Accuracy test

vLLM command:

MODEL=nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-NVFP4
vllm serve "$MODEL" \
  --served-model-name "$MODEL" \
  --trust-remote-code \
  --tensor-parallel-size 2 \
  --max-model-len 8192 \
  --mamba-backend flashinfer \
  --host 0.0.0.0 \
  --port 8000

To run with "horizontal", add:

--mamba-ssu-algorithm horizontal

lm_eval command:

MODEL=nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-NVFP4

lm_eval \
  --model local-completions \
  --model_args "base_url=http://127.0.0.1:8000/v1/completions,model=$MODEL,tokenized_requests=False,tokenizer_backend=None,num_concurrent=512,timeout=120,max_retries=5,max_length=8192" \
  --tasks gsm8k \
  --num_fewshot 5 \
  --batch_size auto \
  --seed 42 \
  --output_path "$RESULT_DIR"

Results:

Without --mamba-ssu-algorithm horizontal:

local-completions ({'base_url': 'http://127.0.0.1:37524/v1/completions', 'model': 'nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-NVFP4', 'tokenized_requests': False, 'tokenizer_backend': None, 'num_concurrent': 512, 'timeout': 120, 'max_retries': 5, 'max_length': 8192}), gen_kwargs: ({}), limit: None, num_fewshot: 5, batch_size: auto
|Tasks|Version|     Filter     |n-shot|  Metric   |   |Value |   |Stderr|
|-----|------:|----------------|-----:|-----------|---|-----:|---|-----:|
|gsm8k|      3|flexible-extract|     5|exact_match|↑  |0.4390|±  |0.0137|
|     |       |strict-match    |     5|exact_match|↑  |0.8423|±  |0.0100|

With --mamba-ssu-algorithm horizontal:

local-completions ({'base_url': 'http://127.0.0.1:37525/v1/completions', 'model': 'nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-NVFP4', 'tokenized_requests': False, 'tokenizer_backend': None, 'num_concurrent': 512, 'timeout': 120, 'max_retries': 5, 'max_length': 8192}), gen_kwargs: ({}), limit: None, num_fewshot: 5, batch_size: auto
|Tasks|Version|     Filter     |n-shot|  Metric   |   |Value |   |Stderr|
|-----|------:|----------------|-----:|-----------|---|-----:|---|-----:|
|gsm8k|      3|flexible-extract|     5|exact_match|↑  |0.4261|±  |0.0136|
|     |       |strict-match    |     5|exact_match|↑  |0.8438|±  |0.0100|

Throughput benchmark

vLLM command without horizontal:

MODEL=nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-NVFP4

VLLM_MOE_ROUTING_SIMULATION_STRATEGY=uniform_random \
vllm serve "$MODEL" \
  --served-model-name "$MODEL" \
  --max-num-seqs 512 \
  --trust-remote-code \
  --max-model-len 52000 \
  --max-num-batched-tokens 32768 \
  --enable-prefix-caching \
  --async-scheduling \
  --quantization modelopt_fp4 \
  --mamba-backend flashinfer \
  --mamba-cache-mode align \
  --mamba-ssm-cache-dtype float16 \
  --enable-mamba-cache-stochastic-rounding \
  --mamba-cache-philox-rounds 5 \
  --host 0.0.0.0 \
  --port 8000

To run with "horizontal", add:

--mamba-ssu-algorithm horizontal

AIPerf command:

MODEL=nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-NVFP4

aiperf profile \
  --model "$MODEL" \
  --tokenizer "$MODEL" \
  --url http://127.0.0.1:8000 \
  --endpoint-type chat \
  --ui-type None \
  --streaming \
  --concurrency 512 \
  --request-count 1024 \
  --warmup-request-count 16 \
  --isl 1024 \
  --isl-stddev 0 \
  --osl 8192 \
  --osl-stddev 0 \
  --random-seed 42 \
  --use-server-token-count \
  --tokenizer-trust-remote-code \
  --extra-inputs temperature:0 \
  --extra-inputs ignore_eos:true \
  --artifact-dir "$RESULT_DIR"

Results (on 1xH100):

Configuration Run 1 Run 2 Run 3 Mean output TPS/GPU
FlashInfer default 13,061.091 13,078.941 13,087.962 13,075.998
FlashInfer horizontal 13,914.585 13,790.473 13,902.849 13,869.302
Improvement +6.535% +5.440% +6.226% +6.067%

Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

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

Comment thread vllm/config/mamba.py
Comment thread vllm/config/mamba.py Outdated
Comment thread vllm/config/mamba.py Outdated
@@ -46,6 +49,12 @@ class MambaConfig:
generation. 0 uses the Triton default. Higher values improve randomness
quality at the cost of compute."""

ssu_algorithm: MambaSSUAlgorithm = "auto"

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.

Can we have the default value as None, and if we're using FI as mamba backend, then we can resolve it as "auto"?

Comment thread vllm/engine/arg_utils.py

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.

Can we add a log_once with the picked algorithm somwhere?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note that when "auto" is used, vLLM doesn't know what flashinfer eventually chose.

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.

I think all of these tests don't really belong here, maybe in tests/kernels/mamba/test_ssu_dispatch.py ? And some of them look redundant to me.

@amitz-nv
amitz-nv force-pushed the perf/flashinfer-mamba-ssu-algorithm branch 2 times, most recently from 550d969 to 57f1c10 Compare July 29, 2026 14:12
@amitz-nv
amitz-nv requested a review from amirkl94 July 29, 2026 14:13
Comment thread tests/engine/test_arg_utils.py Outdated

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

LGTM

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

LGTM

@mgoin
mgoin enabled auto-merge (squash) August 3, 2026 14:52
@mgoin mgoin added performance Performance-related issues ready ONLY add when PR is ready to merge/full CI is needed nvidia labels Aug 3, 2026
@github-project-automation github-project-automation Bot moved this to Ready in NVIDIA Aug 3, 2026
auto-merge was automatically disabled August 3, 2026 15:45

Head branch was pushed to by a user without write access

@amitz-nv
amitz-nv force-pushed the perf/flashinfer-mamba-ssu-algorithm branch from cd3e4db to 88ea1c8 Compare August 3, 2026 15:45
amitz-nv and others added 6 commits August 4, 2026 10:49
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: amitz-nv <203509407+amitz-nv@users.noreply.github.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: amitz-nv <203509407+amitz-nv@users.noreply.github.com>
Signed-off-by: amitz-nv <203509407+amitz-nv@users.noreply.github.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: amitz-nv <203509407+amitz-nv@users.noreply.github.com>
Signed-off-by: amitz-nv <203509407+amitz-nv@users.noreply.github.com>
Signed-off-by: amitz-nv <203509407+amitz-nv@users.noreply.github.com>
@amitz-nv
amitz-nv force-pushed the perf/flashinfer-mamba-ssu-algorithm branch from 88ea1c8 to ee4bc88 Compare August 4, 2026 07:49
@vllm-bot
vllm-bot merged commit 52c0e3c into vllm-project:main Aug 4, 2026
106 of 119 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to Done in NVIDIA Aug 4, 2026
@khluu khluu added this to the v0.27.0 cherry picks milestone Aug 6, 2026
khluu pushed a commit that referenced this pull request Aug 7, 2026
…0157)

Signed-off-by: amitz-nv <203509407+amitz-nv@users.noreply.github.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
(cherry picked from commit 52c0e3c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nvidia performance Performance-related issues ready ONLY add when PR is ready to merge/full CI is needed

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants