[WIP][Kernel] Enable GDN batch-invariant prefix caching - #55868
Open
quanliu1991 wants to merge 5 commits into
Open
quanliu1991 wants to merge 5 commits into
quanliu1991 wants to merge 5 commits into
Conversation
…vllm-project#45819). Temporary port so CI can exercise Qwen GDN under VLLM_BATCH_INVARIANT. Drop this commit when vllm-project#49827 (and the GDN BIC gate from vllm-project#45819) land on main. Prefix-cache align mode still raises; the next commit replaces that mutex with a shared FLA/mamba grid. Co-authored-by: Charlie Masters <charlie.masters@hcompany.ai> Co-authored-by: finetunej <82650881+finetunej@users.noreply.github.com> Co-authored-by: Yuval Luria <yluria@redhat.com> Signed-off-by: quanliu <18646313696@163.com>
Replace the BI vs align-mode mutex with lcm(FLA_CHUNK_SIZE, mamba_state_block_size), floor prefix-cache hits onto that grid, and round hybrid block_size up to a 64-multiple so short prefixes can reuse. Signed-off-by: quanliu <18646313696@163.com>
Manual GPU tests are skipped unless VLLM_GDN_PC_TEST_MODEL is set so default CI does not load a 35B GDN checkpoint. Signed-off-by: quanliu <18646313696@163.com>
quanliu1991
requested review from
ApostaC,
ProExpertProg,
WoosukKwon,
ZJY0516,
alexm-redhat,
heheda12345,
houseroad,
ivanium,
mgoin,
njhill,
orozery,
robertgshaw2-redhat,
tdoublep,
tlrmchlsmth,
vadiklyutiy,
yewentao256,
youkaichao,
ywang96 and
zhuohan123
as code owners
September 8, 2026 09:21
Contributor
Author
|
@claude review |
Annotate step_logprobs, assert optional GDN conv metadata before use, and match ruff-format wrapping so the manual-stage hooks pass. Signed-off-by: quanliu <18646313696@163.com>
Verified locally with ruff format/check and tools/pre_commit/mypy.py 3.12 on the changed files before pushing. Signed-off-by: quanliu <18646313696@163.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Enable
VLLM_BATCH_INVARIANT=1together with prefix caching on Qwen GDN hybrid models.Today this fails at scheduler init (
NotImplementedError: ... does not yet support Mamba cache alignment) because prefix cache puts GDN into mambaalignmode while BIC needs a 64-token FLA grid.This PR:
lcm(FLA_CHUNK_SIZE=64, mamba_state_block_size)for prefill chunks and prefix-cache hits (hits are floored onto the grid; a full-prompt hit is not).block_sizeup to a multiple of 64 (1056 → 1088) so the grid stays usable for short prefixes.Related: #49827, #45819, #48613, #42960.
Test Plan
Set
VLLM_GDN_PC_TEST_MODELto a GDN checkpoint (e.g. Qwen3.5-35B-A3B). Tests skip without it.TTFT (start
vllm servewith BI=1, then PC on / off):Hardware for the numbers below: 2× L20, TP=2, Qwen3.5-35B-A3B,
vllm-openai:v0.28.0overlay with the same changes.Test Result
Before: engine does not start (
NotImplementedErrorabove).After (bitwise): engine starts,
block_size1056 → 1088, alignment=1088. Same-path hit BS=1 vs BS=N is bitwise identical (prefix-1100real hit;ragged-200floors to 0).RESULT: PASS.After (TTFT, shared 2000-token prefix, BI=1):
c=1 TTFT −19%, c=16 median TTFT −27%. TPOT unchanged. 2000 tokens only skip the first 1088-token page, so this is not decode-only TTFT.