[Bugfix] Make KV cache and MFU log lines backend-neutral (#55650)
Signed-off-by: Ianniu <985683179yzy@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
03dc26e639
commit
e85c8826ce
@@ -2391,9 +2391,11 @@ def update_kv_cache_capacity(
|
||||
vllm_config.cache_config.kv_cache_size_tokens = num_tokens
|
||||
vllm_config.cache_config.kv_cache_max_concurrency = max_concurrency
|
||||
max_model_len = vllm_config.model_config.max_model_len
|
||||
device_type = vllm_config.device_config.device_type
|
||||
logger.info_once(
|
||||
"GPU KV cache size: %s tokens, "
|
||||
"%s KV cache size: %s tokens, "
|
||||
"Maximum concurrency for %s tokens per request: %.2fx",
|
||||
"GPU" if device_type == "cuda" else device_type.upper(),
|
||||
f"{num_tokens:,}",
|
||||
f"{max_model_len:,}",
|
||||
max_concurrency,
|
||||
|
||||
@@ -101,6 +101,8 @@ class LoggingStatLogger(StatLoggerBase):
|
||||
def __init__(self, vllm_config: VllmConfig, engine_index: int = 0):
|
||||
self.engine_index = engine_index
|
||||
self.vllm_config = vllm_config
|
||||
device_type = vllm_config.device_config.device_type
|
||||
self.kv_cache_device = "GPU" if device_type == "cuda" else device_type.upper()
|
||||
self._reset(time.monotonic())
|
||||
|
||||
self.last_scheduler_stats = SchedulerStats()
|
||||
@@ -184,7 +186,7 @@ class LoggingStatLogger(StatLoggerBase):
|
||||
"%sIteration(%d): %d context requests, %d context tokens, "
|
||||
"%d generation requests, %d generation tokens, "
|
||||
"iteration elapsed time: %.2f ms%s, "
|
||||
"GPU KV cache usage: %.1f%%%s",
|
||||
"%s KV cache usage: %.1f%%%s",
|
||||
self._log_prefix_for_engine(engine_idx),
|
||||
details.iteration_index,
|
||||
details.num_ctx_requests,
|
||||
@@ -193,6 +195,7 @@ class LoggingStatLogger(StatLoggerBase):
|
||||
details.num_generation_tokens,
|
||||
details.elapsed_ms,
|
||||
" (dummy)" if details.is_dummy else "",
|
||||
self.kv_cache_device,
|
||||
scheduler_stats.kv_cache_usage * 100,
|
||||
encoder_msg,
|
||||
)
|
||||
@@ -287,12 +290,13 @@ class LoggingStatLogger(StatLoggerBase):
|
||||
|
||||
log_parts.extend(
|
||||
[
|
||||
"GPU KV cache usage: %.1f%%",
|
||||
"%s KV cache usage: %.1f%%",
|
||||
"Prefix cache hit rate: %.1f%%",
|
||||
]
|
||||
)
|
||||
log_args.extend(
|
||||
[
|
||||
self.kv_cache_device,
|
||||
self.last_scheduler_stats.kv_cache_usage * 100,
|
||||
self.prefix_caching_metrics.hit_rate * 100,
|
||||
]
|
||||
|
||||
@@ -1749,7 +1749,7 @@ class PerfMetricsLogging:
|
||||
)
|
||||
|
||||
log_fn(
|
||||
"%sMFU: %.1f TF/s/GPU %.1f GB/s/GPU",
|
||||
"%sMFU: %.1f TF/s/device %.1f GB/s/device",
|
||||
log_prefix,
|
||||
avg_tflops_per_gpu,
|
||||
avg_gbps_per_gpu,
|
||||
|
||||
Reference in New Issue
Block a user