Skip to content

[moe training] add fp8 rowwise kernels for expert weights #2696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: danielvegamyhre/stack/29
Choose a base branch
from

Conversation

danielvegamyhre
Copy link
Contributor

@danielvegamyhre danielvegamyhre commented Aug 5, 2025

Stacked PRs:


[moe training] add fp8 rowwise kernels for expert weights

Summary

Test plan

  • pytest test/prototype/moe_training/test_kernels.py

stack-info: PR: #2696, branch: danielvegamyhre/stack/30
Copy link

pytorch-bot bot commented Aug 5, 2025

🔗 Helpful Links

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

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 Aug 5, 2025
@danielvegamyhre danielvegamyhre force-pushed the danielvegamyhre/stack/30 branch from af159db to f6688be Compare August 5, 2025 23:12
@danielvegamyhre danielvegamyhre added the topic: not user facing Use this tag if you don't want this PR to show up in release notes label Aug 5, 2025
@danielvegamyhre danielvegamyhre changed the base branch from danielvegamyhre/stack/29 to main August 5, 2025 23:44
@danielvegamyhre danielvegamyhre force-pushed the danielvegamyhre/stack/30 branch from f6688be to a6f8cbb Compare August 5, 2025 23:44
@danielvegamyhre danielvegamyhre changed the base branch from main to danielvegamyhre/stack/29 August 5, 2025 23:44
@danielvegamyhre danielvegamyhre changed the base branch from danielvegamyhre/stack/29 to main August 5, 2025 23:56
@danielvegamyhre danielvegamyhre force-pushed the danielvegamyhre/stack/30 branch from a6f8cbb to ef4e25c Compare August 5, 2025 23:56
@danielvegamyhre danielvegamyhre changed the base branch from main to danielvegamyhre/stack/29 August 5, 2025 23:57
@danielvegamyhre danielvegamyhre changed the base branch from danielvegamyhre/stack/29 to main August 6, 2025 00:00
@danielvegamyhre danielvegamyhre changed the base branch from main to danielvegamyhre/stack/29 August 6, 2025 00:01
@danielvegamyhre danielvegamyhre changed the base branch from danielvegamyhre/stack/29 to main August 6, 2025 00:13
@danielvegamyhre danielvegamyhre changed the base branch from main to danielvegamyhre/stack/29 August 6, 2025 00:13
@danielvegamyhre danielvegamyhre changed the base branch from danielvegamyhre/stack/29 to main August 6, 2025 00:56
@danielvegamyhre danielvegamyhre changed the base branch from main to danielvegamyhre/stack/29 August 6, 2025 00:56
@danielvegamyhre danielvegamyhre changed the base branch from danielvegamyhre/stack/29 to main August 6, 2025 01:19
@danielvegamyhre danielvegamyhre force-pushed the danielvegamyhre/stack/30 branch from ef4e25c to 2ea3573 Compare August 6, 2025 01:20
@danielvegamyhre danielvegamyhre changed the base branch from main to danielvegamyhre/stack/29 August 6, 2025 01:20
@danielvegamyhre danielvegamyhre changed the base branch from danielvegamyhre/stack/29 to main August 6, 2025 01:36
@danielvegamyhre danielvegamyhre force-pushed the danielvegamyhre/stack/30 branch from 2ea3573 to 6704fd3 Compare August 6, 2025 01:36
@danielvegamyhre danielvegamyhre changed the base branch from main to danielvegamyhre/stack/29 August 6, 2025 01:36
tl.float32
)
if round_scales_to_power_of_2:
scales = tl.exp2(tl.floor(tl.log2(scales)))
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems expensive, can we just extract the bits?


# Apply scales to tensor and convert to float8.
tensor_scaled = input_hp_t.to(torch.float32) * scales
float8_tensor = to_fp8_saturated(tensor_scaled, target_dtype)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is confusing because it sounds like Float8TrainingTensor, maybe name it float8_data?

@danielvegamyhre danielvegamyhre force-pushed the danielvegamyhre/stack/29 branch from fad9062 to 241e9b7 Compare August 6, 2025 17:24
@danielvegamyhre danielvegamyhre force-pushed the danielvegamyhre/stack/30 branch from 6704fd3 to c789281 Compare August 6, 2025 17:24
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: 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