Skip to content

[Doc]: SDPA execute-time shape override cannot cross s_q == 1; heuristic engine flips between declared max_len 128 and 256 #1087

Description

@YangXu1990uiuc

Summary

Two properties of execute-time shape override (pygraph(is_override_shape_enabled=True) + execute(..., override_uids, override_shapes, override_strides)) on the unified SDPA forward engine are not documented and cost users a plan build (or an error) when hit:

  1. The s_q == 1 boundary cannot be crossed. A graph built with s_q == 1 (decode class) rejects an override to s_q > 1 and vice versa with CUDNN_STATUS_NOT_SUPPORTED_INVALID_DYNAMIC_SHAPE. Callers have to keep separate graphs for the two classes (FlashInfer does: perf(prefill): build the cuDNN ragged graph once per length class via execute-time shape override; keep single-token GQA rows off cuDNN (NVBug 6783545) flashinfer-ai/flashinfer#5245).
  2. Heuristic engine flips with the declared max sequence length. Between a declared max_len of 128 and 256 the mode-A heuristic switches engine (e.g. eng8 → eng10) on SM100 and SM107, independent of batch, head dims or Stats. Overriding a graph declared long to a short real shape runs the long-class engine: 2.0-2.3x slower on 4-token rows than a graph declared short (measured on B200). So callers should also class shapes as "<= 128" vs "> 128" when they build once and override.

Also worth stating in the docs: override forces the split-K factor to 1; for the cu_seq_len form this is already the case, for the per-batch seq_len form it costs 1.2-1.6x on low-occupancy shapes.

Ask

Document these in the SDPA / dynamic shape pages (and ideally surface (1) at build time rather than at execute).

note to self: claude::61d24ed2-7c90-4a97-9cbb-b91ae18136fd — "flashinfer frost prefill/GEMM enablement" · cwd /home/scratch.yanxu_libs/flashinfer

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cat-docDocumentation changes, examples, API references, tutorials, or wording fixes.mod-frontendcuDNN frontend APIs, operation graph construction, plans, and user-facing wrappers.orig-nv-engReported or requested by NVIDIA engineering.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions