Skip to content

[CuTe] Route forward through typed configs - #2733

Draft
drisspg wants to merge 1 commit into
drisspg/stack/50from
drisspg/stack/51
Draft

[CuTe] Route forward through typed configs#2733
drisspg wants to merge 1 commit into
drisspg/stack/50from
drisspg/stack/51

Conversation

@drisspg

@drisspg drisspg commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Stacked PRs:


Human Note

Agent Note

Summary

This wires the typed config model into the real forward path without changing the public wrappers. _flash_attn_fwd becomes the one place that extracts host metadata, selects or validates one config, and launches it.

config=None preserves normal policy selection. Passing an explicit FwdConfig means use exactly that config or raise. Generic SM100 and dedicated HD256 consume the resolved named register allocation directly, so kernel code cannot silently replace an explicit choice. SplitKV callers may also provide reusable partial O/LSE workspaces for allocation-free replay.

FA4 forward runtime flow

Host-path cost

The SM-count query is now lazy. Only automatic SplitKV needs the target SM count; fixed and explicit split requests store num_sms=0 and skip the environment/device query. The fixed path measured 1.341→0.030 us, while automatic SplitKV still resolves the matching local GPU or explicit cross-compilation target exactly as before.

Together with the tuple-backed keys in #2732, constructing selector inputs plus a warm cache hit measured 5.734→1.378 us. This matters to eager and generated Flex runtime wrappers but is intentionally absent from the CUDA-graph kernel measurements in the policy PRs.

A complete warm host-dispatch check used real preallocated CUDA tensors, a hit-only compile cache, and a no-op compiled callable:

Shape Before cleanup After cleanup Saved
Decode 36.856 us 21.482 us 15.374 us (41.7%)
Short attention 36.267 us 21.149 us 15.118 us (41.7%)
Prefill 36.271 us 21.289 us 14.982 us (41.3%)

“Before” is exact stack head 69285d1c; “after” is 60fe2c4c. The benchmark excludes GPU execution and compilation, so it isolates the wrapper work changed by #2732/#2733.

Implementation and validation

  • Replaces the inline forward scheduling policy with FwdHeuristicInputs construction followed by selection or exact validation.
  • Main and SplitKV-combine kernels use the independent typed identities defined in the preceding config PR.
  • Generic SM100/SM110 and dedicated HD256 constructors consume FwdRegisterAllocation; the hidden kernel-side register tables are removed.
  • Exact SplitKV counts can share one main specialization while compiling only the combine capacity buckets they require.
  • Optional out_partial and lse_partial buffers are shape/device/dtype validated and accepted only for a resolved SplitKV config.
  • has_lse is derived from preallocated LSE, return_lse, or autograd requirements, keeping output-only and LSE-producing policy separate.
  • The standalone exp2 sweep remains exp2-only; register experiments use explicit configs.
  • Public functions and autograd wrappers are unchanged.

The fuzz-found alignment, static-layout, aux-ABI, fake-SM, and combine-operand corrections live in the base PR rather than obscuring this routing change. At this boundary, interface.py is 19 lines smaller than its parent. The standalone boundary passes 47 host config/cache tests, and focused GB300 runtime tests pass for register forcing, SplitKV specialization reuse, CLC, MLA cache identity, and selector metadata. Emitted PTX confirms the resolved register immediates are consumed.

@drisspg
drisspg force-pushed the drisspg/stack/50 branch from b9e2fd0 to e8ecee8 Compare July 25, 2026 21:24
@drisspg
drisspg force-pushed the drisspg/stack/51 branch from df17518 to da31d79 Compare July 25, 2026 21:24
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 27, 2026 20:05
@drisspg
drisspg force-pushed the drisspg/stack/51 branch from da31d79 to c11764a Compare July 27, 2026 20:05
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 27, 2026 20:05
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 27, 2026 22:54
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 27, 2026 22:54
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 28, 2026 20:26
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 28, 2026 20:27
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 29, 2026 01:15
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 29, 2026 01:15
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 29, 2026 02:40
@drisspg
drisspg force-pushed the drisspg/stack/51 branch from c11764a to 3d8e4f4 Compare July 29, 2026 02:40
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 29, 2026 02:40
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 29, 2026 03:30
@drisspg
drisspg force-pushed the drisspg/stack/51 branch from 3d8e4f4 to c01eaba Compare July 29, 2026 03:30
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 29, 2026 03:30
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 29, 2026 06:37
@drisspg
drisspg force-pushed the drisspg/stack/51 branch from c01eaba to ef634f1 Compare July 29, 2026 06:37
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 29, 2026 06:37
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 29, 2026 16:41
@drisspg
drisspg force-pushed the drisspg/stack/51 branch from 104b02e to ee720f0 Compare July 30, 2026 00:55
@drisspg
drisspg force-pushed the drisspg/stack/50 branch 2 times, most recently from 8925826 to f8f262c Compare July 30, 2026 00:58
@drisspg
drisspg force-pushed the drisspg/stack/51 branch 2 times, most recently from e6a8be0 to a8bface Compare July 30, 2026 01:16
@drisspg
drisspg force-pushed the drisspg/stack/50 branch from f8f262c to 5cba024 Compare July 30, 2026 01:16
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 30, 2026 01:36
@drisspg
drisspg force-pushed the drisspg/stack/51 branch from a8bface to fcfadd9 Compare July 30, 2026 01:37
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 30, 2026 01:37
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 30, 2026 01:52
@drisspg
drisspg force-pushed the drisspg/stack/51 branch from fcfadd9 to 615ac6c Compare July 30, 2026 01:52
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 30, 2026 01:52
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 30, 2026 02:04
@drisspg
drisspg force-pushed the drisspg/stack/51 branch from 615ac6c to 6509ac9 Compare July 30, 2026 02:04
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 30, 2026 02:04
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 30, 2026 02:48
@drisspg
drisspg force-pushed the drisspg/stack/51 branch from 6509ac9 to 7e75b57 Compare July 30, 2026 02:48
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 30, 2026 02:49
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 30, 2026 03:47
@drisspg
drisspg force-pushed the drisspg/stack/51 branch from 7e75b57 to 8893cca Compare July 30, 2026 03:48
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 30, 2026 03:48
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 30, 2026 05:16
@drisspg
drisspg force-pushed the drisspg/stack/51 branch from 8893cca to 8acd085 Compare July 30, 2026 05:16
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 30, 2026 05:16
Make _flash_attn_fwd the single selection, validation, and execution boundary.
Explicit FwdConfig values are forced exactly; config=None uses the analytical
selector. Replace the inline scheduling policy with host metadata extraction and
one resolved config, then key main and SplitKV-combine compilation independently.

Make generic SM100 and dedicated HD256 kernels consume the resolved register
allocation directly instead of applying hidden kernel-side tables. Also accept
validated reusable float32 SplitKV partial-output and LSE storage so callers can
keep allocation outside replayed execution.

stack-info: PR: #2733, branch: drisspg/stack/51
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 30, 2026 16:01
@drisspg
drisspg force-pushed the drisspg/stack/51 branch from 8acd085 to 86af3e1 Compare July 30, 2026 16:01
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 30, 2026 16:01
@drisspg
drisspg changed the base branch from drisspg/stack/50 to main July 30, 2026 17:14
@drisspg
drisspg changed the base branch from main to drisspg/stack/50 July 30, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant