Skip to content

Add split-k decode kernel for skip softmax#1941

Draft
kaix-nv wants to merge 20 commits into
mainfrom
kaix/splitk_skip_softmax
Draft

Add split-k decode kernel for skip softmax#1941
kaix-nv wants to merge 20 commits into
mainfrom
kaix/splitk_skip_softmax

Conversation

@kaix-nv

@kaix-nv kaix-nv commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Type of change: ?
New feature.

Adds skip-softmax support to the dedicated paged decode kernel and routes compatible one-token vLLM decode launches
through it.

  • Uses one sequential KV split with 32-token tiles so skip decisions follow the running softmax maximum.
  • Preserves the existing 32-split, 128-token schedule when skip-softmax is disabled.
  • Supports skip-softmax together with NVFP4 P/V QDQ.
  • Validates thresholds and passes them as runtime kernel arguments to avoid threshold-dependent recompilation.
  • Keeps prefill, multi-token decode, and unknown sparse options on the shared Triton attention kernel.
  • Preserves the existing FlashAttention and FlashInfer fallback behavior.

Usage

 from modelopt.torch.kernels.common.attention.decode_attention import attention_decode

  output = attention_decode(
      query,
      key_cache,
      value_cache,
      block_table,
      sequence_lengths,
      skip_softmax_threshold=0.1,
      p_qdq="nvfp4",
      p_qdq_amax=1.0,
      v_qdq="nvfp4",
      v_qdq_amax=1.0,
  )

Testing

Before your PR is "Ready for review"

Make sure you read and follow Contributor guidelines and your commits are signed (git commit -s -S).

Make sure you read and follow the Security Best Practices (e.g. avoiding hardcoded trust_remote_code=True, torch.load(..., weights_only=False), pickle, etc.).

  • Is this change backward compatible?: ✅ / ❌ / N/A
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: ✅ / ❌ / N/A
  • Did you write any new necessary tests?: ✅ / ❌ / N/A
  • Did you update Changelog?: ✅ / ❌ / N/A
  • Did you get Claude approval on this PR?: ✅ / ❌ / N/A

Additional Information

kaix-nv added 20 commits July 3, 2026 18:57
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Adapt the per-head split-K and FP32 combine structure from internal ModelOpt commit 6c08d08. Reuse the compact branch paged loaders and NVFP4 P/V QDQ helpers, while preserving the Option-3 pristine V tail.

Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
Signed-off-by: Kai Xu <kaix@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 55ed7de4-8ac1-4b17-8ced-62e028eb4f4c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kaix/splitk_skip_softmax

Comment @coderabbitai help to get the list of available commands.

@kaix-nv kaix-nv changed the title Kaix/splitk skip softmax Add split-k decode kernel for skip softmax Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://NVIDIA.github.io/Model-Optimizer/pr-preview/pr-1941/

Built to branch gh-pages at 2026-07-08 01:30 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 3.92157% with 441 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.59%. Comparing base (75b5803) to head (117725f).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
.../torch/sparsity/attention_sparsity/plugins/vllm.py 0.00% 206 Missing ⚠️
...torch/kernels/common/attention/decode_attention.py 0.00% 134 Missing ⚠️
...lopt/torch/kernels/quantization/attention/v_qdq.py 0.00% 40 Missing ⚠️
...delopt/torch/kernels/common/attention/triton_fa.py 31.57% 39 Missing ⚠️
modelopt/torch/quantization/plugins/vllm.py 0.00% 18 Missing ⚠️
...t/torch/kernels/quantization/common/nvfp4_quant.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1941      +/-   ##
==========================================
- Coverage   61.21%   60.59%   -0.62%     
==========================================
  Files         515      521       +6     
  Lines       57245    61650    +4405     
==========================================
+ Hits        35043    37359    +2316     
- Misses      22202    24291    +2089     
Flag Coverage Δ
unit 55.02% <3.92%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant