Repository navigation
Enable stride aware indexing on top of strided blocks for block_size and heads (assumes contiguous head dim) of fused_qk_norm_rope_cache_pts_quant_shuffle() - #4312
Merged
Conversation
…ssumed always contiguous) for pts quant shuffle fused qk norm rope and cache kernel
…s parity between blocks first, kv first, and head dim packed first
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
valarLip
approved these changes
Jul 28, 2026
4 tasks
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.
Motivation
Enabled stride-aware indexing for the token and head dimensions of the KV cache in fused_qk_norm_rope_cache_pts_quant_shuffle, to support the newly altered KV cache layout in vLLM where K/V are packed along the head dim as [num_blocks, num_heads_kv, block_size, 2*head_size] (K = [..., :head_size], V = [..., head_size:]). The existing blocks-first ([num_blocks, 2, …]) and KV-first ([2, num_blocks, …]) layouts remain supported, this adds a 3rd layout on top of them. The kernel now reads the cache's real block/token/head strides instead of assuming a contiguous per-block arrangement; only the innermost head_size dim must stay contiguous. Zero strides fall back to the previous contiguous formulas, so existing callers are unchanged.
Test Plan
python3 op_tests/test_fused_qk_norm_rope_cache_quant.py -> should all pass.