Skip to content
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

enable compile with mxfp8 and mxfp4 cutlass gemm #1838

Merged
merged 17 commits into from
Mar 5, 2025
Merged

Conversation

vkuzo
Copy link
Contributor

@vkuzo vkuzo commented Mar 5, 2025

Summary:

Enables torch.compile e2e on MXLinear with the mxfp8_cutlass and mxfp4_cutlass recipes. To do this, we need to add a tag on the op definitions to make inductor honor the col-major layout.

Note that something else is broken with these ops and bias=True - leaving that for a future PR.

Test Plan:

python benchmarks/float8/profile_lowp_training.py ~/local/tmp/20250305_test --mx_recipe_name mxfp8_cutlass

# uncomment the hardware check, then can also run the unit test
pytest test/prototype/mx_formats -s -k test_linear_compile

Reviewers:

Subscribers:

Tasks:

Tags:

vkuzo added 7 commits March 4, 2025 12:53
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@vkuzo
Copy link
Contributor Author

vkuzo commented Mar 5, 2025

Copy link

pytorch-bot bot commented Mar 5, 2025

🔗 Helpful Links

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

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

⏳ No Failures, 1 Pending

As of commit 8f82ae7 with merge base 23c3162 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@facebook-github-bot facebook-github-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 Mar 5, 2025
vkuzo added a commit that referenced this pull request Mar 5, 2025
Summary:

Does not work yet - bug in inductor?

Test Plan:

```
pytest test/prototype/mx_formats -s -x -k test_linear_compile
```

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 2e67d4783ed259ff432156ef7f16b6e850dce391
ghstack-comment-id: 2701081457
Pull Request resolved: #1838
vkuzo added 3 commits March 5, 2025 06:39
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
vkuzo added a commit that referenced this pull request Mar 5, 2025
Summary:

Does not work yet - bug in inductor?

Test Plan:

```
pytest test/prototype/mx_formats -s -x -k test_linear_compile
```

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 9ea94a266e47e80760623fd6e3945e58a4ae02f8
ghstack-comment-id: 2701081457
Pull Request resolved: #1838
vkuzo added 2 commits March 5, 2025 06:40
[ghstack-poisoned]
[ghstack-poisoned]
vkuzo added a commit that referenced this pull request Mar 5, 2025
Summary:

Does not work yet - bug in inductor?

Test Plan:

```
pytest test/prototype/mx_formats -s -x -k test_linear_compile
```

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 9ea94a266e47e80760623fd6e3945e58a4ae02f8
ghstack-comment-id: 2701081457
Pull Request resolved: #1838
vkuzo added 2 commits March 5, 2025 06:42
[ghstack-poisoned]
[ghstack-poisoned]
vkuzo added a commit that referenced this pull request Mar 5, 2025
Summary:

Does not work yet - bug in inductor?

Test Plan:

```
pytest test/prototype/mx_formats -s -x -k test_linear_compile
```

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: aac26d28a89c4bc676e9e6e480b95649ef6bde57
ghstack-comment-id: 2701081457
Pull Request resolved: #1838
[ghstack-poisoned]
@vkuzo vkuzo changed the base branch from gh/vkuzo/51/head to main March 5, 2025 16:54
vkuzo added a commit that referenced this pull request Mar 5, 2025
Summary:

Does not work yet - bug in inductor?

Test Plan:

```
pytest test/prototype/mx_formats -s -x -k test_linear_compile
```

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 1e94dd3c894a3d975f37286bfb5f5cb142e7d30f
ghstack-comment-id: 2701081457
Pull Request resolved: #1838
@vkuzo vkuzo added the topic: not user facing Use this tag if you don't want this PR to show up in release notes label Mar 5, 2025
[ghstack-poisoned]
vkuzo added a commit that referenced this pull request Mar 5, 2025
Summary:

Does not work yet - bug in inductor?

Test Plan:

```
pytest test/prototype/mx_formats -s -x -k test_linear_compile
```

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 521f541f6b3ec2ef3f01a7dd344198293902758b
ghstack-comment-id: 2701081457
Pull Request resolved: #1838
@vkuzo vkuzo requested review from drisspg and danielvegamyhre March 5, 2025 17:00
@vkuzo vkuzo changed the title [wip] e2e testing of compile with mxfp8 cutlass gemm enable compile with mxfp8 and mxfp4 cutlass gemm Mar 5, 2025
lib.define("mx_fp4_bf16(Tensor a, Tensor b, Tensor a_scale, Tensor b_scale) -> Tensor")
# Note: we need to add the `torch._C.Tag.needs_fixed_stride_order` tag in order for inductor
# to honor the layout constraints for `b` in the two ops below.
lib.define(
Copy link
Contributor

Choose a reason for hiding this comment

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

Whoops I meant to add this before

Good catch

[ghstack-poisoned]
@vkuzo vkuzo merged commit 4a5ab2d into main Mar 5, 2025
47 of 50 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: 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.

3 participants