Skip to content

vllm.model_executor.kernels.linear.scaled_mm.cpu

Classes:

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.

CPUFp8ChannelWiseScaledMMLinearKernel

Bases: CPUFp8PerTensorScaledMMLinearKernel

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

fp8_scaled_mm_cpu only supports block scales whose N extent is a multiple of 32, so the GEMM runs with unit block scales and the per-output-channel weight scale is applied to the output afterwards. Activations stay BF16, regardless of the checkpoint's activation scheme.

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.

CPUFp8W8A8BlockScaledMMKernel

Bases: Fp8BlockScaledMMLinearKernel

FP8 W8A8 block-quantized GEMM with dynamic per-token activation quant on CPU.

Methods:

process_weights_after_loading(layer)

Prepack block-quantized FP8 weight for W8A8 AMX BRGEMM.

For block-quant FP8 models weight is stored as [N, K] (NOT transposed, unlike non-block FP8 where vLLM stores [K, N]).

float8_linear_prepack_cpu expects

weight: [N, K] scales: [N, G] where G = K / block_k

weight_scale_inv from the checkpoint has shape [ceil(N/block_n), G], so we expand rows from ceil(N/block_n) to N via repeat_interleave.