Skip to content

docs: fix API indexes and RMSNorm RST rendering - #8464

Merged
aleozlx merged 12 commits into
flashinfer-ai:mainfrom
kangbintNV:codex/fix-doc-check-20261102
Nov 5, 2026
Merged

aleozlx merged 12 commits into
flashinfer-ai:mainfrom
kangbintNV:codex/fix-doc-check-20261102

Conversation

@kangbintNV

@kangbintNV kangbintNV commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

📌 Description

Add missing autosummary entries for ten legacy deterministic mHC training aliases and nineteen internal low-precision Ulysses primitives. Add the five constructor parameter descriptions to NVFP4KVMaterializer.__init__, using the existing class documentation. These cover the 30 actionable findings in the 2026-11-05 documentation report (internal network).

Render the RMSNorm gradient bound as an RST inline literal so |dx| no longer generates an undefined substitution and problematic HTML links. Retain the minimal weight-dtype and prepared LoRA grammar fixes.

The single-head MQA documentation is left to #8374. The report's two path findings are checker false positives: refs/heads/main is a Git ref, and flashinfer/experimental/KERNEL_SOURCES_EXCLUDED.txt is generated inside release wheels. STALE warnings remain untouched.

Complete the Ulysses section title underline and three KDA section title underlines so they match their title lengths.

🚀 Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.

✅ Pre-commit Checks

  • I have installed pre-commit by running pip install pre-commit (or used your preferred method).
  • I have installed the hooks with pre-commit install.
  • I have run the hooks manually with pre-commit run --all-files and fixed any reported issues.

If you are unsure about how to set up pre-commit, see the pre-commit documentation.

🧪 Tests

  • Tests have been added or updated as needed.
  • All tests are passing (unittest, etc.).
  • This PR requires full-scope CI, not targeted tests (expensive; justify below).
    Reason:

Validation:

  • Targeted pre-commit (including mypy/Ruff) and git diff --check passed for the constructor documentation change.

  • All 29 reported MISSING entries are indexed. The constructor passes the nightly checker's docstring-completeness and five-argument consistency checks.

  • python3 scripts/check_pr_document.py --base origin/main --head HEAD --strict passed on 6aef2fb22: 0 new static documentation findings.

  • RMSNorm: Docutils rendering previously reproduced the undefined substitution and problematic link at all six source occurrences; all six rendered correctly after the fix.

  • No runtime behavior changed; GPU tests were not run. Full Sphinx build is left to Build Docs CI.

  • KDA: Docutils confirms the three short-underline warnings are gone; targeted pre-commit passed.

  • Across all seven changed Python files, execution AST is unchanged after excluding docstrings and the three documentation-only Notes strings; the remaining edits are RST.

🔬 Experimental Track

  • This PR is experimental: it adds or changes code under flashinfer/experimental/ and/or an @flashinfer_experimental_api. Tracking issue: #
    • The tracking issue names an owner, the reason for the experimental path, and a graduation plan with a target release.
    • Core changes are limited to a thin entry point (signature, shared validation, feature-gate check, backend selection, handoff).
    • Tests live in tests/experimental/ and were validated on the intended hardware; a runnable example is included.
    • Nothing is registered in flashinfer/aot.py, and no experimental backend is reachable from backend="auto" without FLASHINFER_ALLOW_EXPERIMENTAL_AUTO_BACKENDS=1. (Calling an @flashinfer_experimental_api or naming a backend explicitly is itself the opt-in and needs no environment variable.)
    • Test scope declared below. The experimental CI lane runs exactly these targets, so keep them as narrow as the change allows.
# One target per line: a directory or a file. (A pytest ::selector is not
# supported -- the sharding runner cannot consume one.) Must be under
# tests/experimental/ and must exist. Delete these comment lines and add yours, e.g.
#
#   tests/experimental/test_my_backend.py
#   tests/experimental/my_backend/
#
# Declaring the whole tree (tests/experimental/) is allowed but means every
# experimental PR pays for every other feature's tests, in every matrix cell.

Reviewer Notes

The mHC entries document compatibility aliases of flashinfer.cake_mhc_det_train, not the experimental selectable-mode implementation. The nineteen Ulysses helpers are decorated for API logging/tracing but live in an internal module and are not exported from flashinfer.comm. The index documents their existing role in numerical tests and kernel tooling. Existing prose, API decorators, and STALE entries are preserved.

Summary by CodeRabbit

  • Documentation
    • Added API guidance for single-head paged MQA scores and mHC training operations.
    • Clarified that low-precision Ulysses communication helpers are internal and directed application developers to the supported QKV API.
    • Improved RMSNorm training guidance and clarified weight-dtype descriptions.
    • Clarified NVFP4 LoRA adapter folding behavior and its numerical equivalence to SVDQuant.
    • Updated wording about changes to adapter source tensors.

AI-assisted documentation fix for the 2026-11-02 documentation check report.
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

API reference sections and autosummary entries were added. Documentation and docstrings also received formatting and wording updates. No runtime behavior or public declarations changed.

Changes: API documentation and wording updates

Layer / File(s) Summary
Add API reference sections
docs/api/attn_scores.rst, docs/api/mhc.rst, docs/api/comm.rst
Adds documentation for single_head_paged_mqa_logits, legacy flashinfer.cake_mhc_train operations, and internal low-precision Ulysses helpers. The Ulysses documentation directs applications to the prepared UlyssesCommunicator QKV API.
Format the RMSNorm error-bound expression
docs/api/norm.rst, flashinfer/cake_rmsnorm_train.py, flashinfer/cake_rmsnorm_train_backend/__init__.py, flashinfer/cake_rmsnorm_train_backend/cake_windows.py
Formats `max(
Revise API and docstring wording
docs/api/gemm.rst, flashinfer/cake_rmsnorm_det_train_backend/cake_jit.py, flashinfer/cake_rmsnorm_train_backend/cake_jit.py, flashinfer/gemm/cake_quant_lora_gemm.py
Revises the NVFP4 LoRA adapter description, the descriptions of supported weight dtypes, and the stale-source wording for StaleAdapterError.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Merge Risk: Minimal · up to 95d05

No merge-blocking issue is established in these documentation changes. Merge readiness remains subject to normal documentation and CI checks.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly and concisely identifies the two main changes: API index fixes and RMSNorm RST rendering fixes.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Description check Passed The description is mostly complete. It explains the changes, scope, validation results, test status, runtime impact, related PR context, and reviewer notes. The explicit Related Issues section is miss…
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. 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 3 functions across 6 files. (1 skipped: 1 unsupported.)

Full details: Description check

Explanation

The description is mostly complete. It explains the changes, scope, validation results, test status, runtime impact, related PR context, and reviewer notes. The explicit Related Issues section is missing, and the full pre-commit checklist item remains unchecked, but these are non-critical gaps.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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

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: 95793f63-e2ce-4d8a-b1f1-ac25570d563d
Commits

Reviewing files that changed from the base of the PR and between 45c9325 and 95d0506.

Files selected for processing: 3

  • docs/api/mhc.rst
  • flashinfer/cake_rmsnorm_det_train_backend/cake_jit.py
  • flashinfer/cake_rmsnorm_train_backend/cake_jit.py
Files skipped from review as they are similar to previous changes: 3

  • flashinfer/cake_rmsnorm_train_backend/cake_jit.py
  • docs/api/mhc.rst
  • flashinfer/cake_rmsnorm_det_train_backend/cake_jit.py

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

@netanel-haber

Copy link
Copy Markdown
Contributor

This should be closed - #8374 supercedes it.

AI-assisted documentation fix for the 2026-11-03 document check report. Preserve the prepared communicator API as the public interface.
@kangbintNV kangbintNV changed the title docs: index single-head MQA and legacy mHC training APIs docs: complete MQA, mHC training, and Ulysses primitive indexes Nov 3, 2026
Prevent |dx| from becoming an undefined substitution and problematic HTML link in the RMSNorm guide and shared module/function documentation. AI-assisted fix.
@kangbintNV kangbintNV changed the title docs: complete MQA, mHC training, and Ulysses primitive indexes docs: fix API indexes and RMSNorm RST rendering Nov 3, 2026
@flashinfer-bot flashinfer-bot added the op: misc norm, activation, sampling, RoPE, quantization, etc. label Nov 3, 2026
Fix the reported wording without changing API behavior or RST references. AI-assisted documentation edit.
@kangbintNV

Copy link
Copy Markdown
Collaborator Author

This should be closed - #8374 supercedes it.

@netanel-haber Thanks for pointing this out. I've removed the single-head MQA documentation addition. The remaining changes cover the mHC and Ulysses documentation gaps, the RMSNorm RST rendering issue, and minor grammar fixes, none of which are covered by #8374. I'd like to keep this PR open for those fixes.

@kangbintNV

Copy link
Copy Markdown
Collaborator Author

/bot run

@flashinfer-bot

Copy link
Copy Markdown
Collaborator

⚠️ Warning: this is a full-suite run (an unknown number of GPU-hours). It still runs. Full runs are fine for suite-wide changes such as autotuning or quantization; for anything narrower, a scoped run finishes in a fraction of the time and frees the queue for everyone.

  • tests/attention/test_block_sparse_cutile.py alone is ~64 GPU-h: solo whole-node file; hit the unit timeout 82 times in the sample (tracked in #6110). Exclude it by naming the other files you need.
  • tests/gemm/test_groupwise_scaled_gemm_fp8.py alone is ~35 GPU-h: solo whole-node file (tracked in #6110). Exclude it by naming the other files you need.

Naming the test files that exercise your change is the cheapest option.

Scoped PR runs also get an H100 lane that full runs do not. Paths can be directories or single files under tests/, up to 16 of them. See CONTRIBUTING: Internal CI.

Cost data from 2026-10-09.


GitLab MR !2661 has been created, and the CI pipeline #79201273 is currently running. I'll report back once the pipeline job completes.

@kahyunnam kahyunnam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving pending CI: the mHC and Ulysses index additions, the |dx| literal fix and the wording edits are text-only and match the code they document, and dropping the single-head section settles the overlap with #8374.
The internal CI run on this head needs to finish before merge; one small ask is inline.

Comment thread docs/api/comm.rst Resolved
@flashinfer-bot

Copy link
Copy Markdown
Collaborator

[FAILED] Pipeline #79201273 — 10/38 executed test jobs passed

Compared with nightly #78850725 (different CI configuration).

Unit Tests

GPU CUDA 12.9 CUDA 13.0 CUDA 13.4 Notes
B200 ❔ Unknown ❔ Unknown ❔ Unknown New: tests.utils.test_fp4_dispatch (27 failures; CUDA 12.9, CUDA 13.0, CUDA 13.4)
New: tests.attention.test_cake_fused_qk_rope_append_pdl (1 failure; CUDA 12.9)
Old: tests.cpu.mamba.test_cake_ssd_combined_rubin_twins (14 failures; CUDA 12.9, CUDA 13.0)
… and 9 more
GB200 ❔ Unknown ❔ Unknown ❔ Unknown New: tests.utils.test_fp4_dispatch (27 failures; CUDA 12.9, CUDA 13.0, CUDA 13.4)
New: tests.attention.test_cake_fused_qk_rope_append_pdl (2 failures; CUDA 13.0)
Old: tests.cpu.mamba.test_cake_ssd_combined_rubin_twins (14 failures; CUDA 12.9, CUDA 13.0)
… and 7 more
GB300 ❔ Unknown ❔ Unknown ❔ Unknown New: tests.utils.test_fp4_dispatch (27 failures; CUDA 12.9, CUDA 13.0, CUDA 13.4)
Old: tests.cpu.mamba.test_cake_ssd_combined_rubin_twins (14 failures; CUDA 12.9, CUDA 13.0)
Old: tests.moe_ep.test_sm107_block_scaled_contracts (12 failures; CUDA 12.9, CUDA 13.0, CUDA 13.4)
… and 9 more
VR NVL72 — — ⚠️ Infra Timeout: job timed out before producing test results (2 jobs; CUDA 13.4)

✅ Pass · 🟡 Old failure · ❌ New failure · ⏱ Test timeout · ⚠️ Infrastructure · ❔ Unknown or unclassified · — Not run

Multi-GPU and Multi-Node Tests — 8/12 passed

GPU CUDA 12.9 CUDA 13.0 CUDA 13.4 Notes
B200 (multi-GPU) ❌ New ✅ Pass — New: tests.comm.test_trtllm_allreduce_fusion_pdl (1 failure; CUDA 12.9)
GB200 (multi-GPU) ⚠️ Infra ✅ Pass — Timeout: job timed out before producing test results (1 job; CUDA 12.9)
GB200 (multi-node) ✅ Pass ✅ Pass — —
GB300 (multi-GPU) ✅ Pass ✅ Pass — —
GB300 (multi-node) ✅ Pass ✅ Pass — —
VR NVL72 (multi-GPU) — — ⚠️ Infra Timeout: job timed out before producing test results (1 job; CUDA 13.4)
VR NVL72 (multi-node) — — ❔ Unknown —
Failure details

New relative to nightly (attribution uncertain)

  • tests.utils.test_fp4_dispatch — 81 failures on B200 / CUDA 12.9, B200 / CUDA 13.0, B200 / CUDA 13.4, GB200 / CUDA 12.9, GB200 / CUDA 13.0, GB200 / CUDA 13.4, GB300 / CUDA 12.9, GB300 / CUDA 13.0, GB300 / CUDA 13.4
    • AssertionError: global_scale.to must not run
  • tests.attention.test_cake_fused_qk_rope_append_pdl — 3 failures on B200 / CUDA 12.9, GB200 / CUDA 13.0
    • AssertionError: <CUresult.CUDA_ERROR_INVALID_HANDLE: 400> assert <CUresult.CUDA_ERROR_INVALID_HANDLE: 400> == <CUresult.CUDA_SUCCESS: 0> + where <CUresult.CUDA_SUCCESS: 0> = <en…
  • tests.comm.test_trtllm_allreduce_fusion_pdl — 1 failure on B200 / CUDA 12.9 / multi-GPU
    • AssertionError: Process 0 failed with exit code 1 assert 1 == 0 + where 1 = .exitcode

Pre-existing failures

  • tests.cpu.mamba.test_cake_ssd_combined_rubin_twins — 42 failures on B200 / CUDA 12.9, B200 / CUDA 13.0, GB200 / CUDA 12.9, GB200 / CUDA 13.0, GB300 / CUDA 12.9, GB300 / CUDA 13.0
    • RuntimeError: Cake SSDCombined nvcc failed for exactone_bf16_varlen_tablefirstunit/factorized_persistent_segment_preprocess_d6e84d073f (sm_107a): nvcc fatal : Unsupported gpu ar…
  • tests.moe_ep.test_sm107_block_scaled_contracts — 36 failures on B200 / CUDA 12.9, B200 / CUDA 13.0, B200 / CUDA 13.4, GB200 / CUDA 12.9, GB200 / CUDA 13.0, GB200 / CUDA 13.4, GB300 / CUDA 12.9, GB300 / CUDA 13.0, GB300 / CUDA 13.4
    • ValueError: Expecting a ProcessGroup, but got a <class 'unittest.mock.Mock'>.
  • tests.attention.test_cake_fused_qk_rope_append_pdl — 25 failures on B200 / CUDA 12.9, B200 / CUDA 13.0, B200 / CUDA 13.4, GB200 / CUDA 12.9, GB200 / CUDA 13.0, GB200 / CUDA 13.4, GB300 / CUDA 12.9, GB300 / CUDA 13.0, GB300 / CUDA 13.4
    • AssertionError: <CUresult.CUDA_ERROR_INVALID_HANDLE: 400> assert <CUresult.CUDA_ERROR_INVALID_HANDLE: 400> == <CUresult.CUDA_SUCCESS: 0> + where <CUresult.CUDA_SUCCESS: 0> = <en…
  • tests.jit.test_cute_dsl_strict_key_closure — 9 failures on B200 / CUDA 12.9, B200 / CUDA 13.0, B200 / CUDA 13.4, GB200 / CUDA 12.9, GB200 / CUDA 13.0, GB200 / CUDA 13.4, GB300 / CUDA 12.9, GB300 / CUDA 13.0, GB300 / CUDA 13.4
    • AssertionError: ['init.py', 'api_logging.py', 'batch_invariant/init.py', 'batch_invariant/canon.py', 'batch_invariant/fp_interface/init.py', 'batch_invariant/fp_inte…
  • tests.mla.test_cake_dsv41_mixed — 9 failures on B200 / CUDA 12.9, B200 / CUDA 13.0, B200 / CUDA 13.4, GB200 / CUDA 12.9, GB200 / CUDA 13.0, GB200 / CUDA 13.4, GB300 / CUDA 12.9, GB300 / CUDA 13.0, GB300 / CUDA 13.4
    • assert False is None
  • tests.cpu.attention.test_cute_dsl_hca_dsv4 — 8 failures on B200 / CUDA 12.9, B200 / CUDA 13.0, B200 / CUDA 13.4, GB200 / CUDA 12.9, GB200 / CUDA 13.0, GB200 / CUDA 13.4, GB300 / CUDA 13.0, GB300 / CUDA 13.4
    • Failed: DID NOT RAISE ValueError
  • tests.cpu.mamba.test_cake_ssd_combined_rubin_single_sequence — 6 failures on B200 / CUDA 12.9, B200 / CUDA 13.0, GB200 / CUDA 12.9, GB200 / CUDA 13.0, GB300 / CUDA 12.9, GB300 / CUDA 13.0
    • RuntimeError: Cake SSDCombined nvcc failed for exactone_bf16_varlen_tableroles/factorized_persistent_segment_preprocess_d6e84d073f (sm_107a): nvcc fatal : Unsupported gpu archit…
  • tests.norm.test_cake_rmsnorm_silu_gate_train — 3 failures on B200 / CUDA 13.4, GB200 / CUDA 13.4, GB300 / CUDA 13.4
    • AssertionError: ['MEMSET', 'KERNEL'] assert ['MEMSET', 'KERNEL'] == ['KERNEL', 'KERNEL'] At index 0 diff: 'MEMSET' != 'KERNEL' Full diff: [ - 'KERNEL', + 'MEMSET', 'KERNEL', ]
  • tests.attention.test_cake_fmha_decode_programs — 2 failures on B200 / CUDA 12.9, GB300 / CUDA 12.9
    • AssertionError: Timeout (0:02:00)! Thread 0x00007ffff7ca7740 (most recent call first): File "[internal path], line…
  • tests.comm.test_trtllm_allreduce_fusion_mxfp8 — 2 failures on B200 / CUDA 12.9, B200 / CUDA 13.4
    • AssertionError: Process 0 failed with exit code 1 assert 1 == 0 + where 1 = .exitcode
  • tests.norm.test_cake_rmsnorm_det_train_stall — 2 failures on GB300 / CUDA 13.0
    • AssertionError: wait but not in WHOLE_SM: [('bwd', 2048, False, 'bf16', 55296, None, 65536), ('bwd', 2048, False, 'f32', 55296, None, 65536)]; in WHOLE_SM but start: [] assert […
  • tests.norm.test_cake_rmsnorm_train_api — 1 failure on GB300 / CUDA 12.9
    • AssertionError: [] assert 0 == 1 + where 0 = len([])

Timeouts, infrastructure, or incomplete jobs

Repeat the existing class parameter contract on the decorated constructor so generated API documentation and docstring checks cover all five arguments. AI-assisted documentation fix.

@flashinfer-bot flashinfer-bot 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.

CODEOWNERS gap attestation (not a code review).

A code owner of a changed path has approved this PR:

  • @kahyunnam -> flashinfer/quantization/kernels/nvfp4_kv_materialize.py

The following files match only the catch-all rule; this approval covers that technical gap under the one-approval policy. GitHub still requires each owned path's own owner.

  • docs/api/comm.rst
  • docs/api/gemm.rst
  • docs/api/mhc.rst
  • docs/api/norm.rst
  • flashinfer/cake_rmsnorm_det_train_backend/cake_jit.py
  • flashinfer/cake_rmsnorm_train_backend/cake_jit.py
  • flashinfer/cake_rmsnorm_train_backend/cake_windows.py
  • flashinfer/cake_rmsnorm_train_backend/init.py
  • flashinfer/cake_rmsnorm_train.py

Head: 6aef2fb

@flashinfer-bot flashinfer-bot added the op: linear attention KDA, mamba, GDN, etc. review filtering. label Nov 5, 2026
@kangbintNV

Copy link
Copy Markdown
Collaborator Author

I checked internal pipeline #79201273:

No new failure attributable to this documentation PR was found. The pipeline is still red; this does not establish a passing run on the current head.

— Posted by Codex on behalf of @kangbintNV.

@aleozlx
aleozlx merged commit 0db00b2 into flashinfer-ai:main Nov 5, 2026
16 of 18 checks passed
yyihuang pushed a commit to yyihuang/miles-ext-kernels that referenced this pull request Nov 6, 2026
Re-vendor both Cake RMSNorm packages from flashinfer-ai/flashinfer
c51a7540f042d7607f23bc29417147ca7a921828 (main, the merge of #8848). Since the previous commit, eb3eb68d, these
changes touched them:

- flashinfer-ai/flashinfer#8810: on SM103a the non-deterministic backward of H = 2048 ([T, H] rows, BF16 and FP32
  weight) runs the deterministic package's program from T 58497 to 61952. FlashInfer measured the pair it ran there
  before above the weight-gradient budget (every element within atol 1e-4 + rtol 1e-4 of an FP64 sum) at T 58560.
- flashinfer-ai/flashinfer#8827: new non-deterministic backward routes on SM100a and SM107a. With the FP32 weight the
  op passes, the backward runs one kernel where FlashInfer measured the pair it ran before with a larger
  weight-gradient error than the eager FP32 reduction of the same inputs: at H = 2048 on SM100a from T 337 to 4096
  and on SM107a from T 1025 to 16384, at H = 4096 on SM100a from T 1793 to 3584, at H = 5120 on SM100a from T 65 to
  6144 and on SM107a from T 4097 to 19968. On SM100a, H = 5120 runs one kernel above T 56256, where FlashInfer
  measured the programs it replaces above the budget, and H = 2048 one kernel from T 45057 to 58880; above T 65536,
  H = 2048 (SM100a) and H = 4096 (SM100a and SM107a) run compensated programs. On SM107a, H = 2048 from T 65 to 127
  and H = 4096 from T 65 to 256 run another single kernel than before. Other widths get such routes too.
- flashinfer-ai/flashinfer#8813: the deterministic backward of the smallest token counts on SM103a and SM107a (at
  H = 2048: T 3 to 171 on SM103a, up to 256 on SM107a) runs a new column-task kernel whose weight-gradient column
  sums use FP32 compensated arithmetic in a fixed row order. On SM103a it replaces the FP64 fold of the previous
  column-task kernel; on SM107a it replaces a main kernel and its reduce, so det's dw there no longer depends on the
  SM count. det's bits change at those token counts and stay reproducible run to run. On SM107a the deterministic
  backward of H = 256 also runs, from T 1 to 70656, the TwoSum main kernel and dw reduce it ran above T 70656 (the
  form SM100a runs), so det's H = 256 bits on SM107a change there too. On SM107a the FP32-weight forward of
  H = 5120 above 49152 rows also takes a new grid.
- flashinfer-ai/flashinfer#8464: docstring formatting.
- flashinfer-ai/flashinfer#8849: on SM103a the non-deterministic FP32-weight backward of H = 4096 above T 262144 and
  of H = 5120 above T 196608 runs a single kernel with TwoSum per-thread weight-gradient sums, in place of the kernel
  FlashInfer measured above the budget there (1.038 times it at T 393216 for H = 4096, 1.004 times at T 262144 for
  H = 5120). The BF16-weight routes, which the op does not use, switch at T 262144 and 393216.
- flashinfer-ai/flashinfer#8848: on SM100a the non-deterministic backward runs a single kernel with blocked FP32
  weight-gradient sums up to T 131072, from T 65537 at H = 2048, 4096 and 6144 (also with the residual), from
  T 56257 at H = 5120 and, at H = 1536, from T 75777 (FP32 weight) or 78785 (BF16 weight). Above T 131072 the TwoSum
  programs #8827 put in these windows still run. FlashInfer measured the new backward 1.029 to 1.266 times as fast
  as those programs on B200, with no measured dw element above the budget. At H = 5120 it runs the kernels SM107a
  runs above T 49152, whose sources gain a branch for SM100a only; their SM107a SASS does not change.

FlashInfer's open pull request #8835 on the deterministic package is not included, nor #8899, which merged into main
after c51a7540 and changes only SM103a's non-deterministic backward at H = 1536, 2048 and 6144 up to T 131072
(speed). The packages' entry points do not change, so the op code does not. cake_rmsnorm_det_train_backend goes from
582 to 634 files, cake_rmsnorm_train_backend from 581 to 653. Prebuilding all seven widths builds 146 libraries on
SM100a (was 142), 160 on SM103a (was 154) and 138 on SM107a (was 133). The programs above the 232448 B shared-memory
opt-in are unchanged: only det's backward reduce at 4096 on SM107a and its copy in the non-deterministic package
(271360 B, CUDA 13.4's oversized mode), so the op's CUDA-runtime check covers the same programs; every binding above
the opt-in sets that mode.

The op's docstring names the column-task backward of det's smallest token counts on every architecture.

Tests:

- test_dw_accuracy_gpu.py (GPU): FlashInfer's gates at the token counts these changes moved. At H = 2048, on every
  architecture, T 128, 337, 1025, 4096, 16384, 58497, 58560, 61952 and 65536 with det and fast (fast also 98304);
  fast at one token count per window #8827, #8848 and #8849 changed, on that window's architectures, at H = 2048 (T
  131073), H = 4096 (T 256, 3584, 65537, 131073, 262145) and H = 5120 (T 1792, 6144, 19968, 56257, 131073, 196609).
  An FP32 and a BF16 weight parameter, two inputs each: rstd within relative L2 1e-5 of FP64; y and dx within
  FlashInfer's tolerance; every dw element within atol 1e-4 + rtol 1e-4 of the FP64 sum at the forward's rstd and dw
  within relative L2 1e-4 (a BF16 gradient widened by its rounding); where fast's backward runs one kernel, the FP32
  dw's relative L2 error at most the eager FP32 reduction's (or 2^-23 if larger); det bit for bit twice; over the
  FP32-parameter cases, the median ratio of the dw error to the eager FP32 reduction's at most 1, over det and over
  each backward form of fast. det stops at T 65536, where FlashInfer's deterministic suite checks the same element
  bound. These checks hold the installed build to the budget; test_fixed_windows.py is what fails on a build without
  these routes.
- test_fixed_windows.py (no GPU): the windows above in the packages' registry: on SM103a fast runs det's programs
  from T 58497 to 61952 (H = 2048); fast runs one kernel in the #8827 windows; above a cut another single kernel
  than at the cut, the same one up to the next cut: on SM100a above T 65536 (H = 2048 and 4096) and T 131072
  (H = 2048, 4096 and 5120), on SM107a above T 65536 (H = 4096), on SM103a above T 262144 (H = 4096) and T 196608
  (H = 5120); on SM107a fast's T 65 to 127 at H = 2048 and T 65 to 256 at H = 4096 run another single kernel than
  the one they ran before; det's smallest token counts run a column-task kernel on every architecture and every
  width but 256.
- test_rmsnorm_gpu.py: det's repeatability at the smallest token counts also covers the second column-task window
  of SM103a at H = 2048.

    python tools/vendor_cake.py fi --checkout ../flashinfer --commit c51a7540f042d7607f23bc29417147ca7a921828 \
        --op rmsnorm --package flashinfer/cake_rmsnorm_det_train_backend \
        --package flashinfer/cake_rmsnorm_train_backend

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: gemm op: linear attention KDA, mamba, GDN, etc. review filtering. op: misc norm, activation, sampling, RoPE, quantization, etc. v0.7.4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants