Skip to content

vllm.v1.attention.backends.gdn_attn

Backend for GatedDeltaNet attention.

Classes:

Functions:

GDNAttentionMetadataBuilder

Bases: AttentionMetadataBuilder[GDNAttentionMetadata]

Methods:

_check_chunk_metadata_override(builder_cls, backend) staticmethod

Reject a subclass whose chunk metadata the AITER path would skip.

AITER brings its own varlen prefill metadata and never calls _build_chunk_metadata, so a builder that overrides it would lose that override without a word. No in-tree subclass can get here -- _resolve_gdn_prefill_backend only selects this backend for models with 128-dim GDN key and value heads, which the KDA builders are not -- but a future one should be told rather than quietly ignored.

_stage_decode(num_prefills, num_decodes, num_spec_decodes)

Whether decode metadata goes into the FULL cudagraph buffers.

_stage_spec_decode(num_prefills, num_decodes, num_spec_decodes, num_spec_decode_tokens)

Whether spec-decode metadata goes into the FULL cudagraph buffers.

build_for_cudagraph_capture(common_attn_metadata)

This method builds the metadata for full cudagraph capture. Currently, only decode is supported for full cudagraphs with Mamba.

update_block_table(metadata, blk_table, slot_mapping)

Re-gather this group's state indices. The other fields are batch-level and stay shared with metadata.

plan_flashinfer_checkpoints(offsets, query_lens)

Lay out internal checkpoints as FlashInfer GDN prefill emits them.

The interval (gcd of the offsets) can emit states no row uses; slots skips writing them. Slots rule out FlashInfer's CP route, so they are returned only when needed.

Parameters:

  • offsets

    (list[int]) –

    Checkpoint offset into each checkpoint row's query, 0 for none. The last len(query_lens) rows are the prefill kernel's.

  • query_lens

    (list[int]) –

    Query length of each sequence the prefill kernel runs.

Returns:

  • int –

    (every_n_tokens, cu_starts, rows, slots): the interval, cumulative

  • list[int] –

    per-sequence counts of emitted states, each checkpoint row's buffer

  • list[int] –

    row, and each emitted state's buffer row (-1: skipped), or None when

  • list[int] | None –

    every emitted state is used.