pub fn cost_flash_decoding_cuda(
_shapes: &[Shape],
dtypes: &[DType],
params: &OpParams,
_caps: &BackendCapabilities,
) -> CostEstimateExpand description
Cost for the CUDA flash_decoding decode arm (binding-table form).
Doubles as the static ranker gate for the decode kernel’s supported
set. Fuel dispatch is fail-fast (a registered kernel that returns Err
fails realize; there is NO runtime fallback to the decomposed base
map — see pipelined.rs “Fail-fast dispatch”), so an unsupported shape
must never be PLACED on this kernel. This returns an INFEASIBLE cost
(saturates composite_ns to u64::MAX) for anything the kernel can’t
do — seq_q != 1, or head_dim outside [1, 128] — so the ranker
keeps the decomposed base map / CPU oracle. Inside the supported set it
prices a real decode: work scales with the live prefix k_len, not the
physical capacity sk.
NOTE (design): cost DEPRIORITIZES but does not HARD-EXCLUDE a candidate
(composite_ns ranks; it never drops). For a decode node whose K/V are
already CUDA-resident this is sufficient — the decomposed arm is cheaper
once the infeasible cost saturates. The GUARANTEED clean decline for a
KV-resident prefill (seq_q > 1) is the Op::Branch decode-arm
emission (symbolic-extent persistent decode; D2/D3), which only ever
creates the CUDA flash arm for seq_q == 1 shapes. See the gating note
in fuel-cuda-backend/src/baracuda/attention.rs.