[Refactor] Clean up log once scope="local" (#40540)

Signed-off-by: yewentao256 <zhyanwentao@126.com>
Signed-off-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Wentao Ye
2026-04-22 16:42:43 -04:00
committed by GitHub
co-authored by gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
parent cfa49213d7
commit 8f87eb4622
44 changed files with 56 additions and 148 deletions
@@ -369,7 +369,6 @@ class BatchedDeepGemmExperts(mk.FusedMoEExpertsModular):
logger.warning_once(
"DPMetadata unavailable. Defaulting expected_m to "
f"{max_tokens_per_expert}.",
scope="local",
)
return max_tokens_per_expert
@@ -1091,7 +1091,6 @@ def get_moe_configs(
"Using default MoE config. Performance might be sub-optimal! "
"Config file not found at %s",
", ".join(config_file_paths),
scope="local",
)
return None
@@ -123,7 +123,6 @@ class NixlEPPrepareAndFinalize(mk.FusedMoEPrepareAndFinalizeModular):
"NixlEPPrepareAndFinalize is setup to dispatch raw/unquantized "
f"activations despite ({fused_experts.__class__.__name__}) being able "
"to support quantized activations.",
scope="local",
)
def num_dispatchers(self) -> int:
@@ -266,7 +266,7 @@ def select_fp8_moe_backend(
k_cls, config, weight_key, activation_key, activation_format
)
if supported:
logger.info_once(_make_log_backend(backend), scope="local")
logger.info_once(_make_log_backend(backend))
return backend, k_cls
raise ValueError(_make_log_unsupported(backend, reason))
@@ -337,12 +337,10 @@ def select_fp8_moe_backend(
)
if supported:
logger.info_once(_make_log_backend(backend), scope="local")
logger.info_once(_make_log_backend(backend))
return backend, k_cls
else:
logger.debug_once(
_make_log_unsupported(backend, reason), scope="local"
)
logger.debug_once(_make_log_unsupported(backend, reason))
raise NotImplementedError(
"Found VLLM_USE_FLASHINFER_MOE_FP8=1, but no "
@@ -396,10 +394,10 @@ def select_fp8_moe_backend(
activation_format,
)
if supported:
logger.info_once(_make_log_backend(backend), scope="local")
logger.info_once(_make_log_backend(backend))
return backend, k_cls
else:
logger.debug_once(_make_log_unsupported(backend, reason), scope="local")
logger.debug_once(_make_log_unsupported(backend, reason))
# TODO(rob): per discussion with TPU team, we need a way to register
# MoE backends by OOT plugins, rather than having an explicit list
@@ -580,7 +578,7 @@ def make_fp8_moe_kernel(
)
assert prepare_finalize is not None
logger.info_once("Using %s", prepare_finalize.__class__.__name__, scope="local")
logger.info_once("Using %s", prepare_finalize.__class__.__name__)
# Create Experts.
if prepare_finalize.activation_format == mk.FusedMoEActivationFormat.BatchedExperts:
@@ -117,7 +117,7 @@ def select_int8_moe_backend(
k_cls, config, weight_key, activation_key, activation_format
)
if supported:
logger.info_once(_make_log_backend(backend), scope="local")
logger.info_once(_make_log_backend(backend))
return backend, k_cls
raise ValueError(_make_log_unsupported(backend, reason))
@@ -138,10 +138,10 @@ def select_int8_moe_backend(
activation_format,
)
if supported:
logger.info_once(_make_log_backend(backend), scope="local")
logger.info_once(_make_log_backend(backend))
return backend, k_cls
else:
logger.debug_once(_make_log_unsupported(backend, reason), scope="local")
logger.debug_once(_make_log_unsupported(backend, reason))
raise NotImplementedError(
"No Int8 MoE backend supports the deployment configuration."
@@ -193,7 +193,7 @@ def make_int8_moe_kernel(
)
assert prepare_finalize is not None
logger.info_once("Using %s", prepare_finalize.__class__.__name__, scope="local")
logger.info_once("Using %s", prepare_finalize.__class__.__name__)
# Create Experts.
if prepare_finalize.activation_format == mk.FusedMoEActivationFormat.BatchedExperts:
@@ -269,7 +269,7 @@ def select_gpt_oss_mxfp4_moe_backend(
k_cls, config, weight_key, activation_key, activation_format
)
if supported:
logger.info_once(_make_log_backend(backend), scope="local")
logger.info_once(_make_log_backend(backend))
return backend, k_cls
raise ValueError(_make_log_unsupported(backend, reason))
@@ -363,10 +363,10 @@ def select_gpt_oss_mxfp4_moe_backend(
k_cls, config, kMxfp4Static, activation_key, activation_format
)
if supported:
logger.info_once(_make_log_backend(backend), scope="local")
logger.info_once(_make_log_backend(backend))
return backend, k_cls
else:
logger.debug_once(_make_log_unsupported(backend, reason), scope="local")
logger.debug_once(_make_log_unsupported(backend, reason))
if current_platform.is_xpu():
backend = Mxfp4MoeBackend.XPU
@@ -861,7 +861,7 @@ def make_mxfp4_moe_kernel(
)
assert prepare_finalize is not None
logger.info_once("Using %s", prepare_finalize.__class__.__name__, scope="local")
logger.info_once("Using %s", prepare_finalize.__class__.__name__)
# Create Experts.
if prepare_finalize.activation_format == mk.FusedMoEActivationFormat.BatchedExperts:
@@ -252,12 +252,10 @@ def select_nvfp4_moe_backend(
activation_format,
)
if supported:
logger.info_once(_make_log_backend(backend), scope="local")
logger.info_once(_make_log_backend(backend))
return backend, k_cls
else:
logger.debug_once(
_make_log_unsupported(backend, reason), scope="local"
)
logger.debug_once(_make_log_unsupported(backend, reason))
raise NotImplementedError(
"Found VLLM_USE_FLASHINFER_MOE_FP4=1, but no "
@@ -282,10 +280,10 @@ def select_nvfp4_moe_backend(
)
if supported:
logger.info_once(_make_log_backend(backend), scope="local")
logger.info_once(_make_log_backend(backend))
return backend, k_cls
else:
logger.debug_once(_make_log_unsupported(backend, reason), scope="local")
logger.debug_once(_make_log_unsupported(backend, reason))
raise NotImplementedError(
"No NvFp4 MoE backend supports the deployment configuration."
@@ -210,7 +210,7 @@ def select_unquantized_moe_backend(
k_cls, config, None, None, activation_format
)
if supported:
logger.info_once(_make_log_backend(backend), scope="local")
logger.info_once(_make_log_backend(backend))
return backend, k_cls
raise ValueError(_make_log_unsupported(backend, reason))
@@ -271,12 +271,10 @@ def select_unquantized_moe_backend(
k_cls, moe_config, None, None, activation_format
)
if supported:
logger.info_once(_make_log_backend(backend), scope="local")
logger.info_once(_make_log_backend(backend))
return backend, k_cls
else:
logger.debug_once(
_make_log_unsupported(backend, reason), scope="local"
)
logger.debug_once(_make_log_unsupported(backend, reason))
raise NotImplementedError(
"Found VLLM_USE_FLASHINFER_MOE_FP16=1, but no "
@@ -298,10 +296,10 @@ def select_unquantized_moe_backend(
k_cls, moe_config, None, None, activation_format
)
if supported:
logger.info_once(_make_log_backend(backend), scope="local")
logger.info_once(_make_log_backend(backend))
return backend, k_cls
logger.debug_once(_make_log_unsupported(backend, reason), scope="local")
logger.debug_once(_make_log_unsupported(backend, reason))
raise NotImplementedError(
"No Unquantized MoE backend supports the deployment configuration."
@@ -355,7 +353,7 @@ def make_unquantized_moe_kernel(
)
assert prepare_finalize is not None
logger.info_once("Using %s", prepare_finalize.__class__.__name__, scope="local")
logger.info_once("Using %s", prepare_finalize.__class__.__name__)
# Create Experts
if prepare_finalize.activation_format == mk.FusedMoEActivationFormat.BatchedExperts:
@@ -135,7 +135,6 @@ class DeepEPLLPrepareAndFinalize(mk.FusedMoEPrepareAndFinalizeModular):
"DeepEPLLPrepareAndFinalize is setup to dispatch raw/unquantized "
f"activations despite ({fused_experts.__class__.__name__}) being able "
"to support quantized activations.",
scope="local",
)
def num_dispatchers(self) -> int:
@@ -69,16 +69,14 @@ class SharedExperts:
# TODO: Remove this after more extensive testings with TP/DP
# and other execution modes
if envs.VLLM_DISABLE_SHARED_EXPERTS_STREAM:
logger.debug_once("Disabling MoE shared_experts cuda stream", scope="local")
logger.debug_once("Disabling MoE shared_experts cuda stream")
self._stream = None
else:
# TODO(rob): enable shared expert overlap with non-cuda-alike.
# aux_stream() returns None on non-cuda-alike platforms.
self._stream = aux_stream()
if self._stream is not None:
logger.debug_once(
"Enabled separate cuda stream for MoE shared_experts", scope="local"
)
logger.debug_once("Enabled separate cuda stream for MoE shared_experts")
@property
def _disable_shared_experts_overlap(self) -> bool: