[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:
co-authored by
gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
parent
cfa49213d7
commit
8f87eb4622
@@ -332,7 +332,6 @@ class Attention(nn.Module, AttentionLayerBase):
|
||||
logger.warning_once(
|
||||
"Disabling prefix caching for FLASHINFER/TRITON_MLA "
|
||||
"with batch invariance, as it is not yet supported.",
|
||||
scope="local",
|
||||
)
|
||||
cache_config.enable_prefix_caching = False
|
||||
|
||||
|
||||
@@ -427,7 +427,6 @@ class MLAAttention(nn.Module, AttentionLayerBase):
|
||||
logger.warning_once(
|
||||
"Disabling prefix caching for TRITON_MLA / FLASHINFER "
|
||||
"with batch invariance, as it is not yet supported.",
|
||||
scope="local",
|
||||
)
|
||||
cache_config.enable_prefix_caching = False
|
||||
|
||||
@@ -1523,9 +1522,7 @@ class MLACommonMetadataBuilder(AttentionMetadataBuilder[M]):
|
||||
|
||||
if use_fp8:
|
||||
fp8_dtype = current_platform.fp8_dtype()
|
||||
logger.info_once(
|
||||
"FP8 prefill attention enabled: query data type is FP8", scope="local"
|
||||
)
|
||||
logger.info_once("FP8 prefill attention enabled: query data type is FP8")
|
||||
return fp8_dtype
|
||||
elif vllm_config.attention_config.use_prefill_query_quantization:
|
||||
logger.info_once(
|
||||
@@ -1533,7 +1530,6 @@ class MLACommonMetadataBuilder(AttentionMetadataBuilder[M]):
|
||||
" use_prefill_query_quantization is enabled. Please"
|
||||
" ensure that --kv-cache-dtype is set to fp8 and your prefill"
|
||||
" backend is compatible with FP8 attention.",
|
||||
scope="local",
|
||||
)
|
||||
return model_dtype
|
||||
elif (
|
||||
@@ -1547,7 +1543,6 @@ class MLACommonMetadataBuilder(AttentionMetadataBuilder[M]):
|
||||
"prefill latency. To enable, add: "
|
||||
'--attention-config \'{"use_prefill_query_quantization"'
|
||||
": true}'",
|
||||
scope="local",
|
||||
)
|
||||
|
||||
return model_dtype
|
||||
@@ -2225,21 +2220,19 @@ class MLACommonImpl(MLAAttentionImpl[M], Generic[M]):
|
||||
)
|
||||
|
||||
if use_trtllm_ragged_deepseek_prefill():
|
||||
logger.info_once(
|
||||
"Using TRT-LLM ragged DeepSeek prefill for MLA", scope="local"
|
||||
)
|
||||
logger.info_once("Using TRT-LLM ragged DeepSeek prefill for MLA")
|
||||
self._run_prefill_context_chunk = (
|
||||
self._run_prefill_context_chunk_trtllm_ragged
|
||||
)
|
||||
self._run_prefill_new_tokens = self._run_prefill_new_tokens_trtllm_ragged
|
||||
self._pad_v = False
|
||||
elif use_flashinfer_prefill():
|
||||
logger.info_once("Using FlashInfer prefill for MLA", scope="local")
|
||||
logger.info_once("Using FlashInfer prefill for MLA")
|
||||
self._run_prefill_context_chunk = self._run_prefill_context_chunk_fi
|
||||
self._run_prefill_new_tokens = self._run_prefill_new_tokens_fi
|
||||
self._pad_v = False
|
||||
elif use_cudnn_prefill():
|
||||
logger.info_once("Using CUDNN prefill for MLA", scope="local")
|
||||
logger.info_once("Using CUDNN prefill for MLA")
|
||||
self._run_prefill_context_chunk = self._run_prefill_context_chunk_cudnn
|
||||
self._run_prefill_new_tokens = self._run_prefill_new_tokens_cudnn
|
||||
self._pad_v = False
|
||||
@@ -2250,7 +2243,7 @@ class MLACommonImpl(MLAAttentionImpl[M], Generic[M]):
|
||||
"available. Please install flash_attn or use "
|
||||
"--attention-backend ROCM_AITER_MLA."
|
||||
)
|
||||
logger.info_once("Using FlashAttention prefill for MLA", scope="local")
|
||||
logger.info_once("Using FlashAttention prefill for MLA")
|
||||
self._run_prefill_context_chunk = self._run_prefill_context_chunk_fa
|
||||
self._run_prefill_new_tokens = self._run_prefill_new_tokens_fa
|
||||
|
||||
|
||||
@@ -227,9 +227,7 @@ class MMEncoderAttention(CustomOp):
|
||||
if self.attn_backend == AttentionBackendEnum.FLASHINFER:
|
||||
_get_flashinfer_workspace_buffer()
|
||||
|
||||
logger.info_once(
|
||||
f"Using {self.attn_backend} for MMEncoderAttention.", scope="local"
|
||||
)
|
||||
logger.info_once(f"Using {self.attn_backend} for MMEncoderAttention.")
|
||||
|
||||
@classmethod
|
||||
def enabled(cls) -> bool:
|
||||
|
||||
@@ -1020,7 +1020,7 @@ def override_envs_for_invariance(
|
||||
"You are using a non-decode-invariant form of batch invariance. "
|
||||
"This will not be invariant between prefill and decode."
|
||||
)
|
||||
logger.warning_once(warning, scope="local")
|
||||
logger.warning_once(warning)
|
||||
os.environ["VLLM_ALLREDUCE_USE_SYMM_MEM"] = "0"
|
||||
|
||||
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8"
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -143,15 +143,14 @@ class ChunkGatedDeltaRule(CustomOp):
|
||||
use_flashinfer = supports_flashinfer
|
||||
|
||||
if use_flashinfer:
|
||||
logger.info_once("Using FlashInfer GDN prefill kernel", scope="local")
|
||||
logger.info_once("Using FlashInfer GDN prefill kernel")
|
||||
logger.info_once(
|
||||
"FlashInfer GDN prefill kernel is JIT-compiled; first run may "
|
||||
"take a while to compile. Set `--gdn-prefill-backend triton` to "
|
||||
"avoid JIT compile time.",
|
||||
scope="local",
|
||||
)
|
||||
else:
|
||||
logger.info_once("Using Triton/FLA GDN prefill kernel", scope="local")
|
||||
logger.info_once("Using Triton/FLA GDN prefill kernel")
|
||||
|
||||
self._forward_method = (
|
||||
self.forward_cuda if use_flashinfer else self.forward_native
|
||||
|
||||
+2
-2
@@ -44,10 +44,10 @@ class CompressedTensorsW4A4Mxfp4MoEMethod(CompressedTensorsMoEMethod):
|
||||
self.use_cutlass_mxfp4 = CutlassExpertsMxfp4._supports_current_device()
|
||||
self.experts_cls: type[mk.FusedMoEExperts]
|
||||
if self.use_cutlass_mxfp4:
|
||||
logger.info_once("Using CutlassExpertsMxfp4 for MXFP4 MoE", scope="local")
|
||||
logger.info_once("Using CutlassExpertsMxfp4 for MXFP4 MoE")
|
||||
self.experts_cls = CutlassExpertsMxfp4
|
||||
else:
|
||||
logger.info_once("Using MarlinExperts for MXFP4 MoE", scope="local")
|
||||
logger.info_once("Using MarlinExperts for MXFP4 MoE")
|
||||
self.experts_cls = MarlinExperts
|
||||
|
||||
def create_weights(
|
||||
|
||||
-1
@@ -87,7 +87,6 @@ class CompressedTensorsWNA16MarlinMoEMethod(CompressedTensorsMoEMethod):
|
||||
logger.info_once(
|
||||
f"Using {self.kernel_backend} backend for WNA16 MoE "
|
||||
f"(group_size={self.group_size}, num_bits={self.num_bits})",
|
||||
scope="local",
|
||||
)
|
||||
|
||||
def get_weight_shape(
|
||||
|
||||
@@ -83,7 +83,6 @@ class Mxfp4Config(QuantizationConfig):
|
||||
logger.debug_once(
|
||||
"MXFP4 linear layer is not implemented - falling back to "
|
||||
"UnquantizedLinearMethod.",
|
||||
scope="local",
|
||||
)
|
||||
return UnquantizedLinearMethod()
|
||||
elif isinstance(layer, FusedMoE):
|
||||
@@ -92,7 +91,6 @@ class Mxfp4Config(QuantizationConfig):
|
||||
logger.debug_once(
|
||||
"MXFP4 attention layer is not implemented. "
|
||||
"Skipping quantization for this layer.",
|
||||
scope="local",
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
@@ -111,7 +111,6 @@ def get_flashinfer_moe_backend() -> FlashinferMoeBackend:
|
||||
logger.info_once(
|
||||
"Flashinfer TRTLLM MOE backend is only supported on "
|
||||
"SM100 and later, using CUTLASS backend instead",
|
||||
scope="local",
|
||||
)
|
||||
return FlashinferMoeBackend.CUTLASS
|
||||
return backend_map[flashinfer_moe_backend]
|
||||
@@ -239,7 +238,6 @@ def align_fp4_moe_weights_for_fi(
|
||||
"Padding intermediate size from %d to %d for up/down projection weights.",
|
||||
intermediate,
|
||||
padded_intermediate,
|
||||
scope="local",
|
||||
)
|
||||
|
||||
up_mult = 2 if is_act_and_mul else 1
|
||||
@@ -285,7 +283,6 @@ def align_trtllm_fp4_moe_hidden_dim_for_fi(
|
||||
"performance degradation.",
|
||||
hidden_size,
|
||||
padded_hidden_size,
|
||||
scope="local",
|
||||
)
|
||||
|
||||
padded_w13 = w13.new_zeros((num_experts, gate_up_dim, padded_hidden_size // 2))
|
||||
@@ -331,7 +328,6 @@ def align_fp8_moe_weights_for_fi(
|
||||
"Padding intermediate size from %d to %d for up/down projection weights.",
|
||||
intermediate,
|
||||
padded_intermediate,
|
||||
scope="local",
|
||||
)
|
||||
|
||||
up_mult = 2 if is_act_and_mul else 1
|
||||
|
||||
Reference in New Issue
Block a user