Skip to content

[Bugfix][GLM-5.3-Flash] Fix fp8_fp4_paged_mqa_logits MQA kpool varlen path for speculative decode - #56811

Closed
wongsingfo wants to merge 1 commit into
vllm-project:mainfrom
wongsingfo:fix-mqa
Closed

wongsingfo wants to merge 1 commit into
vllm-project:mainfrom
wongsingfo:fix-mqa

Conversation

@wongsingfo

@wongsingfo wongsingfo commented Sep 14, 2026

Copy link
Copy Markdown

Purpose

Pass decode_metadata.indices to fp8_fp4_paged_mqa_logits in the kpool sparse attention indexer decode path.

For flattened speculative decode, the indexer metadata builder flattens multiple query tokens from the same request into individual rows and keeps request indices so that those rows can still be associated with their original request. See DeepseekV32IndexerMetadataBuilder in vllm/v1/attention/backends/mla/indexer.py.

On SM100, DeepGEMM supports varlen paged MQA logits. It uses consecutive equal request indices to identify query rows belonging to the same request and process them together.

However, the kpool logits call did not pass decode_metadata.indices to fp8_fp4_paged_mqa_logits. As a result, the metadata could be generated for the varlen path (is_varlen=true), while the consuming DeepGEMM kernel was instantiated as is_varlen=false with next_n=1.

This mismatch does not affect correctness, but significantly hurts performance because each flattened query row is effectively handled independently instead of using the varlen grouping information.

This issue is specific to SM100. The varlen paged MQA logits path is currently enabled only for SM100; other architectures such as SM90 do not use this DeepGEMM varlen path.

Test Plan

Run an end-to-end test with the GLM-5.3-Flash model using the following configuration:

Context length: 120K
Batch size: 40
Speculative decoding steps: 5

Use Nsight Systems (nsys) to capture the execution trace and compare the sm100_paged_mqa_logits kernel latency before and after the change.

Test Result

The change enables the varlen kernel (is_varlen=true) and reduces the kernel latency from 214.304 μs to 51.808 μs, corresponding to a 4.14× speedup.

before: 
void deep_gemm::sm100_paged_mqa_logits<(bool)0, (unsigned int)1, (unsigned int)32, (unsigned int)128, (unsigned int)64, (bool)1, (bool)0, (unsigned int)3, (unsigned int)5, (unsigned int)256, (unsigned int)16, (unsigned int)128, (unsigned int)256, float, float, (unsigned int)2>(unsigned int, unsigned int, unsigned int, const unsigned int *, T14 *, const unsigned int *, const unsigned int *, const unsigned int *, CUtensorMap_st, CUtensorMap_st, CUtensorMap_st, CUtensorMap_st, CUtensorMap_st)
Begins: 1.77108s
Ends: 1.7713s (+214.304 μs)
grid:  <<<152, 1, 1>>>
block: <<<384, 1, 1>>>

after:
void deep_gemm::sm100_paged_mqa_logits<(bool)0, (unsigned int)1, (unsigned int)32, (unsigned int)128, (unsigned int)64, (bool)1, (bool)1, (unsigned int)3, (unsigned int)5, (unsigned int)256, (unsigned int)16, (unsigned int)128, (unsigned int)256, float, float, (unsigned int)2>(unsigned int, unsigned int, unsigned int, const unsigned int *, T14 *, const unsigned int *, const unsigned int *, const unsigned int *, CUtensorMap_st, CUtensorMap_st, CUtensorMap_st, CUtensorMap_st, CUtensorMap_st)
Begins: 1.505s
Ends: 1.50505s (+51.808 μs)
grid:  <<<152, 1, 1>>>
block: <<<384, 1, 1>>>

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.

Signed-off-by: Chengke <chengke.ck@outlook.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.

@github-actions

Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

PRs do not trigger a full CI run by default. Reviewers with write access and configured trusted contributors can comment /ci run for upstream CI or /amd-ci run for AMD CI only whenever CI signals are needed.

Once the PR is approved or has the ready label, the PR author can also use the corresponding /ci run, /ci retry, and /ci cancel commands, or their /amd-ci variants. New commits do not start upstream CI automatically.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

Agent Guidelines

IMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban.

🚀

@mergify mergify Bot added the bug Something isn't working label Sep 14, 2026
@wongsingfo wongsingfo changed the title [Bugfix][Sparse Attention] Pass decode indices to paged MQA logits [Bugfix][GLM-5.3-Flash] Fix MQA kpool varlen path for speculative decode Sep 14, 2026
@mergify mergify Bot added the glm label Sep 14, 2026
@wongsingfo wongsingfo changed the title [Bugfix][GLM-5.3-Flash] Fix MQA kpool varlen path for speculative decode [Bugfix][GLM-5.3-Flash] Fix fp8_fp4_paged_mqa_logits MQA kpool varlen path for speculative decode Sep 14, 2026
@wongsingfo

Copy link
Copy Markdown
Author

Closing this as already covered in #55270.

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

Labels

bug Something isn't working glm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant