[Misc] Further clean up chunked prefill and prefix caching init (#29186)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
Cyrus Leung
2025-11-22 19:34:15 +08:00
committed by GitHub
parent 8e22da1d7f
commit 5a4802588e
6 changed files with 33 additions and 29 deletions

View File

@@ -425,7 +425,7 @@ class EngineArgs:
ParallelConfig.max_parallel_loading_workers
)
block_size: BlockSize | None = CacheConfig.block_size
enable_prefix_caching: bool | None = CacheConfig.enable_prefix_caching
enable_prefix_caching: bool | None = None
prefix_caching_hash_algo: PrefixCachingHashAlgo = (
CacheConfig.prefix_caching_hash_algo
)
@@ -1975,10 +1975,11 @@ class EngineArgs:
if self.prefill_context_parallel_size > 1:
default_chunked_prefill = False
default_prefix_caching = False
logger.warning(
logger.warning_once(
"--prefill-context-parallel-size > 1 is not compatible with "
"chunked prefill and prefix caching now. Chunked prefill "
"and prefix caching have been disabled by default."
"and prefix caching have been disabled by default.",
scope="local",
)
if self.enable_chunked_prefill is None:
@@ -1988,15 +1989,27 @@ class EngineArgs:
"%s chunked prefill by default",
"Enabling" if default_chunked_prefill else "Disabling",
)
elif (
model_config.runner_type == "generate"
and not self.enable_chunked_prefill
and default_chunked_prefill
):
logger.warning_once(
"This model does not officially support disabling chunked prefill. "
"Disabling this manually may cause the engine to crash "
"or produce incorrect outputs.",
scope="local",
)
elif (
model_config.runner_type == "pooling"
and self.enable_chunked_prefill
and not default_chunked_prefill
):
logger.warning(
logger.warning_once(
"This model does not officially support chunked prefill. "
"Enabling this manually may cause the engine to crash "
"or produce incorrect outputs.",
scope="local",
)
if self.enable_prefix_caching is None:
@@ -2011,10 +2024,11 @@ class EngineArgs:
and self.enable_prefix_caching
and not default_prefix_caching
):
logger.warning(
logger.warning_once(
"This model does not officially support prefix caching. "
"Enabling this manually may cause the engine to crash "
"or produce incorrect outputs.",
scope="local",
)
world_size = self.pipeline_parallel_size * self.tensor_parallel_size