Skip to content

vllm.model_executor.layers.quantization.inc.schemes.inc_wna16_scheme

_check_xpu_w4a8_supported(layer_config, prefix)

Raise unless int4_gemm_w4a8 can serve this layer.

The backend is requested explicitly, so an unusable configuration is an error rather than something to silently fall back from.

Source code in vllm/model_executor/layers/quantization/inc/schemes/inc_wna16_scheme.py
def _check_xpu_w4a8_supported(layer_config: "INCLayerConfig", prefix: str) -> None:
    """Raise unless ``int4_gemm_w4a8`` can serve this layer.

    The backend is requested explicitly, so an unusable configuration is an
    error rather than something to silently fall back from.
    """
    import torch

    if not hasattr(torch.ops._xpu_C, "int4_gemm_w4a8"):
        raise NotImplementedError(
            "VLLM_XPU_INC_WNA16_BACKEND=w4a8 requires the int4_gemm_w4a8 op, "
            "which this build of vllm-xpu-kernels does not provide. "
            f"Layer: {prefix}."
        )
    if layer_config.group_size <= 0 or layer_config.group_size % 32 != 0:
        raise NotImplementedError(
            "VLLM_XPU_INC_WNA16_BACKEND=w4a8 requires a group size that is a "
            f"positive multiple of 32, got {layer_config.group_size}. "
            f"Layer: {prefix}."
        )