vllm.models.deepseek_v41.amd.akr_kernels
¶
The DeepSeek-V4.1 routes' only door to amd_kernels.
Calls only the shape-agnostic op entries of amd_kernels.<category> (and the
MXFP8 dense linears of amd_kernels.gemm.mxfp8_common.gemm), never a shape
package, so another shape needs no change here. Each entry reads its shape
from the tensors; where <op>_blocker returns a reason the call is not
covered: the reason is logged once and the wrapper returns None (or False),
having launched nothing, and the caller runs its stock path. Imports are lazy,
so vLLM imports without amd_kernels.
Classes:
-
IndexerBuffers–Static outputs shared by every indexer layer of one device (the layers
-
Mxfp8Weight–A linear's MXFP8 weight in the entries' layout: AITER's (16, 16)
Functions:
-
bf16_dual_gemm_weight–kv_score (fp32 columns, optional) and weights_proj (bf16 columns) as
-
fused_ep_context–The expert-parallel pools of this process (a collective).
-
fused_ep_weights–Views of the layer's MegaMoE tensors, which AITER already shuffled into
-
mhc_gate_finish–(post, comb, layer input, next pre[, codes, scales]) of the seam the
-
mxfp8_dense–x @ W.Tin bf16 where the dense entry has a winning row forx's row -
mxfp8_dense_weight–mxfp8_weightfor a shape the dense entry has tuned rows for. -
mxfp8_gate_up_swiglu–Gate_up GEMM, clamped SwiGLU (limit 10) and MXFP8 out: (codes, scales).
-
mxfp8_grouped_gemm–(codes, scales) of the grouped GEMM with the MXFP8 epilogue.
-
mxfp8_grouped_gemm_bf16–bf16 output of the grouped GEMM (wo_b's input without the quantize round trip
-
mxfp8_grouped_weight–wo_a's AITER-preshuffled weight
[G * N, K]and its 32 x 32 block scales -
mxfp8_weight–The stock linear's preshuffled weight as is (no copy) and its scales in
-
postmix_gates_gemm–(new residual, partial layer input, gate partials, stream mean or None).
-
rmsnorm_dual_mxfp8–(codes, scales, kv).
pad_scale: the scales are the first rows of a
IndexerBuffers
¶
Static outputs shared by every indexer layer of one device (the layers run one after another on one stream).
Source code in vllm/models/deepseek_v41/amd/akr_kernels.py
Mxfp8Weight
¶
A linear's MXFP8 weight in the entries' layout: AITER's (16, 16)
preshuffle and shuffled E8M0 scales [N, K / 32].
Source code in vllm/models/deepseek_v41/amd/akr_kernels.py
bf16_dual_gemm_weight(wa, wb)
¶
kv_score (fp32 columns, optional) and weights_proj (bf16 columns) as one weight; None where the entry has no such shape.
Source code in vllm/models/deepseek_v41/amd/akr_kernels.py
fused_ep_context(experts)
¶
The expert-parallel pools of this process (a collective).
Source code in vllm/models/deepseek_v41/amd/akr_kernels.py
fused_ep_weights(experts)
¶
Views of the layer's MegaMoE tensors, which AITER already shuffled into the kernel's layout (no copy).
Source code in vllm/models/deepseek_v41/amd/akr_kernels.py
mhc_gate_finish(partials, x1, hc_scale, hc_base, norm, layer, *, quant)
¶
(post, comb, layer input, next pre[, codes, scales]) of the seam the
gate partials belong to; layer supplies the mHC constants.
Source code in vllm/models/deepseek_v41/amd/akr_kernels.py
mxfp8_dense(x, w)
¶
x @ W.T in bf16 where the dense entry has a winning row for x's row
count, else None.
Source code in vllm/models/deepseek_v41/amd/akr_kernels.py
mxfp8_dense_weight(linear)
¶
mxfp8_weight for a shape the dense entry has tuned rows for.
Source code in vllm/models/deepseek_v41/amd/akr_kernels.py
mxfp8_gate_up_swiglu(x, w)
¶
Gate_up GEMM, clamped SwiGLU (limit 10) and MXFP8 out: (codes, scales).
Source code in vllm/models/deepseek_v41/amd/akr_kernels.py
mxfp8_grouped_gemm(x, w)
¶
(codes, scales) of the grouped GEMM with the MXFP8 epilogue.
mxfp8_grouped_gemm_bf16(x, w)
¶
bf16 output of the grouped GEMM (wo_b's input without the quantize round trip of the MXFP8 epilogue).
Source code in vllm/models/deepseek_v41/amd/akr_kernels.py
mxfp8_grouped_weight(wo_a, groups, n)
¶
wo_a's AITER-preshuffled weight [G * N, K] and its 32 x 32 block scales
as [G, N / 32, K / 32] (views, no copy).
Source code in vllm/models/deepseek_v41/amd/akr_kernels.py
mxfp8_weight(linear)
¶
The stock linear's preshuffled weight as is (no copy) and its scales in the entries' layout; None for a weight that is not MXFP8.
Source code in vllm/models/deepseek_v41/amd/akr_kernels.py
postmix_gates_gemm(x, w, residual, post_mix, comb_mix, pre_mix, fn_packed, *, routed=None, aux_mean=False)
¶
(new residual, partial layer input, gate partials, stream mean or None).
Source code in vllm/models/deepseek_v41/amd/akr_kernels.py
rmsnorm_dual_mxfp8(q, kv, q_weight, kv_weight, eps, pad_scale=False)
¶
(codes, scales, kv). pad_scale: the scales are the first rows of a
buffer with a multiple of 32 rows, which the wq_b entry moves to its
layout in one launch (any other storage works, with more launches).