Skip to content

vllm.model_executor.kernels.linear.scaled_mm

Modules:

Classes:

AiterInt8ScaledMMLinearKernel

Bases: CutlassInt8ScaledMMLinearKernel

Methods:

  • apply_weights –

    AiterInt8ScaledMMLinearKernel implements a fused version of

apply_weights(layer, x, bias=None)

AiterInt8ScaledMMLinearKernel implements a fused version of output = torch.mm((scale_a * a), (scale_b * b)).to(out_dtype) where scale_a * a and scale_b * b are implemented using numpy-style broadcasting. Currently only supports per-token-per-channel GEMM through AITER w8a8 scaled gemm. AiterInt8ScaledMMLinearKernel also does not support AITER block scaled GEMM and mix-precision GEMM.

CPUFP8W8A8ScaledMMLinearKernel

Bases: FP8ScaledMMLinearKernel

FP8 W8A8 GEMM with dynamic per-token activation quantization on CPU.

Methods:

process_weights_after_loading(layer)

Prepack weights with float8_linear_prepack_cpu (VNNI + block layout).

CPUFp8BlockScaledMMKernel

Bases: Fp8BlockScaledMMLinearKernel

FP8 W8A16 block-quantized GEMM via AMX BRGEMM on CPU.

CPUFp8PerTensorScaledMMLinearKernel

Bases: FP8ScaledMMLinearKernel

FP8 W8A16 per-tensor-scaled GEMM via AMX BRGEMM on CPU.

Reuses the block-scaled AMX kernel (fp8_scaled_mm_cpu) with a single synthetic block spanning the whole weight, so activations stay BF16/FP32 — no FP8 activation quantization, unlike PerTensorTorchFP8ScaledMMLinearKernel.

CutlassFP8ScaledMMLinearKernel

Bases: FP8ScaledMMLinearKernel

Methods:

  • input_quant_key –

    Static per-tensor and dynamic per-token activations can be quantized

_pad_to_alignment(x, dim, alignment, value=0.0) staticmethod

Pad tensor x along dim to the next multiple of alignment.

input_quant_key()

Static per-tensor and dynamic per-token activations can be quantized outside the kernel: neither is padded, and cutlass_scaled_mm takes the (M, 1) token scales as is.

MarlinFP8ScaledMMLinearKernel

Bases: FP8ScaledMMLinearKernel

FP8 Marlin kernel for GPUs that lack FP8 hardware support. Leverages the Marlin kernel for fast weight-only FP8 quantization.

XPUFp8BlockScaledMMKernel

Bases: Fp8BlockScaledMMLinearKernel

_prepare_bmm_params(layer, scale_kn)

Precompute batched weight and scale for grouped fp8_bmm (e.g. wo_a).

Splits scale [k_blocks, n_blocks] into [G, k_blocks, n_blocks_per_group] and weight [N_total, K] into [G, K, N_per_group] for batch GEMM.

ZentorchInt8ScaledMMLinearKernel

Bases: Int8ScaledMMLinearKernel

Methods:

process_weights_after_loading(layer)

Prepare weights for zentorch_dynamic_qlinear.

Keeps weight in [N, K] layout (int8, contiguous) and converts the per-channel weight scale to bf16 with shape (N,).