Skip to content

emulated nvfp4 support torch._grouped_mm for inference#4314

Merged
vkuzo merged 22 commits into
mainfrom
gh/vkuzo/252/head
Apr 23, 2026
Merged

emulated nvfp4 support torch._grouped_mm for inference#4314
vkuzo merged 22 commits into
mainfrom
gh/vkuzo/252/head

Conversation

@vkuzo
Copy link
Copy Markdown
Contributor

@vkuzo vkuzo commented Apr 22, 2026

Summary:

Sets up the skeleton for nvfp4 grouped_mm support for inference:

  1. add a test case for bf16 grouped_mm
  2. make the test case pass with emulated nvfp4 (requires fixing a shape
    arithmetic bug)

Hooking up real nvfp4 kernel will be in an upcoming PR, to keep things
small.

Test Plan:

pytest test/prototype/mx_formats/test_inference_workflow.py -s -k grouped_mm

vkuzo added 19 commits April 20, 2026 20:52
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@vkuzo
Copy link
Copy Markdown
Contributor Author

vkuzo commented Apr 22, 2026

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Apr 22, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4314

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 22, 2026
assert len(orig_size) == 3, "unsupported"
# only supporting dim0, dim1, dim2 and dim0, dim2, dim1 orders
new_size = [new_size[0], new_size[2] // 2, new_size[1]]
new_size = [new_size[0], new_size[1] // 2, new_size[2]]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the old code was incorrect and untested, this PR fixes it. This function should not reorder the dimensions.

@vkuzo vkuzo added the module: not user facing Use this tag if you don't want this PR to show up in release notes label Apr 22, 2026
vkuzo added 3 commits April 23, 2026 09:23
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@vkuzo vkuzo changed the base branch from gh/vkuzo/251/head to main April 23, 2026 09:24
@vkuzo vkuzo merged commit 0c8f44b into main Apr 23, 2026
34 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: not user facing Use this tag if you don't want this PR to show up in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants