Skip to content

feat(cake_gdn_det): sm_107a (R200) libraries with grad - #7974

Merged
yyihuang merged 5 commits into
flashinfer-ai:mainfrom
yyihuang:cake-gdn-det-train-sm107
Oct 30, 2026
Merged

yyihuang merged 5 commits into
flashinfer-ai:mainfrom
yyihuang:cake-gdn-det-train-sm107

Conversation

@yyihuang

@yyihuang yyihuang commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

This PR adds an sm_107a (R200) build of flashinfer.experimental.cake_gdn_det_train. That package, added in #7592, is the deterministic Cake backend for chunked Gated DeltaNet (GDN, scalar gate) training. It has these variants:

  • Data types: BF16 q/k/v with FP32 or BF16 beta. An FP32 initial state and a final state output are optional.
  • Layouts: fixed-length batches, and packed variable-length batches whose chunk tables are built on the host or on the device.
  • Backward forms: one fused kernel for the backward tail when HV = 2 x H, and separate kernels for other head groupings.

All 29 kernel libraries in the package now also ship for sm_107a, so the package has 87 libraries across sm_100a, sm_103a and sm_107a. (10, 7) devices select the sm_107a libraries, which need CUDA 13.4 or newer. The sm_100a and sm_103a libraries are unchanged.

No earlier Cake version exists for sm_107a, so the baseline is FLA 0.5.2 (chunk_gated_delta_rule, Triton). For each column, the FLA value is the faster of two FLA forms: q/k repeated to the value heads, or native grouped value heads.

NVIDIA R200 (sm_107a, 216 SMs), CUDA 13.4, BF16 inputs. Median latency in ms with L2 flushed, both backends measured on the same GPU. Speedup = FLA / Cake, with a 95 % paired bootstrap CI.

Shape (H / HV) Fwd FLA ms Fwd Cake ms Fwd speedup [95 % CI] Fwd + bwd FLA ms Fwd + bwd Cake ms Fwd + bwd speedup [95 % CI]
4 x 4096, H8 / HV16 0.2819 0.1547 1.822 [1.820, 1.823] 1.4441 0.4436 3.255 [3.254, 3.258]
3 seqs (5406, 3448, 3896) = 12,750 tok, H8 / HV16 0.2640 0.1314 2.009 [2.000, 2.018] 1.2962 0.3684 3.518 [3.508, 3.527]
8 x 4096, H8 / HV16 0.4644 0.2884 1.610 [1.609, 1.612] 2.6597 0.8370 3.178 [3.173, 3.182]
7 seqs = 30,100 tok, H8 / HV16 0.4591 0.2731 1.681 [1.680, 1.682] 2.5042 0.7818 3.203 [3.202, 3.204]
16 x 4096, H8 / HV16 0.9056 0.5108 1.773 [1.772, 1.774] 5.1195 1.2926 3.961 [3.960, 3.961]
15 seqs = 64,500 tok, H8 / HV16 0.9640 0.5351 1.801 [1.800, 1.803] 5.2974 1.3372 3.961 [3.960, 3.963]
1 x 16384, H8 / HV16 0.5424 0.1713 3.166 [3.165, 3.168] 2.4187 0.4511 5.362 [5.359, 5.366]
4 x 4096, H16 / HV32 0.4693 0.2934 1.600 [1.599, 1.600] 2.6506 0.8516 3.113 [3.111, 3.114]
16 x 4096, H16 / HV32 1.6972 1.0094 1.681 [1.681, 1.682] 10.0197 2.5633 3.909 [3.908, 3.910]
1 x 16384, H16 / HV32 0.7017 0.2806 2.501 [2.500, 2.502] 3.7446 0.8058 4.647 [4.646, 4.648]
3 seqs (131071, 87531, 43385) = 261,987 tok, H2 / HV6 3.8081 0.7254 5.250 [5.245, 5.255] 15.5041 2.5389 6.107 [6.102, 6.111]
2 seqs = 259,174 tok, H2 / HV6 3.7820 0.7193 5.258 [5.256, 5.261] 15.4238 2.5182 6.125 [6.124, 6.126]
6 seqs = 241,817 tok, H2 / HV6 3.6040 0.6881 5.238 [5.235, 5.240] 14.6769 2.4246 6.053 [6.050, 6.056]
64 x 4096 = 262,144 tok, H2 / HV6 1.7997 0.6900 2.608 [2.607, 2.610] 8.2023 2.1594 3.798 [3.796, 3.801]
3 seqs (11000, 12000, 9768) = 32,768 tok, H16 / HV48 1.2959 0.7600 1.705 [1.705, 1.706] 7.6057 2.6553 2.864 [2.862, 2.867]

The other Cake GDN backend in FlashInfer is cake_gdn_train, a separate training backend with context parallelism; cake_gdn_det_train now ships for sm_100a (B200 / GB200), sm_103a (B300 / GB300) and sm_107a (R200).

Summary by CodeRabbit

  • New Features
    • Added support for SM107 (R200) in experimental Cake GDN training, including architecture-specific kernel and prep selection. CUDA 13.4 or newer is required.
  • Bug Fixes
    • Updated SM107 memory handling and scan behavior for compatible execution.

averyhNV and others added 5 commits October 29, 2026 21:27
…ries

Adds sm_107a to ARCHES, the (10, 7) capability and every record, the
provisional sm_107a prep_tma window (3 CTAs per SM) and dhu_tc2 selection
constants, and the suite rows at 216 SMs.

Co-Authored-By: Claude <noreply@anthropic.com>
Exported render: 87 libraries (29 programs on sm_100a, sm_103a and
sm_107a; sm_107a needs CUDA 13.4).  The program names follow the moved
kernel sources; the sm_100a and sm_103a machine code is unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
The sm_107a dhu_tc2 selection constants and prep_tma window, measured on
a 216-SM R200: t_lat 1.708, t_full 2.357, t_unit 1.329 and c_dvl 1.696
us; 3 CTAs per SM and window 1.0 (no plain-prep band: prep_tma was
faster in every swept cell up to 10,240 CTAs).  The suite's sm_107a
r01 T_tc follows (113.3), and the prep-rule tests accept a window
without a band.  The sm_100a and sm_103a entries are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
The sm_100a and sm_103a prep-rule assertions are again those of the
SM107 registry commit (window > 1, a plain-prep band); the no-band
branch runs for sm_107a only and asserts its window of 1.0.  The
sm_107a window note is corrected: on the R200 prep sweep (128-16,384
CTAs, BF16 and FP32 beta) the window rule found no plain-prep band in
1.0-6.0 x slots, so 1.0 (no band) was chosen.  prep_tma was faster in
78 of 80 cells; with BF16 beta it tied at 10,240 CTAs and lost 1.6 %
at 12,288 CTAs (19 x slots, beyond every candidate band).

Co-Authored-By: Claude <noreply@anthropic.com>
The generator now folds additive-zero terms in index arithmetic
(for example `(x + 0)` becomes `x`).  Five kernel sources, each built
for sm_100a, sm_103a and sm_107a, lose those terms; build.json records
their new hashes and the generator revision.  The SASS and resource
usage of all 87 libraries are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 166ef082-9c8f-4448-b0e8-8f24445d6df4
Commits

Reviewing files that changed from the base of the PR and between 3472ad3 and f6bfe9f.

Files selected for processing: 64
  • flashinfer/experimental/cake_gdn_det_train/README.md
  • flashinfer/experimental/cake_gdn_det_train/__init__.py
  • flashinfer/experimental/cake_gdn_det_train/build.json
  • flashinfer/experimental/cake_gdn_det_train/cake_backend.py
  • flashinfer/experimental/cake_gdn_det_train/cake_jit.py
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_0042d1f826d7b34a3502_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_0042d1f826d7b34a3502_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_03575624cc83e8306b50_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_03575624cc83e8306b50_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_05246cd82e6cd8cb13de_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_05246cd82e6cd8cb13de_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_0913a61686a30d2645ed_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_0913a61686a30d2645ed_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_1a59c00ea7fe1a2d5026_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_1a59c00ea7fe1a2d5026_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_3110e8d67bd04f7c0ed8_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_3110e8d67bd04f7c0ed8_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_3dcb21c29f293de9d8a5_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_3dcb21c29f293de9d8a5_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_4cef820f9f892d2d614c_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_4cef820f9f892d2d614c_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_5019df7dc53ea2403549_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_5019df7dc53ea2403549_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_52e4bbd5197fee07b86d_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_52e4bbd5197fee07b86d_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_531e1643b16a4eb35f00_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_531e1643b16a4eb35f00_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_57958753e089c9e52b0d_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_57958753e089c9e52b0d_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_58fdeddbc9ee57882e10_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_58fdeddbc9ee57882e10_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_6603e46badf20a764afd_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_6603e46badf20a764afd_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_6b52f300724a7d50e87b_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_6b52f300724a7d50e87b_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_6f7ed4b5b464365b8784_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_6f7ed4b5b464365b8784_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_7fcaaff11db5040adbc8_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_7fcaaff11db5040adbc8_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_8894fe7026af7fdb74cc_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_8894fe7026af7fdb74cc_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_8a9d0a8c5811720bf911_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_8a9d0a8c5811720bf911_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_95d33b5dc750789fe35d_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_95d33b5dc750789fe35d_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_a53802d8ca90b6d1949b_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_a53802d8ca90b6d1949b_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_b087d15e903e3ffc9310_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_b087d15e903e3ffc9310_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_b0f5de510f54862cd806_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_b0f5de510f54862cd806_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_c2f1056fb97378ce31a0_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_c2f1056fb97378ce31a0_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_dcbc861433220b7bc582_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_dcbc861433220b7bc582_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_e093e6083fb05369c61f_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_e093e6083fb05369c61f_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_e7e3c7b8a39fe778e512_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_e7e3c7b8a39fe778e512_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_f865ea338bf66722812d_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_f865ea338bf66722812d_kernel.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_f9a16941df3dfcf59a3f_binding.cu
  • flashinfer/experimental/cake_gdn_det_train/csrc/cake_gdn_det_train_f9a16941df3dfcf59a3f_kernel.cu
  • tests/experimental/test_cake_gdn_det_train.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.

Walkthrough

The Cake GDN training backend adds SM107 support with CUDA 13.4 requirements, architecture-specific prep dispatch, generated kernel updates, and test coverage for SM107 dispatch and campaign plans.

Changes: SM107 Cake GDN training support

Layer / File(s) Summary
Register SM107 and configure dispatch
flashinfer/experimental/cake_gdn_det_train/cake_jit.py, flashinfer/experimental/cake_gdn_det_train/cake_backend.py, flashinfer/experimental/cake_gdn_det_train/__init__.py, flashinfer/experimental/cake_gdn_det_train/README.md, tests/experimental/test_cake_gdn_det_train.py
The architecture registry and package descriptions add SM107. The prep_tma selector uses 3 CTAs per SM and a 1.0 window for SM107; the README states that all tested SM107 grids use TMA prep and that CUDA 13.4 or newer is required. Tests add SM107 device properties, segmented adjoint-plan expectations, and prep-dispatch checks.
Update generated kernels for SM107
flashinfer/experimental/cake_gdn_det_train/csrc/*_kernel.cu
Generated kernel identifiers are updated. Several kernels use 0x7FFF shared-memory descriptor masks for architecture 1070 while retaining 0x3FFF on other architectures. Some generated input staging and TMEM load offsets are also updated; many other edits rename local variables without changing the summarized calculations or data flow.
Retarget generated bindings
flashinfer/experimental/cake_gdn_det_train/csrc/*_binding.cu
Generated bindings use the updated kernel identifiers for declarations, shared-memory attributes, launches, and run registrations. The summarized binding validation and launch configurations remain unchanged.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~30 minutes

Change: Feature

Suggested reviewers: yzh119

Merge Risk: Minimal · up to f6bfe

SM107 support adds no identified merge-blocking risk; existing architecture builds remain isolated.

Pre-merge checks: Passed 3 · Failed 1 · Inconclusive 1

Failed Failed checks: 1 warning · 1 inconclusive

Check name Status Explanation Resolution
Description check Warning The description gives a detailed and relevant summary, implementation scope, compatibility requirement, and benchmark results. However, it omits required template sections and declarations, including … Add the missing template sections. Provide the related issue, complete the pre-commit and test checklist, state whether full-scope CI is required and why, and complete the Experimental Track section with the tracking issue, owner, reason, g…
Docstring Coverage Inconclusive Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title "feat(cake_gdn_det): sm_107a (R200) libraries with grad" names the main change: adding sm_107a (R200) kernel libraries to the cake_gdn_det_train backend. The changeset adds sm_107a to ARCHES…
Full details: Title check

Explanation

The title "feat(cake_gdn_det): sm_107a (R200) libraries with grad" names the main change: adding sm_107a (R200) kernel libraries to the cake_gdn_det_train backend. The changeset adds sm_107a to ARCHES and ARCH_BY_CAPABILITY, renames regenerated kernel binaries, adds sm_107a prep and tests, and updates the README. The title is specific and concise. The term "with grad" refers to the backward (gradient) training path and is a valid aspect of the change, though it is less precise than the architecture addition.

Full details: Description check

Explanation

The description gives a detailed and relevant summary, implementation scope, compatibility requirement, and benchmark results. However, it omits required template sections and declarations, including related issues, checklist status, test status, the experimental tracking issue and graduation details, and the experimental test targets.

Resolution

Add the missing template sections. Provide the related issue, complete the pre-commit and test checklist, state whether full-scope CI is required and why, and complete the Experimental Track section with the tracking issue, owner, reason, graduation plan, intended-hardware validation, and an experimental-tests block listing existing targets under tests/experimental/. Include a runnable example if required by the experimental policy.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 47 functions across 50 files. (9 skipped: 1 unsupported, 8 over the file limit.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yyihuang

Copy link
Copy Markdown
Collaborator Author

@flashinfer-bot run tests/experimental/test_cake_gdn_det_train.py

@yyihuang yyihuang changed the title feat(cake_gdn_det_train): sm_107a (R200) libraries feat(cake_gdn_det): sm_107a (R200) libraries with grad Oct 30, 2026
@yyihuang
yyihuang enabled auto-merge (squash) October 30, 2026 05:44
@yyihuang

Copy link
Copy Markdown
Collaborator Author

@abcdabcd987

@yyihuang
yyihuang merged commit b7434ad into flashinfer-ai:main Oct 30, 2026
29 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

op: linear attention KDA, mamba, GDN, etc. review filtering. run-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants