Skip to content

[PyTorch] FP8BS grouped GEMM test reference fix - #3722

Merged
ptrendx merged 2 commits into
NVIDIA:mainfrom
denera:pytorch/fp8bs-grouped-gemm-hopper-fix
Oct 27, 2026
Merged

ptrendx merged 2 commits into
NVIDIA:mainfrom
denera:pytorch/fp8bs-grouped-gemm-hopper-fix

Conversation

@denera

@denera denera commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Description

FP8BS grouped GEMM tests were being compared against a reference with FP32 accumulation. FP8BS on Blackwell via MXFP8 emulation passed these tests because MXFP8 grouped GEMM on Blackwell accumulates at a higher precision than native FP8BS grouped GEMM on Hopper.

This PR changes the reference in the test to the unfused split-grouped GEMM — consistent with how native MXFP8 grouped GEMM is tested.

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

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

@denera denera self-assigned this Oct 21, 2026
@denera
denera force-pushed the pytorch/fp8bs-grouped-gemm-hopper-fix branch from 0d14e26 to 49df5dd Compare October 21, 2026 16:27
@denera

denera commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge, with a non-blocking request to retain the mixed-format rejection test.

Findings

  1. P2 Mixed formats lose test coverage ▶

Summary

Replaces the FP32 reference with separately quantized, split GEMMs for the FP8 block-scaling and changing-splits CUDA graph tests.

  • FP8 grouped GEMM tests now use a quantized split reference.
  • FP8 grouped GEMM tests now cover empty and uneven expert groups.
  • The mixed-format operand rejection test is removed.

Reviews (4) · Last reviewed commit: "[PyTorch] Test grouped FP8 block-scaling..." · Reviewed by Greptile

Comment thread tests/pytorch/test_grouped_linear.py Resolved
@denera
denera force-pushed the pytorch/fp8bs-grouped-gemm-hopper-fix branch from 49df5dd to 2717644 Compare October 21, 2026 17:17
@denera

denera commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch

…r path

MXFP8 GEMM on Blackwell accumulates at higher precision than FP8 block-scaling GEMM on Hopper.
The grouped FP8 block-scaling GEMM tests compared against an FP32 reference, so they passed with
the MXFP8 emulation on Blackwell but failed on Hopper.

Compare against the legacy split-tensor grouped GEMM instead, consistent with the existing MXFP8
grouped GEMM tests. Also remove the FP8 block-scaling zero-size-expert and mixed-operand tests,
which no other recipe has.

Signed-off-by: Alp Dener <adener@nvidia.com>
…xperts

Dropping the varying splits and the zero-size-expert test left gaps: the remaining tests no longer
run grouped FP8 block-scaling GEMM with uneven or empty experts when the weights or outputs are
per-expert lists, when accumulating, or when K is not a multiple of 128.

Parametrize the grouped FP8 block-scaling GEMM test over uniform, varying and zero-expert splits,
checked against the split-tensor reference.

Signed-off-by: Alp Dener <adener@nvidia.com>
@denera
denera force-pushed the pytorch/fp8bs-grouped-gemm-hopper-fix branch from fe14444 to cc9d122 Compare October 27, 2026 17:31
assert all(ms % 128 == 0 for ms in m_sizes)
_run_fp8bs_grouped_gemm(z, m_sizes, k, n, layout, case, weight_block_dim, accumulate, dtype)


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 Mixed formats lose test coverage

The deleted test_grouped_gemm_grouped_tensor_fp8_block_scaling_mixed_operands_rejected was the only test that mixed FP8 block-scaling and MXFP8 operands. The replacement cases use matching formats, so a later change could stop rejecting mixed formats on Blackwell without failing these tests.

Keep the negative test and switch its inputs to _tile_scaled_randn; it does not depend on the old FP32 reference.

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!

@ptrendx

ptrendx commented Oct 27, 2026

Copy link
Copy Markdown
Member

/te-ci pytorch

@ptrendx
ptrendx merged commit d7cd302 into NVIDIA:main Oct 27, 2026
18 of 23 checks passed
bvolpato added a commit to bvolpato/TransformerEngine that referenced this pull request Oct 28, 2026
Include upstream NVIDIA#3722 so Hopper grouped FP8 block-scaling tests use the corrected reference. Preserve the existing MXFP8 stride-fix commits and their focused diff.

Signed-off-by: bvolpato <brunocvcunha@gmail.com>
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.

2 participants