Skip to content

[PyTorch] Fix grouped split validation for GroupedLinear/GroupedMLP ops - #3785

Merged
vthumbe1503 merged 9 commits into
NVIDIA:mainfrom
vthumbe1503:fix/grouped-linear-deferred-init-test-alignment
Oct 31, 2026
Merged

vthumbe1503 merged 9 commits into
NVIDIA:mainfrom
vthumbe1503:fix/grouped-linear-deferred-init-test-alignment

Conversation

@vthumbe1503

@vthumbe1503 vthumbe1503 commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Set GroupedLinear split alignment from the active recipe: 1 for BF16/FP16 and Blackwell FP8 current scaling, 16 for Hopper FP8 current scaling, and 128 for MXFP8/NVFP4/FP8 block scaling. An explicit value applies unless the deprecated environment override forces 256.
  • Reject negative splits at every alignment and check 16-byte uniform and discrete-A GEMM leading dimensions, with or without bias.

Cause

PR #3745 passed the default split_alignment=128 into the device-side scan for every grouped-tensor path. Unquantized BF16 accepts 32-row groups, so TestFuser.test_deferred_param_init trapped at the forward call. Passing alignment 1 alone also bypassed the scan's negative-size guard; this PR makes that guard unconditional.

Validation

Built and imported exact PR head 565bb89a on H100 NVL and GB200 PyTorch containers. No new test was added, per request.

GPU Focused grouped-linear deferred-init Full test_fusible_ops.py
H100 NVL 2 passed, 12 deselected 1,773 passed, 1,859 skipped, 0 failed
GB200 2 passed, 12 deselected 2,395 passed, 3,661 skipped, 0 failed

Command: PYTHONPATH="$TE_PATH" python3 -m pytest -q tests/pytorch/test_fusible_ops.py --tb=short --disable-warnings.

A separate GPU process on each architecture using splits [-1, 65] and split_alignment=1 reached the device-side negative-size error and failed as expected.

Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
@vthumbe1503 vthumbe1503 changed the title Fix grouped linear deferred-init test split alignment Skip grouped split validation for unquantized compute Oct 30, 2026
@vthumbe1503
vthumbe1503 marked this pull request as ready for review October 30, 2026 17:22
@vthumbe1503

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch

@greptile-apps

greptile-apps Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

GroupedLinear now chooses split alignment from the active recipe and GPU.

  • GroupedLinear picks split alignment from the active compute recipe.
  • Split scans reject negative sizes at every alignment.
  • Grouped GEMM checks that matrix dimensions span 16 bytes.

No new actionable issues were found. Review checks were static; no build or GPU tests were run.

Reviews (7) · Last reviewed commit: "Check discrete grouped GEMM input alignm..." · Reviewed by Greptile

Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
@vthumbe1503 vthumbe1503 changed the title Skip grouped split validation for unquantized compute [PyTorch] Skip grouped split validation for unquantized compute Oct 30, 2026
@vthumbe1503 vthumbe1503 added the bug Something isn't working label Oct 30, 2026
@vthumbe1503 vthumbe1503 changed the title [PyTorch] Skip grouped split validation for unquantized compute [PyTorch] Skip grouped split validation for BF16 compute Oct 30, 2026
Co-authored-by: Tim Moon <4406448+timmoon10@users.noreply.github.com>
Signed-off-by: vthumbe1503 <vthumbe@nvidia.com>
vthumbe1503 and others added 2 commits October 30, 2026 15:08
@vthumbe1503
vthumbe1503 force-pushed the fix/grouped-linear-deferred-init-test-alignment branch from 3a427c1 to e41cb5e Compare October 30, 2026 22:08
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
@vthumbe1503 vthumbe1503 changed the title [PyTorch] Skip grouped split validation for BF16 compute [PyTorch] Fix grouped split validation for GroupedLinear/GroupedMLP ops Oct 30, 2026
@vthumbe1503

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch

@timmoon10 timmoon10 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.

LGTM

@vthumbe1503
vthumbe1503 merged commit 9ad8fd0 into NVIDIA:main Oct 31, 2026
19 of 23 checks passed
bvolpato added a commit to bvolpato/TransformerEngine that referenced this pull request Oct 31, 2026
Include upstream NVIDIA#3785 so BF16 grouped-linear validation uses recipe-specific split alignment. Preserve the original two-file MXFP8 stride fix.

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

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants