A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 2, 09:45 UTC
[Bugfix] Use storage_block_size in KV cache reshape for compressed specs (DeepSeek V4) (#43988)
Signed-off-by: zixi-qi <zixi@inferact.ai> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
qizixi committed
May 29, 2026 at 11:14 UTC
d07ad0693bc7f5c993bfb473f02a71df8f8c7109
1 file changed
+6
-1
vllm/v1/worker/gpu/attn_utils.py
+6
-1
@@ -199,7 +199,12 @@ def _reshape_kv_cache(
199
200
if isinstance(kv_cache_spec, AttentionSpec):
201
has_attn = True
202
- num_blocks_per_kv_block = kv_cache_spec.block_size // kernel_block_size
202
+ # Use storage_block_size: it equals block_size for uncompressed
203
+ # specs but is smaller for compressed ones (DeepSeek V4), which
204
+ # store block_size tokens in block_size // compress_ratio slots.
205
+ num_blocks_per_kv_block = (
206
+ kv_cache_spec.storage_block_size // kernel_block_size
207
+ )
208
kernel_num_blocks = num_blocks * num_blocks_per_kv_block
209
kv_cache_shape = group.backend.get_kv_cache_shape(
210
kernel_num_blocks,