Skip to content

[Common] Grouped MXFP8 CuTeDSL kernels - #3841

Open
kainzhong wants to merge 61 commits into
NVIDIA:mainfrom
kainzhong:cutedsl_mxfp8_grouped_backup_g2r
Open

kainzhong wants to merge 61 commits into
NVIDIA:mainfrom
kainzhong:cutedsl_mxfp8_grouped_backup_g2r

Conversation

@kainzhong

Copy link
Copy Markdown
Collaborator

Description

Add CuTeDSL kernels for MXFP8 grouped quantization

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

Please list the changes introduced in this PR:

  • CuTeDSL grouped MXFP8 quantization kernels

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

kainzhong and others added 30 commits October 6, 2026 00:23
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
kainzhong and others added 26 commits October 12, 2026 18:48
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
…ped_backup_g2r

Take the refactored quantize_bidimensional_mxfp8_g2r (explicit ROWWISE/COLWISE/dtype
constexprs instead of a config) and the internal PACK_SIZE/WAVES/THREADS_PER_BANK of
quantize_rowwise_mxfp8. Adapt the grouped kernels to both: the grouped g2r kernel passes
its config's fields to the tile function, and reduce_rowwise_dbias uses the same fixed
constants as quantize_rowwise_mxfp8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
…ped_backup_g2r

Adapt the grouped kernels to the renamed single-tensor modules and helpers
(g2s_general / g2r_bidim, _quantize_{rowwise,colwise}_mxfp8,
quantize_mxfp8_gmem_tile_bidimensional with its new act/dact arguments), and
keep reduce_rowwise_dbias as a shared helper for the grouped kernel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
The more_cutedsl_mxfp8_specialized base was squash-merged as NVIDIA#3642, so
CuTeDSL conflicts were resolved by 3-way merging against dba8dbf, the
last base-branch commit merged here. CuTeDSL/__init__.py: register both
get_mxfp8_group_quantization_function and NVIDIA#3560's
get_mxfp8_requantization_function.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
@greptile-apps

greptile-apps Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change affects grouped MXFP8 quantization across supported CuTeDSL callers.

The PR appears safe to merge, with a non-blocking correction needed in the grouped PyTorch comparisons.

Findings

  1. P2 Equal outputs fail comparison ▶

Summary

Adds CuTeDSL kernels for grouped MXFP8 quantization.

  • Grouped MXFP8 kernels handle different member shapes and quantization options.
  • Grouped MXFP8 calls can now use CuTeDSL when the backend supports them.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Grouped MXFP8 call] --> B{CuTeDSL enabled and supported?}
  B -- No --> C[Existing CUDA kernel]
  B -- Yes --> D{Single-tensor view eligible?}
  D -- Yes --> E[Existing single-tensor kernel]
  D -- No --> F{Grouped register kernel eligible?}
  F -- Yes --> G[Grouped register kernel]
  F -- No --> H[General grouped kernel]
  H --> I[Reduce partial bias sums when requested]
Loading

Reviews (1) · Last reviewed commit: "[pre-commit.ci] auto fixes from pre-comm..." · Reviewed by Greptile

Comment on lines +450 to +454
parts["rowwise data"] = out.rowwise_data.view(torch.uint8).clone()
parts["rowwise scales"] = out.scale_inv.view(torch.uint8).clone()
if columnwise:
parts["colwise data"] = out.columnwise_data.view(torch.uint8).clone()
parts["colwise scales"] = out.columnwise_scale_inv.view(torch.uint8).clone()

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.

P2 Equal outputs fail comparison

extract_group_quantized_output compares raw FP8 bytes, but the reused CuTeDSL conversion helpers preserve negative zero where CUDA's grouped conversion can produce positive zero. Small negative inputs that round to zero can therefore fail these tests even though both outputs have the same value.

Fold 0x80 into 0x00 for grouped data, as extract_quantized_output already does. Keep the scale comparisons unchanged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant