Repository navigation
[https://nvbugspro.nvidia.com/bug/6886263] Fix FlashInfer sparse attention packed KV cache support - #2697
Merged
yingguo-trt merged 2 commits intoOct 13, 2026
Conversation
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.
What does this PR do?
Type of change: Bug fix
Fixes FlashInfer skip-softmax calibration and serving with packed KV caches, including the layout used by vLLM 0.30.0 and 0.31.0. The adapter assumed a five-dimensional
[blocks, 2, page, heads, dim]cache, but these versions provide[blocks, heads, page, 2 * dim]. As a result, calibration fails during engine warmup with:A shared helper now extracts logical
[blocks, page, heads, dim]K/V views for both calibration and serving. Packed caches usetranspose(1, 2).split(head_size, dim=-1)without copying the cache; legacy five-dimensional caches retain their existing indexing.Usage
Use the existing FlashInfer calibration command.
<CKPT_COPY>should be a private writable checkpoint copy/view because--update_checkpoint_configupdates itsconfig.json;<RULER_DATA_DIR>is the prepared calibration data directory.Testing
Environment: BF16 Llama-3.1-8B-Instruct, 4 H200 GPUs, TP4,
FLASHINFER, with 32 decode steps.Before the fix: Jenkins #4044 reproduced the cache-shape error during engine warmup with vLLM 0.30.0.
With the fix: the FlashInfer calibration-and-serving E2E passed on both versions:
Each run completed prefill/decode calibration, exported and merged the sparse configuration, then loaded the checkpoint in a fresh HTTP server and generated a response. The 0.31.0 artifacts also confirm
ModelOptSparseFlashInferImplduring calibration and serving on all 32 attention layers.Both passing runs used commit
698154ff0d0266270235f98d57246f616e20eeff. The rebased production fix in92c48f240781dd70af4581f1a059089d4d288c2dhas the identical fix patch and an identicalplugins/vllm.pyfile. Commitb052e671b9ec303c4306b9187997656282a9fd6donly extends regression tests; the current head has not been E2E rerun.Regression coverage: extended two existing FlashInfer adapter tests under
tests/gpu_vllm/torch/sparsity/attention_sparsity/, adding one packed-cache variant each to calibration and serving while retaining the legacy variants. Small CPU tensors check K/V values, logical shape, strides, and shared storage at the downstream kernel boundary; the actual adapter/view conversion is used and the downstream kernels remain mocked. No model load or additional E2E matrix is introduced.Pre-commit and
git diff --checkpassed for the test changes. A limited CPU check of the real cache-view helper with the five test input layouts passed. Full pytest could not collect locally becausenvidia-modeloptpackage metadata is absent; vLLM/Triton are also unavailable. GPU/vLLM CI is pending fork-runner vetting for this head.The E2E validates the calibration/serving flow; it does not measure actual serving tile skips, accuracy, or performance.
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.
CONTRIBUTING.md: N/A — no copied code or new dependency.Additional Information
forward_includes_kv_cache_update=False, so native vLLM cache updates run before the adapter and the legacy writer is bypassed.Summary by CodeRabbit