vllm.model_executor.kernels.linear.scaled_mm.xpu ¶
Classes:
XPUFp8BlockScaledMMKernel ¶
Bases: Fp8BlockScaledMMLinearKernel
Source code in vllm/model_executor/kernels/linear/scaled_mm/xpu.py
_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.
Source code in vllm/model_executor/kernels/linear/scaled_mm/xpu.py
XPUW8A8FP8LinearKernel ¶
Bases: FP8ScaledMMLinearKernel
Methods:
-
process_weights_after_loading–Ensure weight is stored as C-contiguous [K, N] (KN layout).
Source code in vllm/model_executor/kernels/linear/scaled_mm/xpu.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
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).