Skip to content

vllm.model_executor.layers.dash_attention

DASH attention with page-aware RoPE and paged KV execution.

The optional prompt length restricts remote reads to the input prefix, while generated tokens are visible only in the local output window.

Functions:

  • dash_attention –

    Attend query suffix [Q,H,D] against cached keys [S,Hkv,D].

  • page_coordinates –

    Return token/page RoPE coordinates and image/query page IDs.

  • page_rope –

    Apply non-interleaved RoPE with token/page frequency-pair sections.

  • prompt_page_positions –

    Token offsets, routing pages, page count and negative prompt lengths.

_fixed_order_cumsum(x)

Scan each row with the same addition order for every batch shape.

dash_attention(q, k, v, iq, ik, roles, head_cls, sp, layer_idx, prompt_length=None, backend='TRITON_ATTN')

Attend query suffix [Q,H,D] against cached keys [S,Hkv,D].

page_coordinates(roles)

Return token/page RoPE coordinates and image/query page IDs.

Roles encode text=0, image=1 and =2. The entire prompt must be available: response markers restart numbering after the last prompt image.

page_rope(x, tok, page, sp, *, main)

Apply non-interleaved RoPE with token/page frequency-pair sections.

prompt_page_positions(input_tokens, sp)

Token offsets, routing pages, page count and negative prompt lengths.

Routing pages are one-based and unbounded; attention clamps them for RoPE. Negative lengths distinguish recomputed positions from the runner's ordinary, nonnegative decode positions.