vllm.model_executor.kernels.linear.scaled_mm.xpu
¶
Classes:
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.
XPUW8A8FP8LinearKernel
¶
Bases: FP8ScaledMMLinearKernel
Methods:
-
process_weights_after_loading–Ensure weight is stored as C-contiguous [K, N] (KN layout).
process_weights_after_loading(layer)
¶
Ensure weight is stored as C-contiguous [K, N] (KN layout).
Checkpoints store weight as [N, K]; fp8_gemm requires [K, N], C-contiguous. Three incoming layouts are possible: • [N, K] C-contiguous ← direct checkpoint → .t().contiguous() • [K, N] Fortran-order ← fp8.py's weight.t() → .contiguous() • [K, N] C-contiguous ← already correct → no-op
For square weights (K == N) the shape is ambiguous; contiguity is used as a proxy: C-contiguous ≡ checkpoint [N, K] (needs transpose); Fortran-order ≡ fp8.py already transposed (needs only contiguous).