From 95e640012822a81783d05fa4e793c16b9048daf6 Mon Sep 17 00:00:00 2001 From: baxingpiaochong <771405853@qq.com> Date: Mon, 15 Dec 2025 20:27:57 +0800 Subject: [PATCH] [KVPool]Fix PP get bug (#5007) ### What this PR does / why we need it? When kv caches are evicted from the key-value pool, it's possible that the kv cache for pp0 is still active, but the kv cache for pp1 has already been evicted. Therefore, a unified check is needed during the get operation. - vLLM version: v0.12.0 - vLLM main: https://github.com/vllm-project/vllm/commit/ad32e3e19ccf0526cb6744a5fed09a138a5fb2f9 Signed-off-by: baxingpiaochong <771405853@qq.com> Co-authored-by: Jade Zheng --- vllm_ascend/distributed/kvpool/pool_worker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vllm_ascend/distributed/kvpool/pool_worker.py b/vllm_ascend/distributed/kvpool/pool_worker.py index a1e0a900..2fc53f62 100644 --- a/vllm_ascend/distributed/kvpool/pool_worker.py +++ b/vllm_ascend/distributed/kvpool/pool_worker.py @@ -572,7 +572,8 @@ class KVPoolWorker: num_block = len(keys) // self.num_layers multi_tp_values = [ res[i * num_block:(i + 1) * num_block] # type: ignore[index] - for i in range(min(self.tp_size, self.num_kv_head)) + for i in range( + min(self.tp_size, self.num_kv_head) * self.pp_size) ] index = self.find_min_first_non_one_index(multi_tp_values) if index != -1: