Skip to content

[Common] Force tensor member rows 128 divisible for SAME_BOTH_DIM grouped MXFP8 quantization - #3912

Open
kainzhong wants to merge 2 commits into
NVIDIA:mainfrom
kainzhong:fix_grouped_mxfp8_unaligned_same_shape
Open

kainzhong wants to merge 2 commits into
NVIDIA:mainfrom
kainzhong:fix_grouped_mxfp8_unaligned_same_shape

Conversation

@kainzhong

Copy link
Copy Markdown
Collaborator

Description

Fixes #3911

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:

  • Reject non-128 divisible member rows

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

…h unaligned rows

For SAME_BOTH_DIMS, group_quantize only checked that the stacked rows were a
multiple of 128. When the per-tensor rows were not (e.g. two 192 x 256
tensors), the last chunk of each tensor ran into the next one: the last
tensor's scales were written past the end of the scale buffers, and the dbias
partials were mixed between tensors and summed from the wrong workspace rows.

Require the rows of each tensor to be a multiple of 128 on the host, where
they are known for this representation.

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

@tdophung tdophung 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

@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The PR affects validation for same-shaped grouped MXFP8 quantization.

The change appears safe to merge, with a non-blocking request to test the new rejection.

Findings

  1. P2 Row rejection lacks a test ▶

Summary

Adds a host-side check requiring each SAME_BOTH_DIMS member to have a row count divisible by 128.

  • Grouped MXFP8 quantization checks each member's rows against 128-row tiles.

Reviews (1) · Last reviewed commit: "Merge branch 'main' into fix_grouped_mxf..." · Reviewed by Greptile

Comment on lines +1196 to +1200
if (shape_rep == ShapeRepresentation::SAME_BOTH_DIMS) {
NVTE_CHECK(
first_logical_dim % num_tensors == 0 && (first_logical_dim / num_tensors) % tile_dim_y == 0,
"First dimension of each tensor in a group must be divisible by ", tile_dim_y, ", got ",
first_logical_dim, " rows split across ", num_tensors, " tensors.");

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 Row rejection lacks a test

The existing grouped MXFP8 test skips members whose row count is not divisible by 128, so adding an invalid shape to its input list would not exercise this check. Add a standalone rejection test for two 64-row tensors: their total of 128 rows passes the old check but must fail the new one. Keep an aligned success case alongside it. This would catch future changes that accidentally remove the protection.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@kainzhong

Copy link
Copy Markdown
Collaborator Author

/te-ci

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.

[BUG] Wrong dbias result for SAME_BOTH_DIM grouped quantization with non-128 divisible members

2 participants