From 007b5a52edf8e81a018be1df35164f98b730db9f Mon Sep 17 00:00:00 2001 From: Wentao Ye <44945378+yewentao256@users.noreply.github.com> Date: Wed, 24 Jun 2026 10:45:16 -0400 Subject: [PATCH] [Log] Update to log once (#46511) Signed-off-by: yewentao256 Co-authored-by: TJian --- vllm/platforms/cpu.py | 14 +++++++------- vllm/platforms/cuda.py | 14 ++++++++------ vllm/platforms/interface.py | 6 +++--- vllm/platforms/xpu.py | 10 +++++----- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/vllm/platforms/cpu.py b/vllm/platforms/cpu.py index c529af46df..31960ee8e6 100644 --- a/vllm/platforms/cpu.py +++ b/vllm/platforms/cpu.py @@ -154,7 +154,7 @@ class CpuPlatform(Platform): parallel_config.worker_cls = "vllm.v1.worker.cpu_worker.CPUWorker" # Disable DBO if parallel_config.enable_dbo: - logger.warning("Dual-Batch Overlap is not supported on CPU, disabled.") + logger.warning_once("Dual-Batch Overlap is not supported on CPU, disabled.") parallel_config.enable_dbo = False if torch.cpu._is_amx_tile_supported() and ( @@ -166,7 +166,7 @@ class CpuPlatform(Platform): ): cache_config.enable_prefix_caching = False scheduler_config.enable_chunked_prefill = False - logger.warning( + logger.warning_once( "Disabled unsupported prefix caching and chunked prefill " "for linear attention on AMX CPU platforms." ) @@ -309,7 +309,7 @@ class CpuPlatform(Platform): ) if model_config is not None and model_config.use_mla: - logger.info( + logger.info_once( "MLA is enabled on a non-GPU platform; forcing chunked " "prefill and prefix caching to be disabled." ) @@ -431,13 +431,13 @@ class CpuPlatform(Platform): try: import vllm._C # noqa: F401 except ImportError as e: - logger.warning("Failed to import from vllm._C: %r", e) + logger.warning_once("Failed to import from vllm._C: %r", e) else: try: import vllm._C_AVX512 # noqa: F401 except ImportError as e: if ignored_msg not in e.msg: - logger.warning( + logger.warning_once( "Failed to import from vllm._C_AVX512: %r", e ) else: @@ -445,12 +445,12 @@ class CpuPlatform(Platform): import vllm._C_AVX2 # noqa: F401 except ImportError as e: if ignored_msg not in e.msg: - logger.warning("Failed to import from vllm._C_AVX2: %r", e) + logger.warning_once("Failed to import from vllm._C_AVX2: %r", e) else: try: import vllm._C # noqa: F401 except ImportError as e: - logger.warning("Failed to import from vllm._C: %r", e) + logger.warning_once("Failed to import from vllm._C: %r", e) @classmethod def pack_kv_cache( diff --git a/vllm/platforms/cuda.py b/vllm/platforms/cuda.py index fa96cb8c94..ee73eef879 100644 --- a/vllm/platforms/cuda.py +++ b/vllm/platforms/cuda.py @@ -220,15 +220,17 @@ class CudaPlatformBase(Platform): try: import vllm._C_stable_libtorch # noqa: F401 except ImportError as e: - logger.warning("Failed to import from vllm._C_stable_libtorch: %r", e) + logger.warning_once("Failed to import from vllm._C_stable_libtorch: %r", e) try: import vllm._moe_C_stable_libtorch # noqa: F401 except ImportError as e: - logger.warning("Failed to import from vllm._moe_C_stable_libtorch: %r", e) + logger.warning_once( + "Failed to import from vllm._moe_C_stable_libtorch: %r", e + ) try: import vllm._qutlass_C # noqa: F401 except ImportError as e: - logger.warning("Failed to import from vllm._qutlass_C: %r", e) + logger.warning_once("Failed to import from vllm._qutlass_C: %r", e) @property def supported_dtypes(self) -> list[torch.dtype]: @@ -291,7 +293,7 @@ class CudaPlatformBase(Platform): # kernel with limited pinned memory support for CUDA. version = _get_wsl_kernel_version() if version is None or version < (4, 19, 121): - logger.warning( + logger.warning_once( "Using 'pin_memory=False' as WSL is detected and the " "WSL2 kernel version is below 4.19.121. This may slow " "down performance. Please run `wsl --update`." @@ -320,7 +322,7 @@ class CudaPlatformBase(Platform): and scheduler_config.is_multimodal_model and not scheduler_config.disable_chunked_mm_input ): - logger.warning( + logger.warning_once( "Forcing --disable_chunked_mm_input for models " "with multimodal-bidirectional attention." ) @@ -331,7 +333,7 @@ class CudaPlatformBase(Platform): and vllm_config.offload_config.uva.cpu_offload_gb > 0 and bool(vllm_config.compilation_config.cudagraph_mode) ): - logger.warning( + logger.warning_once( "--cpu-offload-gb is enabled with CUDA graphs on WSL2. " "This combination requires pinned (page-locked) memory " "allocations. WARNING: Windows (WDDM) enforces a hard " diff --git a/vllm/platforms/interface.py b/vllm/platforms/interface.py index 82c8741609..a7a0dd52df 100644 --- a/vllm/platforms/interface.py +++ b/vllm/platforms/interface.py @@ -355,7 +355,7 @@ class Platform: try: import vllm._C # noqa: F401 except ImportError as e: - logger.warning("Failed to import from vllm._C: %r", e) + logger.warning_once("Failed to import from vllm._C: %r", e) with contextlib.suppress(ImportError): import vllm._moe_C_stable_libtorch # noqa: F401 @@ -859,7 +859,7 @@ class Platform: # Pinned memory support under WSL depends on the vendor and driver # version. Conservative default: return False. Platform subclasses # that can verify support (e.g. CudaPlatformBase) override this. - logger.warning( + logger.warning_once( "Using 'pin_memory=False' as WSL is detected. " "This may slow down performance." ) @@ -1003,7 +1003,7 @@ class Platform: if attr is not None: return attr - logger.warning( + logger.warning_once( "Current platform %s does not have '%s' attribute.", self.device_type, key, diff --git a/vllm/platforms/xpu.py b/vllm/platforms/xpu.py index 030b4933bb..94f5e8e5a8 100644 --- a/vllm/platforms/xpu.py +++ b/vllm/platforms/xpu.py @@ -55,7 +55,7 @@ class XPUPlatform(Platform): from vllm.v1.attention.backends.utils import set_kv_cache_layout set_kv_cache_layout("NHD") - logger.info( + logger.info_once( "Setting VLLM_KV_CACHE_LAYOUT to 'NHD' for XPU; " "only NHD layout is supported by XPU attention kernels." ) @@ -91,7 +91,7 @@ class XPUPlatform(Platform): f"with use_mla: {attn_selector_config.use_mla}" ) - logger.info("Using Flash Attention backend.") + logger.info_once("Using Flash Attention backend.") return AttentionBackendEnum.FLASH_ATTN.get_path() @classmethod @@ -193,13 +193,13 @@ class XPUPlatform(Platform): if not supports_xpu_graph(): compilation_config.cudagraph_mode = CUDAGraphMode.NONE - logger.warning( + logger.warning_once( "XPU Graph is not supported in the current PyTorch version, " "disabling cudagraph_mode." ) elif not envs.VLLM_XPU_ENABLE_XPU_GRAPH: compilation_config.cudagraph_mode = CUDAGraphMode.NONE - logger.warning( + logger.warning_once( "XPU Graph is disabled by environment variable, " "please set VLLM_XPU_ENABLE_XPU_GRAPH=1 to enable it." ) @@ -218,7 +218,7 @@ class XPUPlatform(Platform): if compilation_config.mode != CompilationMode.NONE: for flag, feature_name in fusion_passes_to_disable.items(): if getattr(pass_config, flag): - logger.warning( + logger.warning_once( "Feature %r is not yet supported on XPU and will be disabled.", feature_name, )