From 2d09fdcdc213eaf9087766bd6f7b7c055bb346e3 Mon Sep 17 00:00:00 2001 From: Luca Motz Date: Wed, 14 Oct 2026 14:59:50 +0200 Subject: [PATCH] [Quantization] Auto-disable DeepGEMM for Kolibri 1 on SM12x (#61274) Signed-off-by: Luca Motz Co-authored-by: Claude Opus 5.5 --- vllm/config/vllm.py | 2 -- .../layers/fused_moe/oracle/fp8.py | 9 +++++++ vllm/utils/deep_gemm.py | 24 ++++++++++--------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/vllm/config/vllm.py b/vllm/config/vllm.py index 39015d4c32..58fe85c50e 100644 --- a/vllm/config/vllm.py +++ b/vllm/config/vllm.py @@ -1547,8 +1547,6 @@ class VllmConfig: self.quant_config.use_deep_gemm = False logger.warning_once( "Auto-disabled DeepGemm for model_type=%s on Blackwell. " - "DeepGemm E8M0 scale format causes accuracy degradation " - "for this architecture. Falling back to CUTLASS. " "To disable DeepGemm globally, set VLLM_USE_DEEP_GEMM=0.", model_type, ) diff --git a/vllm/model_executor/layers/fused_moe/oracle/fp8.py b/vllm/model_executor/layers/fused_moe/oracle/fp8.py index 074acd2a09..aef5c5b5b5 100644 --- a/vllm/model_executor/layers/fused_moe/oracle/fp8.py +++ b/vllm/model_executor/layers/fused_moe/oracle/fp8.py @@ -9,6 +9,7 @@ import torch import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm import envs from vllm._aiter_ops import rocm_aiter_ops +from vllm.config import get_current_vllm_config from vllm.config.kernel import MoEBackend from vllm.logger import init_logger from vllm.model_executor.layers.fused_moe.all2all_utils import ( @@ -40,6 +41,7 @@ from vllm.model_executor.layers.quantization.utils.quant_utils import ( ) from vllm.model_executor.utils import replace_parameter from vllm.platforms import current_platform +from vllm.utils.deep_gemm import should_auto_disable_deep_gemm from vllm.utils.math_utils import round_up logger = init_logger(__name__) @@ -492,6 +494,13 @@ def select_fp8_moe_backend( return _return_or_raise( backend, config, weight_key, activation_key, activation_format ) + elif (model_config := get_current_vllm_config().model_config) is not None and ( + should_auto_disable_deep_gemm( + getattr(model_config.hf_text_config, "model_type", None) + ) + ): + AVAILABLE_BACKENDS.remove(Fp8MoeBackend.DEEPGEMM) + AVAILABLE_BACKENDS.remove(Fp8MoeBackend.BATCHED_DEEPGEMM) # Handle explicit AITER FP8 configuration. if envs.is_set("VLLM_ROCM_USE_AITER") or envs.is_set("VLLM_ROCM_USE_AITER_MOE"): diff --git a/vllm/utils/deep_gemm.py b/vllm/utils/deep_gemm.py index 3dc9be5d93..5badccf6b5 100644 --- a/vllm/utils/deep_gemm.py +++ b/vllm/utils/deep_gemm.py @@ -24,9 +24,13 @@ from vllm.platforms import current_platform from vllm.utils.import_utils import has_deep_gemm from vllm.utils.math_utils import cdiv -_DEEPGEMM_BLACKWELL_EXCLUDED_MODEL_TYPES: set[str] = { - "qwen3_5_text", - "qwen3_5_moe_text", +# Model type -> Blackwell device capability families to auto-disable DeepGemm on. +_DEEPGEMM_BLACKWELL_EXCLUDED_MODEL_TYPES: dict[str, tuple[int, ...]] = { + # Accuracy + "qwen3_5_text": (100, 120), + "qwen3_5_moe_text": (100, 120), + # Latency + "kolibri1": (120,), } @@ -39,17 +43,15 @@ def get_paged_mqa_page_sizes() -> tuple[int, ...]: def should_auto_disable_deep_gemm(model_type: str | None) -> bool: """Check if DeepGemm should be auto-disabled for this model on Blackwell. - Returns True if the model is known to have accuracy degradation with - DeepGemm's E8M0 scale format on Blackwell GPUs (SM100+). + Returns True if DeepGemm is known to hurt this model's accuracy or + latency on the current Blackwell GPU family. """ if model_type is None: return False - if not ( - current_platform.is_device_capability_family(100) - or current_platform.is_device_capability_family(120) - ): - return False - return model_type in _DEEPGEMM_BLACKWELL_EXCLUDED_MODEL_TYPES + return any( + current_platform.is_device_capability_family(family) + for family in _DEEPGEMM_BLACKWELL_EXCLUDED_MODEL_TYPES.get(model_type, ()) + ) class DeepGemmQuantScaleFMT(Enum):