Skip to content

[XPU] Fix sparse-MLA metadata sync - #52066

Open
libinta wants to merge 3 commits into
vllm-project:mainfrom
libinta:libinta/glm_fp8_xpu_sparse_mla
Open

[XPU] Fix sparse-MLA metadata sync#52066
libinta wants to merge 3 commits into
vllm-project:mainfrom
libinta:libinta/glm_fp8_xpu_sparse_mla

Conversation

@libinta

@libinta libinta commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fix issue below for sparse-MLA FP8 MoE models (e.g. GLM-5.2, DeepSeek DSA) on Intel GPUs.
Sparse-MLA metadata sync (xpu_mla_sparse.py): The shared MLA layer (mla_attention.py::forward_impl) unconditionally reads num_decodes/num_prefills/num_decode_tokens on every MLA metadata; the CUDA sparse backends carry them via SparseMLACommonMetadataBuilder, but the XPU sparse backend built its own metadata without them, so a sparse-MLA run on XPU crashed with "'XPUMLASparseMetadata' object has no attribute 'num_decode_tokens'". Add the fields and populate them so all tokens route through the top-k sparse MQA path (num_decode_tokens == num_actual_tokens, num_prefills == 0), which this backend already implements for both prefill and decode; this keeps num_mha_tokens at 0 and avoids the dense-MHA prefill branch (whose prefill-only fields this backend does not provide).

Purpose

Test Plan

Test Result


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.

@libinta
libinta requested a review from pavanimajety as a code owner August 12, 2026 23:02

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

@mergify mergify Bot added the intel-gpu Related to Intel GPU label Aug 12, 2026
Comment thread vllm/model_executor/kernels/linear/scaled_mm/xpu.py Outdated
Comment thread vllm/model_executor/kernels/linear/scaled_mm/xpu.py Outdated
@xwu-intel

Copy link
Copy Markdown
Contributor

Related.
#49596
vllm-project/vllm-xpu-kernels#508

@jikunshang

Copy link
Copy Markdown
Member

land https://github.com/vllm-project/vllm/pull/52118/changes to fix this issue. thanks.

@majian4work

Copy link
Copy Markdown
Contributor

Since issue 1 was resolved by another pr, could you split issue 2 into a standalone fix?

The shared MLA layer (mla_attention.py::forward_impl) reads
num_decodes/num_prefills/num_decode_tokens on every MLA metadata (it asserts
they are not None and uses num_decode_tokens to split MQA vs dense-MHA
tokens). The CUDA sparse backends supply these via
SparseMLACommonMetadataBuilder, but the XPU sparse backend builds its own
metadata and omitted them, so a sparse-MLA (DeepSeek DSA / GLM) run on XPU
crashed with:

    'XPUMLASparseMetadata' object has no attribute 'num_decode_tokens'

Add the fields and populate them so all tokens route through the top-k sparse
MQA path (num_decode_tokens == num_actual_tokens, num_prefills == 0), which
this backend already implements for both prefill and decode. This keeps the
shared layer's num_mha_tokens at 0 and never enters the dense-MHA prefill
branch (whose prefill-only fields this backend does not provide).

XPU-only; does not touch CUDA/ROCm/CPU backends. The ragged-N FP8 block-scale
GEMM fix that previously accompanied this change is now covered upstream by
vllm-project#52118, so it is dropped here.

Signed-off-by: Libin Tang <libin.tang@intel.com>
@libinta
libinta force-pushed the libinta/glm_fp8_xpu_sparse_mla branch from 583f35d to 48ccd0b Compare August 14, 2026 05:30
@libinta libinta changed the title [XPU] Fix ragged-N FP8 block-scale GEMM and sparse-MLA metadata sync [XPU] Fix sparse-MLA metadata sync Aug 14, 2026

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

@jikunshang jikunshang added the verified Run pre-commit for new contributors without triggering other tests label Aug 14, 2026
@jikunshang

Copy link
Copy Markdown
Member

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #83859 for commit 48ccd0bca03b.

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

Labels

intel-gpu Related to Intel GPU verified Run pre-commit for new contributors without triggering other tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants