[Log] Update to log once (#46511)

Signed-off-by: yewentao256 <zhyanwentao@126.com> Co-authored-by: TJian <tunjian.tan@embeddedllm.com>

Wentao Ye committed Jun 24, 2026 at 10:45 UTC 007b5a52edf8e81a018be1df35164f98b730db9f
4 files changed +23 -21
vllm/platforms/cpu.py
+7 -7
@@ -154,7 +154,7 @@ class CpuPlatform(Platform):
154 parallel_config.worker_cls = "vllm.v1.worker.cpu_worker.CPUWorker"
155 # Disable DBO
156 if parallel_config.enable_dbo:
157 - logger.warning("Dual-Batch Overlap is not supported on CPU, disabled.")
157 + logger.warning_once("Dual-Batch Overlap is not supported on CPU, disabled.")
158 parallel_config.enable_dbo = False
159
160 if torch.cpu._is_amx_tile_supported() and (
@@ -166,7 +166,7 @@ class CpuPlatform(Platform):
166 ):
167 cache_config.enable_prefix_caching = False
168 scheduler_config.enable_chunked_prefill = False
169 - logger.warning(
169 + logger.warning_once(
170 "Disabled unsupported prefix caching and chunked prefill "
171 "for linear attention on AMX CPU platforms."
172 )
@@ -309,7 +309,7 @@ class CpuPlatform(Platform):
309 )
310
311 if model_config is not None and model_config.use_mla:
312 - logger.info(
312 + logger.info_once(
313 "MLA is enabled on a non-GPU platform; forcing chunked "
314 "prefill and prefix caching to be disabled."
315 )
@@ -431,13 +431,13 @@ class CpuPlatform(Platform):
431 try:
432 import vllm._C # noqa: F401
433 except ImportError as e:
434 - logger.warning("Failed to import from vllm._C: %r", e)
434 + logger.warning_once("Failed to import from vllm._C: %r", e)
435 else:
436 try:
437 import vllm._C_AVX512 # noqa: F401
438 except ImportError as e:
439 if ignored_msg not in e.msg:
440 - logger.warning(
440 + logger.warning_once(
441 "Failed to import from vllm._C_AVX512: %r", e
442 )
443 else:
@@ -445,12 +445,12 @@ class CpuPlatform(Platform):
445 import vllm._C_AVX2 # noqa: F401
446 except ImportError as e:
447 if ignored_msg not in e.msg:
448 - logger.warning("Failed to import from vllm._C_AVX2: %r", e)
448 + logger.warning_once("Failed to import from vllm._C_AVX2: %r", e)
449 else:
450 try:
451 import vllm._C # noqa: F401
452 except ImportError as e:
453 - logger.warning("Failed to import from vllm._C: %r", e)
453 + logger.warning_once("Failed to import from vllm._C: %r", e)
454
455 @classmethod
456 def pack_kv_cache(
vllm/platforms/cuda.py
+8 -6
@@ -220,15 +220,17 @@ class CudaPlatformBase(Platform):
220 try:
221 import vllm._C_stable_libtorch # noqa: F401
222 except ImportError as e:
223 - logger.warning("Failed to import from vllm._C_stable_libtorch: %r", e)
223 + logger.warning_once("Failed to import from vllm._C_stable_libtorch: %r", e)
224 try:
225 import vllm._moe_C_stable_libtorch # noqa: F401
226 except ImportError as e:
227 - logger.warning("Failed to import from vllm._moe_C_stable_libtorch: %r", e)
227 + logger.warning_once(
228 + "Failed to import from vllm._moe_C_stable_libtorch: %r", e
229 + )
230 try:
231 import vllm._qutlass_C # noqa: F401
232 except ImportError as e:
231 - logger.warning("Failed to import from vllm._qutlass_C: %r", e)
233 + logger.warning_once("Failed to import from vllm._qutlass_C: %r", e)
234
235 @property
236 def supported_dtypes(self) -> list[torch.dtype]:
@@ -291,7 +293,7 @@ class CudaPlatformBase(Platform):
293 # kernel with limited pinned memory support for CUDA.
294 version = _get_wsl_kernel_version()
295 if version is None or version < (4, 19, 121):
294 - logger.warning(
296 + logger.warning_once(
297 "Using 'pin_memory=False' as WSL is detected and the "
298 "WSL2 kernel version is below 4.19.121. This may slow "
299 "down performance. Please run `wsl --update`."
@@ -320,7 +322,7 @@ class CudaPlatformBase(Platform):
322 and scheduler_config.is_multimodal_model
323 and not scheduler_config.disable_chunked_mm_input
324 ):
323 - logger.warning(
325 + logger.warning_once(
326 "Forcing --disable_chunked_mm_input for models "
327 "with multimodal-bidirectional attention."
328 )
@@ -331,7 +333,7 @@ class CudaPlatformBase(Platform):
333 and vllm_config.offload_config.uva.cpu_offload_gb > 0
334 and bool(vllm_config.compilation_config.cudagraph_mode)
335 ):
334 - logger.warning(
336 + logger.warning_once(
337 "--cpu-offload-gb is enabled with CUDA graphs on WSL2. "
338 "This combination requires pinned (page-locked) memory "
339 "allocations. WARNING: Windows (WDDM) enforces a hard "
vllm/platforms/interface.py
+3 -3
@@ -355,7 +355,7 @@ class Platform:
355 try:
356 import vllm._C # noqa: F401
357 except ImportError as e:
358 - logger.warning("Failed to import from vllm._C: %r", e)
358 + logger.warning_once("Failed to import from vllm._C: %r", e)
359 with contextlib.suppress(ImportError):
360 import vllm._moe_C_stable_libtorch # noqa: F401
361
@@ -859,7 +859,7 @@ class Platform:
859 # Pinned memory support under WSL depends on the vendor and driver
860 # version. Conservative default: return False. Platform subclasses
861 # that can verify support (e.g. CudaPlatformBase) override this.
862 - logger.warning(
862 + logger.warning_once(
863 "Using 'pin_memory=False' as WSL is detected. "
864 "This may slow down performance."
865 )
@@ -1003,7 +1003,7 @@ class Platform:
1003 if attr is not None:
1004 return attr
1005
1006 - logger.warning(
1006 + logger.warning_once(
1007 "Current platform %s does not have '%s' attribute.",
1008 self.device_type,
1009 key,
vllm/platforms/xpu.py
+5 -5
@@ -55,7 +55,7 @@ class XPUPlatform(Platform):
55 from vllm.v1.attention.backends.utils import set_kv_cache_layout
56
57 set_kv_cache_layout("NHD")
58 - logger.info(
58 + logger.info_once(
59 "Setting VLLM_KV_CACHE_LAYOUT to 'NHD' for XPU; "
60 "only NHD layout is supported by XPU attention kernels."
61 )
@@ -91,7 +91,7 @@ class XPUPlatform(Platform):
91 f"with use_mla: {attn_selector_config.use_mla}"
92 )
93
94 - logger.info("Using Flash Attention backend.")
94 + logger.info_once("Using Flash Attention backend.")
95 return AttentionBackendEnum.FLASH_ATTN.get_path()
96
97 @classmethod
@@ -193,13 +193,13 @@ class XPUPlatform(Platform):
193
194 if not supports_xpu_graph():
195 compilation_config.cudagraph_mode = CUDAGraphMode.NONE
196 - logger.warning(
196 + logger.warning_once(
197 "XPU Graph is not supported in the current PyTorch version, "
198 "disabling cudagraph_mode."
199 )
200 elif not envs.VLLM_XPU_ENABLE_XPU_GRAPH:
201 compilation_config.cudagraph_mode = CUDAGraphMode.NONE
202 - logger.warning(
202 + logger.warning_once(
203 "XPU Graph is disabled by environment variable, "
204 "please set VLLM_XPU_ENABLE_XPU_GRAPH=1 to enable it."
205 )
@@ -218,7 +218,7 @@ class XPUPlatform(Platform):
218 if compilation_config.mode != CompilationMode.NONE:
219 for flag, feature_name in fusion_passes_to_disable.items():
220 if getattr(pass_config, flag):
221 - logger.warning(
221 + logger.warning_once(
222 "Feature %r is not yet supported on XPU and will be disabled.",
223 feature_name,
224 )