Skip to content

fix(gemm): remove SM120 MXFP8 tile configs that exceed the SM12x shared-memory limit - #4013

Merged
bkryu merged 3 commits into
flashinfer-ai:mainfrom
yichengj0:mxfp8-sm120-drop-oversized-tiles
Sep 3, 2026
Merged

bkryu merged 3 commits into
flashinfer-ai:mainfrom
yichengj0:mxfp8-sm120-drop-oversized-tiles

Conversation

@yichengj0

@yichengj0 yichengj0 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

📌 Description

The issue:

  • Four of the ten SM120 MXFP8 CUTLASS tactics fail on every autotuner pass with [MXFP8 SM120 gemm Runner] Failed to initialize cutlass MXFP8 gemm on sm120. Error: Error Internal.
  • The failing tactics (the 256x128 and 128x256 tiles) need more shared memory per block than any SM12x GPU provides, so they can never run anywhere this SM120-only module runs. They are dead code.
  • Confirmed by measurement on RTX 5080, RTX PRO 6000 Blackwell (CC 12.0) and GB10 / DGX Spark (CC 12.1): the kernels request 111616 bytes per block; all three devices allow at most 101376.

The fixes:

  • Remove the two oversized tile configs and their kernel instantiations. The module now advertises 6 tactics, all usable, and compiles four fewer kernels.
  • When kernel initialization fails because of shared memory, the error now reports the kernel's need next to the device limit.
  • Replace the hardcoded tactic-count test with one that runs every advertised tactic (bf16 and fp16 outputs) against a reference, so an unusable config fails loudly and a new valid tactic is covered without test edits.

🔍 Related Issues

Addresses the MXFP8 item of #3170 (kept open; other items remain). Supersedes #3568; thanks @tgmerritt for the original diagnosis on GB10. Measuring the actual shared-memory requests showed the configs are unusable on all SM12x devices, so this PR removes them at the source instead of filtering them out at runtime.

🚀 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.

🧪 Tests

  • Tests have been added or updated as needed.
  • All tests are passing (unittest, etc.).

Verified on GB10: the full tests/gemm/test_mm_mxfp8_sm120.py suite passes and the module reports 6 tactics. The surviving tactics also pass the numeric suite on RTX 5080 and RTX PRO 6000 boards.

Reviewer Notes

If a future SM12x part ships with more shared memory and the large tiles become viable, the place to bring them back is getConfigs(), ideally with a static check of each tile's shared-memory need against the device limit.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Performance

    • Reduced the SM120/SM121 MXFP8 GEMM CTA tile configurations to the supported set.
    • Updated SM120 GEMM execution to use a consistent shared-memory staging strategy.
  • Bug Fixes

    • Workspace estimation failures during SM120 MXFP8 GEMM probing now surface instead of being suppressed.
    • Added clearer diagnostics when kernel initialization exceeds the device’s shared-memory limit.
  • Tests

    • Added parameterized validation covering all advertised SM120 MXFP8 tactics for BF16 and FP16 outputs.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 3fe55873-7419-4e9f-8be9-1abf9c3e09de

📥 Commits

Reviewing files that changed from the base of the PR and between 61f9b29 and 220ef2d.

📒 Files selected for processing (4)
  • flashinfer/jit/gemm/core.py
  • include/flashinfer/gemm/mxfp8_gemm_cutlass_template_sm120.h
  • include/flashinfer/gemm/mxfp8_gemm_template_sm120.h
  • tests/gemm/test_mm_mxfp8_sm120.py
💤 Files with no reviewable changes (1)
  • flashinfer/jit/gemm/core.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • include/flashinfer/gemm/mxfp8_gemm_cutlass_template_sm120.h
  • include/flashinfer/gemm/mxfp8_gemm_template_sm120.h
  • tests/gemm/test_mm_mxfp8_sm120.py

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

SM120/SM121 MXFP8 GEMM now retains three CTA tile shapes, propagates workspace dispatch failures, uses automatic shared-memory carveout, reports shared-memory limits during initialization failures, and tests every advertised tactic for BF16 and FP16 outputs.

Changes

SM120 MXFP8 GEMM

Layer / File(s) Summary
Restrict CTA shapes and dispatch
flashinfer/jit/gemm/core.py, include/flashinfer/gemm/mxfp8_gemm_cutlass_template_sm120.h
Generated and configured SM120 variants retain only three 128-based CTA shapes. Larger dispatch cases are removed, and workspace probing now propagates dispatch errors.
Update kernel staging and diagnostics
include/flashinfer/gemm/mxfp8_gemm_template_sm120.h
Kernel instantiation uses automatic shared-storage carveout, while initialization errors report the device shared-memory limit when applicable.
Validate all tactics
tests/gemm/test_mm_mxfp8_sm120.py
The test runs every advertised tactic for BF16 and FP16 outputs and checks finite results and cosine similarity against a BF16 torch.mm reference.

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

Merge Risk: ⚪ Minimal · up to 220ef

