Skip to content

vllm.model_executor.kernels.linear.requantization_source

Placeholder linear kernels for online requantization sources.

A checkpoint quantization method used as an online requantization source only dequantizes its weights, so it needs no kernel. The init_*_linear_kernel selectors return one of these placeholders instead of dispatching, which keeps their return types unchanged. Using one for compute raises.

_FakeLinearKernel

Satisfies the abstract interface of every kernel family, never computes.

Source code in vllm/model_executor/kernels/linear/requantization_source.py
class _FakeLinearKernel:
    """Satisfies the abstract interface of every kernel family, never computes."""

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        pass

    @classmethod
    def is_supported(cls, *args: Any, **kwargs: Any) -> tuple[bool, str | None]:
        return True, None

    @classmethod
    def can_implement(cls, *args: Any, **kwargs: Any) -> tuple[bool, str | None]:
        return True, None

    def input_quant_key(self) -> QuantKey | None:
        return None

    def process_weights_after_loading(self, *args: Any, **kwargs: Any) -> None:
        raise RuntimeError(_NO_KERNEL)

    def apply_weights(self, *args: Any, **kwargs: Any) -> torch.Tensor:
        raise RuntimeError(_NO_KERNEL)

    def apply_scaled_mm(self, *args: Any, **kwargs: Any) -> torch.Tensor:
        raise RuntimeError(_NO_KERNEL)