From ee2301ae1748f186ad15039b0137e7795ec9c06c Mon Sep 17 00:00:00 2001 From: Gahow Wang Date: Sun, 24 May 2026 01:21:49 +0800 Subject: [PATCH] Fix: token lookup condition should check hash_table not block_pool Co-Authored-By: Claude Opus 4.6 (1M context) --- .../kv_connector/v1/mooncake/mooncake_utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/third_party/vllm/vllm/distributed/kv_transfer/kv_connector/v1/mooncake/mooncake_utils.py b/third_party/vllm/vllm/distributed/kv_transfer/kv_connector/v1/mooncake/mooncake_utils.py index 9d46ab9..0620b72 100644 --- a/third_party/vllm/vllm/distributed/kv_transfer/kv_connector/v1/mooncake/mooncake_utils.py +++ b/third_party/vllm/vllm/distributed/kv_transfer/kv_connector/v1/mooncake/mooncake_utils.py @@ -189,8 +189,8 @@ class MooncakeBootstrapServer: block_ids: list[int | None] = [] pinned_ids: list[int] = [] - if req.token_ids is not None and self._block_pool is not None: - # Token-based lookup: compute hashes on C's side using C's hash function + if req.token_ids is not None and self._hash_table: + # Token-based lookup: compute hashes from tokens, match against synced hash table block_ids, pinned_ids = self._lookup_by_tokens( req.token_ids, req.num_tokens) elif req.block_hashes is not None: @@ -205,12 +205,12 @@ class MooncakeBootstrapServer: break logger.info( - "query_blocks: %d/%d matched (token_mode=%s, pool=%s)", + "query_blocks: %d/%d matched (token_mode=%s, hash_table=%d)", len(pinned_ids), req.num_tokens // self._kv_info.get("block_size", 512) if req.num_tokens else len(req.block_hashes or []), req.token_ids is not None, - self._block_pool is not None, + len(self._hash_table), ) self._pinned[req.pin_token] = pinned_ids