Skip to content

vllm.models.deepseek_v41.amd.akr_draft

DeepSeek-V4.1 lm_head and DSpark draft projection on amd_kernels.

the bf16 head GEMM behind lm_head.quant_method.apply (the draft

shares the target's head), at the row counts where it beat vLLM's own dispatch. The row-major weight is used as it is.

main_proj: the draft's MXFP8 input projection of the concatenated target hidden states, from 640 rows (on par below).

Functions:

  • main_proj –

    model.main_proj(x) on amd_kernels, or None for the stock linear.

main_proj(model, x)

model.main_proj(x) on amd_kernels, or None for the stock linear.

Source code in vllm/models/deepseek_v41/amd/akr_draft.py
def main_proj(model, x: torch.Tensor) -> torch.Tensor | None:
    """`model.main_proj(x)` on amd_kernels, or None for the stock linear."""
    w = getattr(model, "akr_main_proj", None)
    if (
        w is None
        or x.dim() != 2
        or x.dtype != torch.bfloat16
        or not x.is_contiguous()
        or not akr_config.serves("main_proj", x.shape[0])
    ):
        return None
    return akr_kernels.mxfp8_dense(x, w)