Skip to content

perf(cake_dense_projection_det_gemm): run the half-tail TMA-store program on the sm_103a 5120 x 17408 weight gradients at T 16231 / 16384 - #8522

Merged
yyihuang merged 1 commit into
flashinfer-ai:mainfrom
yyihuang:dpg-det-r17-gb300-wgrad
Nov 3, 2026
Merged

yyihuang merged 1 commit into
flashinfer-ai:mainfrom
yyihuang:dpg-det-r17-gb300-wgrad

Conversation

@yyihuang

@yyihuang yyihuang commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

This PR adds and updates row rules in the Cake dense_projection_det_gemm package in flashinfer.experimental, the deterministic dense projection GEMM. The package has 127 programs built from 124 templates, and this PR leaves both counts unchanged. Most programs are BF16-operand GEMMs (forward, dgrad and wgrad), and one is an FP32 router GEMM. The PR changes 3 row rules, all for sm_103a, and each applies at a single token count T. It adds one rule for the 5120→17408 weight gradient at T 16231. The other two are the empty sm_103a keys for the 17408→5120 weight gradient at T 16231 and 16384. The previous PR added those keys to keep that row's plan unchanged, and this PR gives them a real rule. All three rules route BF16-output weight-gradient rows to a program that already ships: the half-tail program with a TMA-store epilogue and 12-row raster groups. No program or template is added or removed, the rule count goes from 366 to 367, and sm_100a and sm_107a are unchanged.

The baseline is the previous Cake version of the package on main. Against it, the changed rows have a speedup of 1.013 on GB300 for all three rows and 1.042–1.045 on B300. No changed row is slower on either GPU, and outputs on those rows are bitwise identical to main. All other rows of the 294-row shape list plan the same programs as main.

Speedup of this PR over the previous Cake version on main. GB300 (sm_103a, 152 SMs), B300 (sm_103a, 148 SMs); CUDA 13.4, cold L2, BF16 output. Speedup = previous time / this PR time, and values above 1 mean this PR is faster.

shape (K→N) op out T GB300 previous µs GB300 this PR µs GB300 speedup B300 previous µs B300 this PR µs B300 speedup
17408→5120 wgrad bf16 16231 1408.1 1390.2 1.013 1612.8 1543.2 1.045
17408→5120 wgrad bf16 16384 1420.7 1402.2 1.013 1625.6 1555.9 1.045
5120→17408 wgrad bf16 16231 1427.5 1408.9 1.013 1620.3 1554.2 1.042

The package also ships FP32-output forms, weight-gradient (wgrad) programs and the FP32 router GEMM (run through BF16x3 emulation), on sm_100a, sm_103a and sm_107a.

Summary by CodeRabbit

  • Performance Improvements
    • Expanded exact-shape handling for dense projection weight-gradient operations on supported hardware, including additional input sizes and token counts.
  • Documentation
    • Updated the documented rule count and coverage for round 2.

…gram on the sm_103a 5120 x 17408 weight gradients at T 16231 / 16384

Re-measured on GB300 with a cooled timing frame, the half-tail program
through the one-slot TMA store with 12-row raster groups (_ht_tma1) is
faster than the row's plan without a key on three sm_103a weight-gradient
cells that round 2 left out:

- the 17408 -> 5120 weight gradient at T 16231 / 16384: its two empty
  sm_103a keys now carry the sm_100a key's rule (restated, so an
  sm_103a rule keeps winning over the parent lookup);
- the 5120 -> 17408 weight gradient at T 16231: a new T-exact key next to
  the existing T 16384 key.

Each key keeps the per-tile K partitions of the row's plan without it, so
every output is bitwise equal to that plan's; every other T, sm_100a and
sm_107a are unchanged. No program text changes. Tests: the sm_103a rule
count, and the T-exact weight-gradient planner and device tests now cover
the three sm_103a rows (program, direct orientation, whole-K plan, FP64
reference, bitwise equality with the plan without the key).
@yyihuang

yyihuang commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

@flashinfer-bot run tests/experimental/test_cake_dense_projection_det_gemm.py tests/experimental/test_cake_dense_projection_det_gemm_names.py tests/experimental/test_cake_dense_projection_gemm.py

@yyihuang
yyihuang requested a review from Jingfan-Sun as a code owner November 3, 2026 16:07
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The planner adds active exact-token weight-gradient rules for additional sm_103a shape and token-count combinations. Tests and documentation update their expected rule coverage.

Changes: Exact-token weight-gradient rules

Layer / File(s) Summary
Add active sm_103a rules
flashinfer/experimental/dense_projection_det_gemm/cake_backend.py
The sm_103a rules add the 17408→5120 orientation at T=16231 and T=16384, and add T=16231 for 5120→17408. The 17408→5120 entries select the 256-row, half-height-tail, one-slot TMA-store program with 12-row raster groups.
Update rule tests and documentation
tests/experimental/test_cake_dense_projection_det_gemm.py, flashinfer/experimental/dense_projection_det_gemm/README.md
Tests update the rule counts and require active templates for every listed key. The README updates the round-2 rule count and coverage description.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related issues

Possibly related PRs

Suggested labels: run-ci

Suggested reviewers: yzh119

Merge Risk: Minimal · up to 19be3

No concrete merge-blocking issue is established for the added sm_103a rules. Merge readiness remains subject to normal test completion; the supplied CI excerpts do not establish a code failure.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description gives detailed scope, rule changes, performance results, correctness results, and test context. However, it does not follow the repository template and omits the required experimental-… Update the description to use the repository template. Add the related tracking issue, experimental owner and graduation plan, completed checklist items, and an experimental-tests fence containing the intended targets under tests/experiment…
Docstring Coverage Warning Docstring coverage is 50.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. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the performance change, backend, operation, hardware target, and token counts. It is specific and related to the main changeset, although it is longer than ideal.
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.
Full details: Description check

Explanation

The description gives detailed scope, rule changes, performance results, correctness results, and test context. However, it does not follow the repository template and omits the required experimental-track details, including the tracking issue, owner, graduation plan, checklist status, and experimental test targets.

Resolution

Update the description to use the repository template. Add the related tracking issue, experimental owner and graduation plan, completed checklist items, and an experimental-tests fence containing the intended targets under tests/experimental/. State the pre-commit and test results explicitly.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.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 2 functions across 2 files. (1 skipped: 1 unsupported.)

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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
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: 954b83b6-4fb0-49b4-a8f1-44595813ddfd
Commits

Reviewing files that changed from the base of the PR and between 5b2180c and 19be398.

Files selected for processing: 3
  • flashinfer/experimental/dense_projection_det_gemm/README.md
  • flashinfer/experimental/dense_projection_det_gemm/cake_backend.py
  • tests/experimental/test_cake_dense_projection_det_gemm.py

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

@yzh119 yzh119 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yyihuang
yyihuang merged commit bd0c0d3 into flashinfer-ai:main Nov 3, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants