[Bugfix] Generalize KV block zeroing to AttentionSpec (#51749)

Signed-off-by: mgoin <mgoin64@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Michael Goin
2026-08-11 12:13:09 -04:00
committed by GitHub
co-authored by mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 513f83e7ec
commit e3fe212eaf
4 changed files with 134 additions and 10 deletions
+3 -5
View File
@@ -16,6 +16,7 @@ from vllm.v1.core.kv_cache_utils import (
resolve_block_hashes,
)
from vllm.v1.kv_cache_interface import (
AttentionSpec,
ChunkedLocalAttentionSpec,
CrossAttentionSpec,
FullAttentionSpec,
@@ -83,11 +84,8 @@ class SingleTypeKVCacheManager(ABC):
self._max_admission_blocks_per_request = max_admission_blocks_per_request
# Record newly allocated block ids only when worker-side zeroing will
# consume them and this manager holds a spec type that gets zeroed.
self._record_new_block_ids = needs_kv_cache_zeroing and type(kv_cache_spec) in (
FullAttentionSpec,
TQFullAttentionSpec,
MLAAttentionSpec,
HiddenStateCacheSpec,
self._record_new_block_ids = needs_kv_cache_zeroing and isinstance(
kv_cache_spec, AttentionSpec
)
self.new_block_ids: list[int] = []