[MoE Refactor] Combine CompressedTensorsWNA16MarlinMoEMethod with CompressedTensorsWNA16MoEMethod (#44570)

Signed-off-by: Bill Nell <bnell@redhat.com>
Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
Signed-off-by: Dobrzyniewicz, Agata <agata.dobrzyniewicz@intel.com>
Signed-off-by: Tushar Jain <tushar00jain@users.noreply.github.com>
Signed-off-by: yewentao256 <zhyanwentao@126.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
Co-authored-by: Agata Dobrzyniewicz <160237065+adobrzyn@users.noreply.github.com>
Co-authored-by: Tushar Jain <8455015+tushar00jain@users.noreply.github.com>
Co-authored-by: Tushar Jain <tushar00jain@users.noreply.github.com>
Co-authored-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
Co-authored-by: Jiangyun Zhu <riverclouds.zhu@qq.com>
This commit is contained in:
bnellnm
2026-07-31 14:13:03 -07:00
committed by GitHub
co-authored by Claude Taneem Ibrahim Agata Dobrzyniewicz Tushar Jain Tushar Jain Wentao Ye Jiangyun Zhu
parent 0c4dc7c488
commit 454ea5b526
14 changed files with 545 additions and 855 deletions
@@ -593,7 +593,6 @@ class TritonWNA16Experts(TritonExperts):
@staticmethod
def _supports_parallel_config(moe_parallel_config: FusedMoEParallelConfig) -> bool:
# Why?
return not (
moe_parallel_config.use_fi_nvl_two_sided_kernels
or moe_parallel_config.use_fi_nvl_one_sided_kernels
@@ -32,6 +32,7 @@ from vllm.model_executor.layers.fused_moe.experts.trtllm_mxint4_moe import (
)
from vllm.model_executor.layers.quantization.base_config import QuantizationConfig
from vllm.model_executor.layers.quantization.utils.marlin_utils import (
check_moe_marlin_supports_config,
marlin_act_int8_process_scales,
marlin_moe_padded_intermediate,
marlin_moe_permute_scales,
@@ -125,9 +126,11 @@ def _get_priority_backends() -> list[WNA16MoEBackend]:
def _backend_incompatibility_reason(
backend: WNA16MoEBackend,
moe_config: FusedMoEConfig,
quant_config: QuantizationConfig | QuantizationArgs,
may_have_zp: bool,
may_have_bias: bool,
allow_tile_padding: bool,
) -> str | None:
if backend == WNA16MoEBackend.FLASHINFER_TRTLLM and (may_have_zp or may_have_bias):
return "zero points and bias are not supported"
@@ -149,7 +152,24 @@ def _backend_incompatibility_reason(
):
return "group activation ordering is not supported"
if isinstance(quant_config, MoeWNA16Config) and backend in (
# Marlin only supports certain problem/group sizes.
allow_marlin = not isinstance(quant_config, MoeWNA16Config)
if allow_marlin and backend in (
WNA16MoEBackend.MARLIN,
WNA16MoEBackend.BATCHED_MARLIN,
):
if isinstance(quant_config, (AutoAWQConfig, AutoGPTQConfig, QuantizationArgs)):
group_size = quant_config.group_size
else:
return "Marlin not supported for this layer"
if not check_moe_marlin_supports_config(
moe_config, group_size, allow_tile_padding
):
return "Marlin not supported for this layer"
if not allow_marlin and backend in (
WNA16MoEBackend.MARLIN,
WNA16MoEBackend.BATCHED_MARLIN,
WNA16MoEBackend.EMULATION,
@@ -182,6 +202,7 @@ def select_wna16_moe_backend(
quant_config: QuantizationConfig | QuantizationArgs,
may_have_zp: bool,
may_have_bias: bool,
allow_tile_padding: bool = False,
) -> tuple[WNA16MoEBackend, type[mk.FusedMoEExperts]]:
"""Select the WNA16 MoE backend.
@@ -239,7 +260,12 @@ def select_wna16_moe_backend(
if runner_backend != "auto":
requested_backend = map_wna16_backend(runner_backend)
reason = _backend_incompatibility_reason(
requested_backend, quant_config, may_have_zp, may_have_bias
requested_backend,
config,
quant_config,
may_have_zp,
may_have_bias,
allow_tile_padding,
)
if reason is not None:
raise ValueError(_make_log_unsupported(requested_backend, reason))
@@ -252,7 +278,12 @@ def select_wna16_moe_backend(
for backend in AVAILABLE_BACKENDS:
reason = _backend_incompatibility_reason(
backend, quant_config, may_have_zp, may_have_bias
backend,
config,
quant_config,
may_have_zp,
may_have_bias,
allow_tile_padding,
)
if reason is not None:
logger.debug_once(_make_log_unsupported(backend, reason), scope="local")
@@ -206,7 +206,6 @@ class RoutedExperts(PluggableLayer):
def _needs_intermediate_size_param(self, quant_method: FusedMoEMethodBase) -> bool:
return quant_method.__class__.__name__ in (
"AutoGPTQMoEMethod",
"CompressedTensorsWNA16MarlinMoEMethod",
"CompressedTensorsWNA16MoEMethod",
"CompressedTensorsW4A16FlydslMoEMethod",
)
@@ -659,7 +658,6 @@ class RoutedExperts(PluggableLayer):
# TODO (mgoin): check self.quant_method.quant_config.quant_format
# against known CompressionFormat enum values that have this quality
if quant_method_name in (
"CompressedTensorsWNA16MarlinMoEMethod",
"CompressedTensorsWNA16MoEMethod",
"CompressedTensorsWNA16RDNA3MoEMethod",
"CompressedTensorsW4A16FlydslMoEMethod",