The change removes unusable SM120 tile configurations, improves shared-memory error reporting, and updates coverage for all advertised tactics; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: removing SM120 MXFP8 tile configurations that exceed the SM12x shared-memory limit.
Description check ✅ Passed The description is complete and follows the repository template. It explains the problem, implementation, related issues, testing, verification results, and reviewer considerations.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request removes the 256x128 and 128x256 tile configurations for SM120 MXFP8 GEMM as they exceed the shared memory limits of SM12x devices. It also simplifies stage count logic, enhances error reporting with detailed shared memory usage information, and updates the test suite to dynamically verify all available tactics. Regarding the feedback, removing the try-catch block when querying workspace sizes could lead to unhandled runtime errors (e.g., when placeholder kernels are used), so it is recommended to retain it for robustness.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread include/flashinfer/gemm/mxfp8_gemm_cutlass_template_sm120.h
…imit

The 256x128 and 128x256 CTA tiles need 111616 bytes of dynamic shared
memory, above the 101376-byte per-block limit every SM12x device reports
(verified on RTX 5080, RTX PRO 6000 Blackwell and GB10), so their kernels
can never initialize on any GPU this SM120-only module runs on.

- remove the two tile configs, their dispatch cases and kernel
  instantiations (tactic count drops from 10 to 6, four fewer kernels
  to compile)
- on initialize() failure, report the kernel's shared-memory need vs the
  device limit when that is the cause
- drop the now-dead StageCount<2> branch and the workspace-size
  try/catch that only existed for the oversized configs
- test every advertised tactic (bf16 and fp16 outputs) against a
  reference instead of asserting a hardcoded tactic count

AI-assisted (Claude Code).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@yichengj0
yichengj0 force-pushed the mxfp8-sm120-drop-oversized-tiles branch from 20b2df0 to cd3fa80 Compare July 17, 2026 01:54
@bkryu

bkryu commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

@flashinfer-bot run

@bkryu

bkryu commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

/bot run tests/gemm

@flashinfer-bot

Copy link
Copy Markdown
Collaborator

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

@flashinfer-bot

Copy link
Copy Markdown
Collaborator

[FAILED] Pipeline #63744341 — 15/16 executed test jobs passed

Compared with nightly #63648836.

Unit Tests

GPU CUDA 12.9 CUDA 13.0 Notes
B300 ✅ Pass ✅ Pass
GB200 ✅ Pass ✅ Pass
GB300 ✅ Pass ✅ Pass
H100 ✅ Pass ✅ Pass
RTX Pro 6000 Blackwell ⚠️ Infra ✅ Pass Infrastructure: CI infrastructure failure (1 job; CUDA 12.9)

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

Multi-GPU and Multi-Node Tests — 6/6 passed

GPU CUDA 12.9 CUDA 13.0 Notes
B300 (multi-GPU) ✅ Pass ✅ Pass
GB200 (multi-node) ✅ Pass ✅ Pass
GB300 (multi-node) ✅ Pass ✅ Pass
Failure details

Timeouts, infrastructure, or incomplete jobs

@bkryu

bkryu commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

/bot run tests/gemm

@bkryu

bkryu commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

@flashinfer-bot run

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@flashinfer-bot

Copy link
Copy Markdown
Collaborator

GitLab MR !1283 has been updated with latest changes, and the CI pipeline #65907369 is currently running. I'll report back once the pipeline job completes.

@bkryu
bkryu enabled auto-merge (squash) September 2, 2026 20:59
@flashinfer-bot

Copy link
Copy Markdown
Collaborator

[FAILED] Pipeline #65907369 — 15/16 executed test jobs passed

Compared with nightly #65814627 (different CI configuration).

Unit Tests

GPU CUDA 12.9 CUDA 13.0 Notes
B200 ✅ Pass ❔ Unknown Not compared: tests.gemm.test_groupwise_scaled_gemm_fp8 (1 failure; CUDA 13.0)
GB200 ✅ Pass ✅ Pass
GB300 ✅ Pass ✅ Pass
H100 ✅ Pass ✅ Pass
RTX Pro 6000 Blackwell ✅ Pass ✅ Pass

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

Multi-GPU and Multi-Node Tests — 6/6 passed

GPU CUDA 12.9 CUDA 13.0 Notes
B300 (multi-GPU) ✅ Pass ✅ Pass
GB200 (multi-node) ✅ Pass ✅ Pass
GB300 (multi-node) ✅ Pass ✅ Pass
Failure details

Could not compare

  • tests.gemm.test_groupwise_scaled_gemm_fp8 — 1 failure on B200 / CUDA 13.0
    • AssertionError: Tensor-likes are not close! Mismatched elements: 127 / 8192 (1.6%) Greatest absolute difference: 1.65625 at index (8, 135) (up to 0.01 allowed) Greatest relative…

@bkryu
bkryu merged commit 971b0a6 into flashinfer-ai:main Sep 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants