[Bugfix][KV Connector] MooncakeStore: exclude non-prefix-cacheable (QSA ring) groups; fix align-mode check (#55027)

Signed-off-by: Zhewen Li <zhewenli@inferact.ai>
Co-authored-by: Zhewen Li <zhewenli@inferact.ai>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Zhewen Li
2026-09-13 19:18:16 -07:00
committed by GitHub
co-authored by Zhewen Li OpenAI Codex Claude Fable 5.1
parent fe49665eb3
commit 58d45fd767
11 changed files with 381 additions and 52 deletions
+41 -1
View File
@@ -35,7 +35,7 @@ from vllm.multimodal.inputs import (
from vllm.sampling_params import SamplingParams
from vllm.utils.hashing import sha256, sha256_cbor, xxhash, xxhash_cbor
from vllm.utils.mem_constants import GiB_bytes
from vllm.v1.core.kv_cache_manager import KVCacheManager
from vllm.v1.core.kv_cache_manager import KVCacheBlocks, KVCacheManager
from vllm.v1.core.kv_cache_utils import (
BlockHash,
FreeKVCacheBlockQueue,
@@ -61,6 +61,7 @@ from vllm.v1.hisparse.layout import (
)
from vllm.v1.kv_cache_interface import (
ChunkedLocalAttentionSpec,
CircularBufferSpec,
FullAttentionSpec,
HiddenStateCacheSpec,
HiSparseHotSpec,
@@ -324,6 +325,45 @@ def test_kv_cache_config_selects_only_transferable_groups():
)
def test_kv_cache_config_selects_prefix_cacheable_groups():
"""Prefix stores exclude scratch state without changing transfer groups."""
full_group = KVCacheGroupSpec(["full"], new_kv_cache_spec())
qsa_group = KVCacheGroupSpec(
["qsa"],
CircularBufferSpec(
block_size=4,
num_kv_heads=1,
head_size=64,
head_size_v=0,
dtype=torch.float16,
),
)
disabled_group = KVCacheGroupSpec(
["disabled"], new_kv_cache_spec(), enable_kv_transfer=False
)
config = KVCacheConfig(
num_blocks=1,
kv_cache_tensors=[],
kv_cache_groups=[full_group, qsa_group, disabled_group],
)
assert config.transfer_group_ids == (0, 1)
assert config.select_transfer_block_ids(([1], [2], [3])) == ([1], [2])
assert config.prefix_cacheable_group_ids == (0,)
assert config.prefix_cacheable_groups == (full_group,)
def test_kv_cache_blocks_selects_requested_groups():
blocks = KVCacheBlocks(
(
[KVCacheBlock(1)],
[KVCacheBlock(2)],
[KVCacheBlock(3)],
)
)
assert blocks.get_block_ids(group_ids=(0, 2)) == ([1], [3])
def new_sliding_window_spec(
block_size=16,
num_kv_heads=2,