mstar.engine.resources.attn.ragged.wrappers#
Functions
|
Smallest FlashInfer-supported head dim >= |
Classes
|
Varlen self-attention over packed segments, with no KV cache; attention is within variable-length segments packed into one |
- class mstar.engine.resources.attn.ragged.wrappers.RaggedPrefillWrapper(workspace_buffer, num_qo_heads, num_kv_heads, head_dim, max_num_segments=None, max_total_tokens=None, device=torch.device('cuda'), use_cuda_graph=False, sm_scale=None, q_data_type=torch.bfloat16, kv_layout='NHD', backend='auto')[source]#
Bases:
objectVarlen self-attention over packed segments, with no KV cache; attention is within variable-length segments packed into one
[total_tokens, H, D]tensor.cu_seqlensis bothqo_indptrandkv_indptr.- Parameters:
- plan(cu_seqlens, causal=False)[source]#
Plan one packed layout.
cu_seqlens:[num_segments + 1], [0] == 0.CPU tensor preferred; a GPU one costs a sync. Safe to call before every replay — values are copied through the static buffers, not rebound.
- run(q, k, v)[source]#
Run planned varlen self-attention.
- Parameters:
- Returns:
[total_tokens, num_qo_heads, head_dim]
- Return type:
output
Only rows before the planned
cu_seqlens[-1]are computed; the rest read back zero. An oversized static buffer replays fine, but the caller must still slice — the padding rows are not a valid result.