Skip to content

Commit e952720

Browse files
authored
[BugFix][XPU] Fix kv_cache management bug (#7420)
1 parent 6e16438 commit e952720

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fastdeploy/worker/xpu_model_runner.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,11 @@ def initialize_kv_cache(self, profile: bool = False) -> None:
12591259
# Check if gpu runner needs to create kv cache
12601260
# 1. During profiling, it creates its own kv cache.
12611261
# 2. GPU runner creates kv cache tensor unless p/d disaggregation is enabled.
1262-
create_cache_tensor = profile or self.scheduler_config.splitwise_role == "mixed"
1262+
create_cache_tensor = profile or not (
1263+
self.fd_config.cache_config.num_cpu_blocks > 0
1264+
or self.fd_config.cache_config.kvcache_storage_backend
1265+
or self.fd_config.scheduler_config.splitwise_role != "mixed"
1266+
)
12631267
if not create_cache_tensor:
12641268
logger.info(f"Waiting for cache managers to create kv cache.. {cache_ready_signal.value}")
12651269
while cache_ready_signal.value[local_rank] != 1:

0 commit comments

Comments
 (0)