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

mx: add ceil and RNE rounding modes to the cast from fp32 to e8m0 #1620

Open
wants to merge 3 commits into
base: gh/vkuzo/18/head
Choose a base branch
from

Conversation

vkuzo
Copy link
Contributor

@vkuzo vkuzo commented Jan 24, 2025

Summary:

Why we want this: in the newly released cuBLAS 12.8 documentation, the
RNE rounding mode is used for the cast to e8m0. We want to properly
emulate this cast.

This is a copy-pasta of #516 with the
modifications being keeping FLOOR the default mode, and removing e3m0, credit
to @NicoleMayer for the original code. I don't have a way to check bitwise
equivalency with the most recent cuBLAS version yet, but will come back
and add tests when I do.

Test Plan:

pytest test/prototype/mx_formats/ -s -x

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@vkuzo
Copy link
Contributor Author

vkuzo commented Jan 24, 2025

Copy link

pytorch-bot bot commented Jan 24, 2025

🔗 Helpful Links

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

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

❌ 1 Cancelled Job

As of commit e5f61c4 with merge base 11440c2 (image):

CANCELLED JOB - The following job was cancelled. Please retry:

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 Jan 24, 2025
vkuzo added a commit that referenced this pull request Jan 24, 2025
Summary:

Why we want this: in the newly released cuBLAS 12.8 documentation, the
RNE rounding mode is used for the cast to e8m0. We want to properly
emulate this cast.

This is a copy-pasta of #516 with the
modifications being keeping FLOOR the default more, and removing e3m0, credit
to NicoleMayer for the original code. I don't have a way to check bitwise
equivalency with the most recent cuBLAS version yet, but will come back
and add tests when I do.

Test Plan:

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

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 05679cdf019aa3338e77cf08ce2c5976a6f1e3e6
ghstack-comment-id: 2613597310
Pull Request resolved: #1620
[ghstack-poisoned]
vkuzo added a commit that referenced this pull request Jan 24, 2025
Summary:

Why we want this: in the newly released cuBLAS 12.8 documentation, the
RNE rounding mode is used for the cast to e8m0. We want to properly
emulate this cast.

This is a copy-pasta of #516 with the
modifications being keeping FLOOR the default more, and removing e3m0, credit
to NicoleMayer for the original code. I don't have a way to check bitwise
equivalency with the most recent cuBLAS version yet, but will come back
and add tests when I do.

Test Plan:

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

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 49330726a68936ddece56d37e15129d3cc546b4e
ghstack-comment-id: 2613597310
Pull Request resolved: #1620
@vkuzo vkuzo added the topic: improvement Use this tag if this PR is an improvement (doesn't fit into any of the other categories) label Jan 24, 2025
[ghstack-poisoned]
vkuzo added a commit that referenced this pull request Jan 24, 2025
Summary:

Why we want this: in the newly released cuBLAS 12.8 documentation, the
RNE rounding mode is used for the cast to e8m0. We want to properly
emulate this cast.

This is a copy-pasta of #516 with the
modifications being keeping FLOOR the default more, and removing e3m0, credit
to NicoleMayer for the original code. I don't have a way to check bitwise
equivalency with the most recent cuBLAS version yet, but will come back
and add tests when I do.

Test Plan:

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

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 49330726a68936ddece56d37e15129d3cc546b4e
ghstack-comment-id: 2613597310
Pull Request resolved: #1620
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: improvement Use this tag if this PR is an improvement (doesn't fit into any of the other categories)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants