Skip to content

vllm.models.deepseek_v41.amd.ops

gfx942 (MI300X, MI325X) decode helpers for DeepSeek-V4.1.

topk holds the sparse indexer's top-512 hooks, built from topk512_gfx942.cu, and cand_logits the indexer logits of the DSpark candidate positions. sparse_indexer is the indexer layer that runs them on decode steps. topk_pack and swa_decode_meta build the decode attention metadata, fused_markov is DSpark's Markov sampling in one launch, and draft_lm_head keeps the DSpark draft's 5-row logits GEMM off wvSplitK. All of them run only when enabled() is true.

Modules:

  • cand_logits –

    The indexer logits of the DSpark candidate positions on gfx942.

  • draft_lm_head –

    The DSpark draft's base logits on gfx942.

  • fused_markov –

    DSpark's sequential Markov sampling with one launch a draft step.

  • sparse_indexer –

    The sparse indexer layer of DeepSeek-V4.1 with --monokernel on gfx942.

  • swa_decode_meta –

    One-launch decode build of the DeepSeek V4.1 SWA metadata on ROCm.

  • topk –

    The sparse indexer's decode top-512 for gfx942 (topk512_gfx942.cu).

  • topk_pack –

    One-launch packing of the DeepSeek V4.1 decode top-k into global slots.

Functions:

  • enabled –

    True with --monokernel on a gfx942 GPU. Every helper keeps the result

  • record_monokernel –

    Record whether this process's model runs with --monokernel. The mono

enabled() cached

True with --monokernel on a gfx942 GPU. Every helper keeps the result of vLLM's op it replaces, so each one returns False for a call it cannot take and vLLM then runs its own op. gfx950 always keeps vLLM's ops here.

Source code in vllm/models/deepseek_v41/amd/ops/__init__.py
@functools.cache
def enabled() -> bool:
    """True with --monokernel on a gfx942 GPU. Every helper keeps the result
    of vLLM's op it replaces, so each one returns False for a call it cannot
    take and vLLM then runs its own op. gfx950 always keeps vLLM's ops here."""
    if not _monokernel or not current_platform.is_rocm():
        return False
    from vllm.platforms.rocm import on_gfx942

    return on_gfx942()

record_monokernel(vllm_config)

Record whether this process's model runs with --monokernel. The mono decode layer calls this when the model is created, before any helper runs.

Source code in vllm/models/deepseek_v41/amd/ops/__init__.py
def record_monokernel(vllm_config) -> None:
    """Record whether this process's model runs with --monokernel. The mono
    decode layer calls this when the model is created, before any helper
    runs."""
    global _monokernel
    _monokernel = bool(vllm_config.kernel_config.monokernel)
    enabled.cache_clear()