Skip to content

Conversation

@vkuzo
Copy link
Contributor

@vkuzo vkuzo commented Oct 6, 2025

Summary:

Switches fp4 packing from val0:val1 to val1:val0, to align with how
torch.float4_e2m1fn_x2 is defined, and how other frameworks do this.

For context, please see the docblock of the Float4_e2m1fn_x2 object
from https://github.com/pytorch/pytorch/pull/148791/files

Test Plan:

pytest test/prototype/mx_formats/ -s -x

also, when we save nvfp4 weights in this packing order, we can now use nvfp4 kernels already integrated in vLLM

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@vkuzo
Copy link
Contributor Author

vkuzo commented Oct 6, 2025

Stack from ghstack (oldest at bottom):

@pytorch-bot
Copy link

pytorch-bot bot commented Oct 6, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 732b394 with merge base c96f2dd (image):
💚 Looks good so far! There are no failures yet. 💚

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

vkuzo added a commit that referenced this pull request Oct 6, 2025
Summary:

Switches fp4 packing from `val0:val1` to `val1:val0`, to align with how
`torch.float4_e2m1fn_x2` is defined, and how other frameworks do this.

For context, please see the docblock of the `Float4_e2m1fn_x2` object
from https://github.com/pytorch/pytorch/pull/148791/files

Test Plan:

```bash
pytest test/prototype/mx_formats/ -s -x
```

Reviewers:

Subscribers:

Tasks:

Tags:
ghstack-source-id: da13f89
ghstack-comment-id: 3373519438
Pull-Request: #3123
@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 Oct 6, 2025
@vkuzo vkuzo mentioned this pull request Oct 6, 2025
@vkuzo vkuzo added the topic: bug fix Use this tag for PRs that fix bugs label Oct 6, 2025
@vkuzo vkuzo merged commit 28612d0 into main Oct 8, 2025
50 of 52 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. topic: bug fix Use this tag for PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants