Skip to content

refactor(cake_kda): give single-rank and context-parallel KDA training deterministic names - #8054

Merged
yyihuang merged 13 commits into
flashinfer-ai:mainfrom
yyihuang:kda-kcp-det-names
Oct 31, 2026
Merged

yyihuang merged 13 commits into
flashinfer-ai:mainfrom
yyihuang:kda-kcp-det-names

Conversation

@yyihuang

@yyihuang yyihuang commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

The KDA (Kimi Delta Attention) chunked training operator has two variants. Both are deterministic BF16: one is single-rank and the other is context-parallel (KCP). This PR gives both variants deterministic names. It supersedes #8082.

Only the names change in behavior. Some generated kernel sources are regenerated from the current kernel sources; the program digests are unchanged.

Single-rank. The public functions are now chunk_kda_det, chunk_kda_det_fwd and chunk_kda_det_bwd in flashinfer.experimental.cake_kda_det_train. The previous name was chunk_kda in flashinfer.experimental.cake_kda_train.

Context-parallel (KCP). The package is now flashinfer.experimental.cake_kda_det_train_kcp, and the entry module is flashinfer.cake_kda_det_train_kcp. The new names are:

  • Functions: chunk_kda_det_kcp, chunk_kda_det_fwd_kcp, chunk_kda_det_bwd_kcp, partition_det_kcp, build_context_det_kcp
  • Byte helpers: kda_det_workspace_bytes_kcp, kda_det_saved_bytes_kcp, kda_det_comm_bytes_kcp
  • Types: RecomputeHandleDetKcp, WorkspaceDetKcp, SavedDetKcp, OptionsDetKcp, CallDetKcp

The previous names still point to the same objects. Examples include chunk_kda_kcp, kcp_partition, build_kcp_context and KcpRecomputeHandle in flashinfer.kda_train. The modules flashinfer.experimental.cake_kda_train.cake_kcp, cake_kcp_plan and cake_kcp_jit also still work.

Kernel libraries are renamed to cake_kda_det_train_<digest>. Programs used only for context parallelism also get a _kcp suffix.

Speed

Single-rank

The baseline is the same operator on main under its previous names. After/before ranges from 0.996 to 1.021, with a median of 1.000. A value below 1 means the new build is faster. In the pass column, fwd = forward, bwd = backward and ckpt = checkpointed forward+backward.

NVIDIA B200 (sm_100a), CUDA 13.4. Kernel time per call, median of 15 interleaved runs per side; kernels compiled with CUDA 13.4 (nvcc 13.4.92), torch 2.14.1 with CUDA 13.0 runtime.

seqlen docs heads pass before (ms) after (ms) after/before
16384 3 4 fwd 0.1955 0.1947 0.9961
16384 3 4 bwd 0.4629 0.4628 0.9999
16384 3 4 ckpt 1.8105 1.8150 1.0025
16384 3 64 fwd 1.1408 1.1408 1.0000
16384 3 64 bwd 3.3240 3.3250 1.0003
16384 3 64 ckpt 5.6065 5.6044 0.9996
65536 3 4 fwd 0.4588 0.4588 1.0000
65536 3 4 bwd 0.9851 0.9851 1.0000
65536 3 4 ckpt 1.8852 1.8852 1.0000
65536 3 64 fwd 4.4197 4.4196 1.0000
65536 3 64 bwd 13.0171 13.0621 1.0035
65536 3 64 ckpt 22.6083 22.6054 0.9999
261393 4 4 fwd 1.4837 1.4837 1.0000
261393 4 4 bwd 3.4094 3.4094 1.0000
261393 4 4 ckpt 6.3642 6.3643 1.0000

NVIDIA GB300 (sm_103a), CUDA 13.4. Kernel time per call, median of 7 interleaved runs per side; kernels compiled with CUDA 13.4 (nvcc 13.4.92), torch 2.14.1 with CUDA 13.0 runtime.

seqlen docs heads pass before (ms) after (ms) after/before
16384 3 4 fwd 0.2792 0.2826 1.0124
16384 3 4 bwd 0.4324 0.4332 1.0016
16384 3 4 ckpt 1.6677 1.7020 1.0206
16384 3 64 fwd 1.0445 1.0449 1.0004
16384 3 64 bwd 2.9789 2.9799 1.0003
16384 3 64 ckpt 5.0525 5.0545 1.0004
65536 3 4 fwd 0.4258 0.4260 1.0005
65536 3 4 bwd 0.9052 0.9052 1.0000
65536 3 4 ckpt 1.7357 1.7357 1.0000
65536 3 64 fwd 4.0548 4.0497 0.9987
65536 3 64 bwd 11.5901 11.5891 0.9999
65536 3 64 ckpt 19.6701 19.6731 1.0002
261393 4 4 fwd 1.3773 1.3773 1.0000
261393 4 4 bwd 3.0956 3.0966 1.0003
261393 4 4 ckpt 5.8327 5.8317 0.9998

sm_107a GPU (216 SMs), CUDA 13.4. Kernel time per call, median of 7 interleaved runs per side; kernels compiled with CUDA 13.4 (nvcc 13.4.92), torch 2.14.1 with CUDA 13.0 runtime.

seqlen docs heads pass before (ms) after (ms) after/before
16384 3 4 fwd 0.1557 0.1557 1.0003
16384 3 4 bwd 0.3671 0.3672 1.0002
16384 3 4 ckpt 0.9285 0.9284 0.9998
16384 3 64 fwd 0.7118 0.7118 1.0000
16384 3 64 bwd 2.0421 2.0424 1.0001
16384 3 64 ckpt 3.4590 3.4589 1.0000
65536 3 4 fwd 0.2999 0.3000 1.0001
65536 3 4 bwd 0.6299 0.6297 0.9997
65536 3 4 ckpt 1.2203 1.2203 1.0000
65536 3 64 fwd 2.7201 2.7205 1.0001
65536 3 64 bwd 7.8767 7.8750 0.9998
65536 3 64 ckpt 13.3223 13.3200 0.9998
261393 4 4 fwd 0.8900 0.8899 0.9999
261393 4 4 bwd 2.0692 2.0680 0.9994
261393 4 4 ckpt 3.8408 3.8400 0.9998

Context-parallel (KCP)

NVIDIA GB200 (sm_100a), 4 GPUs on one node, torch 2.14.1 with CUDA 13.0 runtime. The benchmark is benchmarks/bench_cake_kda_train_kcp.py, run with torchrun as one process per rank. Each iteration times the KCP causal conv1d and then the KCP KDA step, forward and backward, with CUDA events. The slowest rank's time counts. The baseline is the same path under the previous names. The workload is a packed seqlen of 65536 with 3 documents (15945, 21845 and 27746 tokens), 16 heads and 4096 channels. Each value is the median over interleaved runs per side, in the order base, branch, branch, base. Each run's figure is the benchmark's median over 3 groups of 8 timed iterations. After/before ranges from 0.9972 to 1.0059, so speed is unchanged within noise.

CP layout runs per side before (ms) after (ms) after/before
2 contiguous 4 4.4738 4.4745 1.0002
2 zigzag 4 4.5052 4.5316 1.0059
2 zigzag_per_document 4 4.6152 4.6323 1.0037
4 contiguous 10 3.3632 3.3602 0.9991
4 zigzag 4 3.4179 3.4083 0.9972
4 zigzag_per_document 10 3.4430 3.4533 1.0030

Coverage

The KDA family ships these two training variants, single-rank and context-parallel, on sm_100a, sm_103a and sm_107a.

@yyihuang yyihuang added the op: linear attention KDA, mamba, GDN, etc. review filtering. label Oct 30, 2026
@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: baa94ba7-89db-42d0-9ff5-681571a6b219
Commits

Reviewing files that changed from the base of the PR and between 5f1eae4 and 024adad.

Files selected for processing: 218
  • .github/labeler.yml
  • .pre-commit-config.yaml
  • benchmarks/bench_cake_kda_det_train.py
  • benchmarks/bench_cake_kda_det_train_kcp.py
  • flashinfer/cake_kda_det_train.py
  • flashinfer/cake_kda_det_train_kcp.py
  • flashinfer/experimental/cake_kda_det_train/.gitignore
  • flashinfer/experimental/cake_kda_det_train/README.md
  • flashinfer/experimental/cake_kda_det_train/__init__.py
  • flashinfer/experimental/cake_kda_det_train/build.json
  • flashinfer/experimental/cake_kda_det_train/cake_backend.py
  • flashinfer/experimental/cake_kda_det_train/cake_build.py
  • flashinfer/experimental/cake_kda_det_train/cake_jit.py
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_ffi_checks.h
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_036e1c7e1dfc95a88aae_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_036e1c7e1dfc95a88aae_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_058a68a5b4d89c53be4b_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_058a68a5b4d89c53be4b_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_0e5fa2fe9ae292c3e3aa_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_0e5fa2fe9ae292c3e3aa_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_0e7c693f766175f4406c_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_0e7c693f766175f4406c_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_0fb763e9a81e9066d776_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_0fb763e9a81e9066d776_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_133d787e8f202007cd37_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_133d787e8f202007cd37_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_157990bf8c73b3dbc4fe_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_157990bf8c73b3dbc4fe_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_184d5ccfffea932ff1d8_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_184d5ccfffea932ff1d8_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_1a0df5d531918da7561e_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_1a0df5d531918da7561e_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_1f9c46f98f4290ee26df_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_1f9c46f98f4290ee26df_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_2247b401b29d959d8133_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_2247b401b29d959d8133_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_22812d87c26b53a1ba10_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_22812d87c26b53a1ba10_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_22a2f04d41df18554b84_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_22a2f04d41df18554b84_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_243fb0b23aea1b296ab6_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_243fb0b23aea1b296ab6_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_251cc1717dfc8e3ba24e_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_251cc1717dfc8e3ba24e_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_3712054f19d4180caa28_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_3712054f19d4180caa28_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_3b9b3f9a495f04bc83e4_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_3b9b3f9a495f04bc83e4_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_3f4b037a0a1f8dcc314b_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_3f4b037a0a1f8dcc314b_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_3f7ffe0b7421d90ad674_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_3f7ffe0b7421d90ad674_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_4734a5d4f63d815ec086_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_4734a5d4f63d815ec086_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_47a9c058e6d6c78c166d_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_47a9c058e6d6c78c166d_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_4cce3cc5bc6210c95ce3_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_4cce3cc5bc6210c95ce3_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_54786ffd01bd9b6bb416_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_54786ffd01bd9b6bb416_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_5f5a5b3715675e083823_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_5f5a5b3715675e083823_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_5fcc76904e5e2dd891de_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_5fcc76904e5e2dd891de_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_612492edb453070b0d6a_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_612492edb453070b0d6a_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_706240be56d4e41df1a2_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_706240be56d4e41df1a2_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_74e19f83f8d97e669d46_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_74e19f83f8d97e669d46_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_7eca60b36e233943dae6_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_7eca60b36e233943dae6_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_827dd9ceb9a75ea0330c_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_827dd9ceb9a75ea0330c_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_86df3294f866784ca973_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_86df3294f866784ca973_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_898a1eb972fbaf55789a_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_898a1eb972fbaf55789a_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_8ab0929b8154c90b5eff_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_8ab0929b8154c90b5eff_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_8d99ea1be1c1fef432a5_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_8d99ea1be1c1fef432a5_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_8eb4e9b8a9eae4e077d3_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_8eb4e9b8a9eae4e077d3_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_90153af20fdef34c6cb3_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_90153af20fdef34c6cb3_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_909a0aa57efb3f353972_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_909a0aa57efb3f353972_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_91d59405d9b349c0709c_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_91d59405d9b349c0709c_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_945a87fa84a265fc9f94_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_945a87fa84a265fc9f94_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_94c7d1cc6c908d53e8c1_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_94c7d1cc6c908d53e8c1_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_98e6ba1f97af72fa2e32_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_98e6ba1f97af72fa2e32_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_9931cdff5dfd86c687c7_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_9931cdff5dfd86c687c7_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_9f69ca35a631ae5e1b4c_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_9f69ca35a631ae5e1b4c_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_a557058a8aeca49a6402_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_a557058a8aeca49a6402_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_aa6b5c23c97e1cb9880a_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_aa6b5c23c97e1cb9880a_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_ac974e171d56fc3ce10b_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_ac974e171d56fc3ce10b_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_b2e877c538b6ab7317e9_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_b2e877c538b6ab7317e9_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_b4a1408642c39b6e6ccd_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_b4a1408642c39b6e6ccd_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_c27b09eb5f5881be2969_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_c27b09eb5f5881be2969_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_c9395e21a813579c4bfc_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_c9395e21a813579c4bfc_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_cab3e194b7e9e7557edf_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_cab3e194b7e9e7557edf_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_d32455627b87ba0a1d87_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_d32455627b87ba0a1d87_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_d7656e2b58b9bab49495_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_d7656e2b58b9bab49495_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_de4f911d8beaf8ac8d79_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_de4f911d8beaf8ac8d79_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_dec885b973bd44f88416_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_dec885b973bd44f88416_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_e0b6246cba153e5c917b_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_e0b6246cba153e5c917b_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_e1bf4eadfa51d1646ef7_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_e1bf4eadfa51d1646ef7_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_e244f5d7d0e0569a62c1_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_e244f5d7d0e0569a62c1_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_e60e7ca5d88192193e61_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_e60e7ca5d88192193e61_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_eac26fffb3df8780302c_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_eac26fffb3df8780302c_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_f011cd9add8f3c7c3eee_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_f011cd9add8f3c7c3eee_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_f1777a88a21b832b29ee_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_f1777a88a21b832b29ee_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_f6a70fb0288a508f2828_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_f6a70fb0288a508f2828_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_f92b256cccc2c9007554_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_f92b256cccc2c9007554_kernel.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_fd4c92787fcc18446b14_binding.cu
  • flashinfer/experimental/cake_kda_det_train/csrc/cake_kda_det_train_fd4c92787fcc18446b14_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/.gitignore
  • flashinfer/experimental/cake_kda_det_train_kcp/README.md
  • flashinfer/experimental/cake_kda_det_train_kcp/__init__.py
  • flashinfer/experimental/cake_kda_det_train_kcp/build.json
  • flashinfer/experimental/cake_kda_det_train_kcp/build.test.json
  • flashinfer/experimental/cake_kda_det_train_kcp/cake_build.py
  • flashinfer/experimental/cake_kda_det_train_kcp/cake_kcp.py
  • flashinfer/experimental/cake_kda_det_train_kcp/cake_kcp_jit.py
  • flashinfer/experimental/cake_kda_det_train_kcp/cake_kcp_plan.py
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_ffi_checks.h
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_1214bfc28e50985bfa0c_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_1214bfc28e50985bfa0c_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_1ac972f0cb7cc7b13cf7_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_1ac972f0cb7cc7b13cf7_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_1c66573e87150245374b_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_1c66573e87150245374b_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_32b1aa657b082f2f4cb7_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_32b1aa657b082f2f4cb7_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_3808ea4d567b82ea21a4_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_3808ea4d567b82ea21a4_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_5a20cd12bb62bb6f3ac5_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_5a20cd12bb62bb6f3ac5_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_64ba2583f28f7d4c0102_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_64ba2583f28f7d4c0102_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_6fac4410ba86c48541c4_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_6fac4410ba86c48541c4_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_7658fcc297c6fd906d53_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_7658fcc297c6fd906d53_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_89f5ff59f03eb170e3bf_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_89f5ff59f03eb170e3bf_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_9a3f306bacf8c8a1547d_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_9a3f306bacf8c8a1547d_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_9cfe05bce78410f1304b_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_9cfe05bce78410f1304b_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_afe02fb600500ba3556f_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_afe02fb600500ba3556f_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_b1477ed31fad32a5c2c9_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_b1477ed31fad32a5c2c9_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_b1a95a8ee8110e47558e_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_b1a95a8ee8110e47558e_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_c6958a0a4ed5cb55a9a1_kcp_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_c6958a0a4ed5cb55a9a1_kcp_kernel.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_f227dd21f1f3cb464b29_binding.cu
  • flashinfer/experimental/cake_kda_det_train_kcp/csrc/cake_kda_det_train_f227dd21f1f3cb464b29_kernel.cu
  • flashinfer/experimental/cake_kda_train/__init__.py
  • flashinfer/experimental/cake_kda_train/build.json
  • flashinfer/experimental/cake_kda_train/build.test.json
  • flashinfer/experimental/cake_kda_train/cake_backend.py
  • flashinfer/experimental/cake_kda_train/cake_build.py
  • flashinfer/experimental/cake_kda_train/cake_jit.py
  • flashinfer/experimental/cake_kda_train/cake_kcp.py
  • flashinfer/experimental/cake_kda_train/cake_kcp_jit.py
  • flashinfer/experimental/cake_kda_train/cake_kcp_plan.py
  • flashinfer/experimental/cake_kda_train/csrc/cake_kda_train_b1a95a8ee8110e47558e_kernel.cu
  • flashinfer/kda_train.py
  • pyproject.toml
  • scripts/check_cake_build_manifests.py
  • tests/experimental/test_cake_gqa_train.py
  • tests/experimental/test_cake_kda_det_train.py
  • tests/experimental/test_cake_kda_det_train_api.py
  • tests/experimental/test_cake_kda_det_train_kcp.py
  • tests/experimental/test_cake_kda_det_train_kcp_api.py
  • tests/experimental/test_cake_kda_det_train_kcp_build.py
  • tests/experimental/test_cake_kda_det_train_kcp_dist.py
  • tests/experimental/test_cake_kda_det_train_kcp_fsdp_walk.py
  • tests/experimental/test_cake_kda_det_train_kcp_shared_ws.py
  • tests/experimental/test_cake_kda_det_train_kcp_upload.py
  • tests/experimental/test_cake_kda_det_train_names.py
  • tests/test_cake_causal_conv1d_train_kcp_dist.py
  • tests/test_helpers/cake_kcp_fake_backend.py
  • tests/test_helpers/cake_kda_det_train_reference.py
  • tests/test_helpers/cake_kda_train_kcp_saved.py
  • tests/test_helpers/cake_kda_train_reference.py
  • tests/test_helpers/cake_package.py

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

Walkthrough

The pull request introduces deterministic single-rank and context-parallel KDA training APIs. It relocates Cake build metadata and generated kernels into deterministic package paths, keeps compatibility aliases for previous API names, and updates benchmarks, packaging, and tests.

Changes: Deterministic KDA training

Layer / File(s) Summary
Public APIs and single-rank package setup
flashinfer/cake_kda_det_train.py, flashinfer/cake_kda_det_train_kcp.py, flashinfer/experimental/cake_kda_det_train/*, benchmarks/bench_cake_kda_det_train*.py
Adds public wrappers for deterministic forward, backward, autograd, workspace, arena, partition, context, and byte-query operations. The single-rank package exports backend metadata and manifest-based library loading. Benchmarks and documentation use the renamed APIs.
Single-rank generated kernels
flashinfer/experimental/cake_kda_det_train/csrc/*
Renames generated kernel and binding symbols to the deterministic-training names. Some kernels also update state transfers, barrier-stage indexing, or generated temporary-variable blocks.
KCP package, build, and generated kernels
flashinfer/experimental/cake_kda_det_train_kcp/*
Adds the deterministic KCP package, build manifests, loader, lazy exports, and host-side tensor checks. Generated bindings use deterministic KCP symbols, and TMA validation reports per-axis extent errors.
Compatibility, packaging, and validation
flashinfer/experimental/cake_kda_train/*, flashinfer/kda_train.py, pyproject.toml, scripts/check_cake_build_manifests.py, tests/*
Routes previous module paths and names to deterministic implementations. Updates package data, manifest checks, benchmarks, test helpers, and API, build, and KCP tests.

Estimated code review effort: 5 (Critical) | ~90 minutes

Change: Refactor

Merge Risk: Minimal · up to 024ad

This change renames the Cake KDA training packages and keeps the previous names as aliases. No concrete defect remains in the reviewed changes, so it is ready to merge once the requested CI test runs pass.

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 supplies a clear summary of the change: the deterministic renames for the single-rank and context-parallel (KCP) KDA training variants, the new package and module paths, the retained l… Complete the following before review: (1) Add the related issue or PR links in the Related Issues section, including the superseded #8082 and the tracking issue for PR #8054 if one exists. (2) Check the pre-commit items or state that they w…
Docstring Coverage Inconclusive Docstring coverage is 30.43% 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. Documenta… 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 clearly identifies the main change: renaming single-rank and context-parallel KDA training APIs to deterministic names.
Full details: Description check

Explanation

The description supplies a clear summary of the change: the deterministic renames for the single-rank and context-parallel (KCP) KDA training variants, the new package and module paths, the retained legacy aliases, the kernel library renames, and benchmark tables for speed. It also includes a Coverage statement naming the supported architectures (sm_100a, sm_103a, sm_107a). Parts of the template are not filled in: the Related Issues section has no link (it refers to #8082 as superseded but gives no issue number), the pre-commit and test checklist items are unchecked, there is no statement of test results or CI targets, the reason for full-scope CI is absent, and the experimental-track section is left as template text. The experimental-tests fence still contains only the template comments, even though the PR touches code under flashinfer/experimental/, which the template requires to be filled in. The PR objectives also list a tracking issue, owner, and graduation plan as required for experimental PRs, and the description does not mention them.

Resolution

Complete the following before review: (1) Add the related issue or PR links in the Related Issues section, including the superseded #8082 and the tracking issue for PR #8054 if one exists. (2) Check the pre-commit items or state that they were run, and state the test results. (3) Mark whether this PR requires full-scope CI; if so, give the reason; otherwise list suggested test targets. (4) Because the PR changes code under flashinfer/experimental/, complete the Experimental Track section: confirm the checklist items (tracking issue with owner, reason, graduation plan; thin core entry point; nothing registered in flashinfer/aot.py; no auto-backend reachability without the environment variable). (5) Replace the commented placeholder in the experimental-tests fence with the real test targets under tests/experimental/ and keep the fence tag unchanged. (6) Optionally add reviewer notes on the regenerated kernel sources, since the summary shows several regenerated files with changed code bodies, not only renames.

Full details: Docstring Coverage

Explanation

Docstring coverage is 30.43% 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 69 functions across 47 files. (150 skipped: 8 unsupported, 3 too large, 139 over the file limit.)

Resolution

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

Finishing Touches
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

@yyihuang

Copy link
Copy Markdown
Collaborator Author

@flashinfer-bot run tests/experimental/test_cake_kda_det_train.py tests/experimental/test_cake_kda_det_train_api.py tests/experimental/test_cake_kda_det_train_kcp.py tests/experimental/test_cake_kda_det_train_kcp_api.py tests/experimental/test_cake_kda_det_train_kcp_build.py tests/experimental/test_cake_kda_det_train_kcp_dist.py tests/experimental/test_cake_kda_det_train_kcp_fsdp_walk.py tests/experimental/test_cake_kda_det_train_kcp_shared_ws.py tests/experimental/test_cake_kda_det_train_kcp_upload.py tests/experimental/test_cake_kda_det_train_names.py tests/experimental/test_cake_gqa_train.py

averyhNV and others added 11 commits October 30, 2026 19:44
flashinfer/experimental/cake_kda_train moves unchanged to
flashinfer/experimental/cake_kda_det_train: the host plan, the registries,
the loader, the KCP modules, build.json, build.test.json and the 165
generated sources.  The packed KDA chunked training path is deterministic
(the same inputs, hardware and plan give bitwise the same outputs and
gradients), so the package carries the det name.

The next commits add the compatibility package at the previous path, the
det entry points and the sources regenerated under the det library names.

Co-Authored-By: Claude <noreply@anthropic.com>
flashinfer.experimental.cake_kda_train is now a compatibility package.  Its
names are the det package's objects: its __all__ is the list it exported
before the move, so a star import binds the same names as before, and any
other attribute resolves on the det package at first access.  Its submodules
cake_backend, cake_build, cake_jit, cake_kcp, cake_kcp_jit and cake_kcp_plan
are the det package's module objects, so the registries, the workspace
caches and the loaded libraries exist once.  The compatibility package holds
no sources and no manifest, and importing it does not import the KCP host
module.

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

The single-rank entry points move to flashinfer.cake_kda_det_train:
chunk_kda_det_fwd, chunk_kda_det_bwd, chunk_kda_det, kda_det_train_arena,
kda_det_train_workspace, kda_det_train_workspace_bytes,
kda_det_train_saved_bytes, is_kda_det_train_supported and DEFAULT_SCALE.
The backend names are ChunkKDADetFunction, KdaDetArena, KdaDetChunkSaved,
KdaDetWorkspace, chunk_kda_det_fwd, chunk_kda_det_bwd and chunk_kda_det.

flashinfer.kda_train keeps the context-parallel entry points unchanged and
binds the previous single-rank names to the same objects.  cake_backend and
the package __init__ bind the previous backend names to the same objects
(not in __all__), so the KCP modules and existing callers keep working and
isinstance holds across the two spellings.  The doc_lengths error names the
det package.  The package README describes the det names.

The host plan of cake_jit.py names the 65 single-rank programs by their det
libraries, cake_kda_det_train_<digest> (the same digests): the export reads
these names and refuses a record whose library is not the det program name,
so the next commit regenerates the programs under them.

Co-Authored-By: Claude <noreply@anthropic.com>
…he det library names

cake_jit.py, build.json and csrc/ come from a fresh export of the package,
written into the moved directory.  The 65 single-rank programs keep their
digests and become the libraries cake_kda_det_train_<digest>: their kernel
and binding sources, kernel symbols, FFI symbols, build.json entries and
aot/ paths carry the det name.  The 17 KCP libraries, their sources and
their 33 build.json entries, build.test.json and cake_kcp_jit.py are
unchanged.  build.json names the package
flashinfer.experimental.cake_kda_det_train.

The export also writes 20 kernel sources whose local variable numbering
differs from the previous export (for example j_2 -> j_0); their programs,
digests and launch records are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
build.test.json carries the package of the build.json beside it, which
cake_kcp_jit checks before it serves a test-only library.  Its package
field becomes flashinfer.experimental.cake_kda_det_train, the value the
KCP export writes for the moved directory; its 18 entries are unchanged.

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

tests/experimental/test_cake_kda_det_train.py (the backend suite, through
the cake_kda_det_train key of tests/test_helpers/cake_package) checks the
cake_kda_det_train_<digest> libraries and the det package of build.json.
tests/experimental/test_cake_kda_det_train_api.py covers the det entry
points of flashinfer.cake_kda_det_train (its forwarding checks patch the
det backend names) and the KCP entry points of flashinfer.kda_train.
The reference helper is tests/test_helpers/cake_kda_det_train_reference.py,
with its previous path as a compatibility import, and the benchmark is
benchmarks/bench_cake_kda_det_train.py.

tests/experimental/test_cake_kda_det_train_names.py checks that every
previous name (facade, backend, package, compatibility package and its
submodules, test helpers) is the det object, that the det __all__ lists
only the det names, that the compatibility package's __all__ and star
import keep the list before the move, that the manifests name the det package and the 65
single-rank libraries, and that no facade or package import loads the KCP
host module.

The GQA suite reads the shared loader from the det package directory, and
the KCP build suite expects the det package in both manifests.

Co-Authored-By: Claude <noreply@anthropic.com>
pyproject.toml ships csrc/ and build.json of
flashinfer.experimental.cake_kda_det_train, the build manifest check reads
that package, the pre-commit exclusion keeps the bytes of its generated
csrc/ tree, and the labeler matches the det package directories next to
the previous one.

Co-Authored-By: Claude <noreply@anthropic.com>
…det_kcp paths

Pure moves: cake_kcp.py, cake_kcp_jit.py, cake_kcp_plan.py and the
test-only manifest build.test.json go to the new package
flashinfer/experimental/cake_kda_det_train_kcp; the KCP test files and
the KCP benchmark take the cake_kda_det_train_kcp names.  The next
commits rename the contents and keep the previous import paths.

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

The context-parallel (KCP) KDA training route takes deterministic names.
flashinfer/cake_kda_det_train_kcp.py is the canonical entry module:
partition_det_kcp, build_context_det_kcp, chunk_kda_det_kcp,
chunk_kda_det_fwd_kcp, chunk_kda_det_bwd_kcp, kda_det_workspace_bytes_kcp,
kda_det_saved_bytes_kcp and kda_det_comm_bytes_kcp, with the types
ContextDetKcp, PartitionDetKcp, OptionsDetKcp, RecomputeHandleDetKcp,
SavedDetKcp and WorkspaceDetKcp resolved on first access.  The backend
modules of flashinfer.experimental.cake_kda_det_train_kcp define the
renamed objects (also CallDetKcp, FragmentDetKcp, ChunkKDADetFunctionKcp);
their __qualname__ and error prefixes carry the new names.

The previous names stay bound to the same objects: in
flashinfer.kda_train, in cake_kcp / cake_kcp_plan (outside __all__), and
at the previous module paths flashinfer.experimental.cake_kda_train.cake_kcp,
cake_kcp_jit and cake_kcp_plan.  The KCP section of the single-rank README
moves to the new package's README; the single-rank manifest test no longer
counts the KCP programs, which the next commit moves to the new package.
The KCP tests and benchmark import the new paths; the KCP api cases move to
test_cake_kda_det_train_kcp_api.py with alias-identity tests.

Co-Authored-By: Claude <noreply@anthropic.com>
The eleven shipped context-parallel programs keep the code they ship
with; only their names change.  Their CUDA sources (file names, kernel
symbols, binding namespaces) are written to cake_kda_det_train_kcp/csrc
and their build.json entries (names, paths, sources, digests) to the
package's build.json, under the cake_kda_det_train_<digest>[_kcp]
names; the registry cake_kcp_jit.py uses the same names.  All other
bytes are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
… the single-rank package

The six test-only context-parallel programs (built only by the tests,
build.test.json) are regenerated under the det_kcp names in the det_kcp
package; their kernel SASS is unchanged on sm_100a, sm_103a and sm_107a.
The single-rank package no longer carries the context-parallel programs:
their units, their build.json entries and its build.test.json are
removed.  The single-rank programs' units and entries are unchanged; the
build.json generator record names the revision of this render.

Co-Authored-By: Claude <noreply@anthropic.com>
@yyihuang
yyihuang disabled auto-merge October 31, 2026 04:06
@yyihuang
yyihuang enabled auto-merge (squash) October 31, 2026 04:06
@yyihuang
yyihuang disabled auto-merge October 31, 2026 04:08
Signed-off-by: Yingyi Huang <yingyihuang2000@outlook.com>
@yyihuang

Copy link
Copy Markdown
Collaborator Author

@flashinfer-bot run tests/experimental/test_cake_gqa_train.py tests/experimental/test_cake_kda_det_train.py tests/experimental/test_cake_kda_det_train_api.py tests/experimental/test_cake_kda_det_train_kcp.py tests/experimental/test_cake_kda_det_train_kcp_api.py tests/experimental/test_cake_kda_det_train_kcp_build.py tests/experimental/test_cake_kda_det_train_kcp_dist.py tests/experimental/test_cake_kda_det_train_kcp_fsdp_walk.py tests/experimental/test_cake_kda_det_train_kcp_shared_ws.py tests/experimental/test_cake_kda_det_train_kcp_upload.py tests/experimental/test_cake_kda_det_train_names.py tests/test_cake_causal_conv1d_train_kcp_dist.py

@yyihuang
yyihuang enabled auto-merge (squash) October 31, 2026 04:34
@yyihuang

Copy link
Copy Markdown
Collaborator Author

@flashinfer-bot run tests/experimental/test_cake_gqa_train.py tests/experimental/test_cake_kda_det_train.py tests/experimental/test_cake_kda_det_train_api.py tests/experimental/test_cake_kda_det_train_kcp.py tests/experimental/test_cake_kda_det_train_kcp_api.py tests/experimental/test_cake_kda_det_train_kcp_build.py tests/experimental/test_cake_kda_det_train_kcp_dist.py tests/experimental/test_cake_kda_det_train_kcp_fsdp_walk.py tests/experimental/test_cake_kda_det_train_kcp_shared_ws.py tests/experimental/test_cake_kda_det_train_kcp_upload.py tests/experimental/test_cake_kda_det_train_names.py tests/test_cake_causal_conv1d_train_kcp_dist.py

yyihuang added a commit to yyihuang/flashinfer that referenced this pull request Oct 31, 2026
yyihuang added a commit to yyihuang/flashinfer that referenced this pull request Oct 31, 2026
yyihuang added a commit to yyihuang/flashinfer that referenced this pull request Oct 31, 2026
@yyihuang
yyihuang disabled auto-merge October 31, 2026 05:34
@yyihuang
yyihuang enabled auto-merge (squash) October 31, 2026 05:34
@yyihuang
yyihuang disabled auto-merge October 31, 2026 05:41
@yyihuang
yyihuang enabled auto-merge (squash) October 31, 2026 05:46
@yyihuang
yyihuang merged commit cf6af47 into flashinfer-ai:main Oct 31, 2026
24 checks passed
yyihuang pushed a commit to yyihuang/flashinfer that referenced this pull request Oct 31, 2026
Co-Authored-By: Claude <noreply@anthropic.com>
yyihuang added a commit that referenced this pull request Oct 31, 2026
… backend (#8059)

The chunked LM-head + loss backend is deterministic: for fixed inputs,
hardware, chunk plan and initial accumulation buffers, its forward and
backward give bitwise-identical results run to run. This PR gives it
`det` names:

- the package `flashinfer.experimental.cake_lm_head_loss` becomes
`flashinfer.experimental.cake_lm_head_det_loss`; its generated sources,
kernels and libraries are named `cake_lm_head_det_loss_*`;
- the public entries become
`chunked_lm_head_det_{loss,logprob,preload,support_logprob,support_kl}`,
and the backend's functions and classes get the same `det` names.

Compatibility: every previous name stays as an alias of the same object,
including `load_cake_lm_head_loss_module` in `cake_jit`, `cake_backend`
and `cake_backend_opt_in`. The previous package path stays as a shim
package whose modules are the `det` package's modules. The
`FLASHINFER_CAKE_LM_HEAD_LOSS_*` environment variables keep their names.

Performance is unchanged: the generated programs differ from main only
in their names, and their SASS is identical to main's on sm_100a and
sm_103a.

The backend has one data type (BF16) and covers the CE and policy
losses, the log-probability entry and the support-set log-probability
and KL entries; it ships on sm_100a and sm_103a.

Merge after #8054, which carries the pre-commit exclusions for both
package paths, and after the companion internal export change; a final
build.json-only commit will record the published generator revision
before merge.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Added deterministic, chunked language-model head loss and
log-probability operations, along with candidate-restricted
log-probabilities and KL calculations.
* Added fast and memory-budgeted backend options, including valid-row
controls and workspace reporting.
* **Compatibility**
* Preserved legacy API and package paths as aliases to the deterministic
entry points.
* **Documentation**
* Clarified determinism guarantees and updated guidance for the APIs,
naming conventions, and tuning options.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Yingyi Huang <averyh@nvidia.com>
Co-authored-by: Claude <noreply@anthropic.com>
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