KEMBAR78
[MPS] Add support for bf16 autocast by hvaara · Pull Request #139390 · pytorch/pytorch · GitHub
Skip to content

Conversation

@hvaara
Copy link
Contributor

@hvaara hvaara commented Oct 31, 2024

This PR adds support for bf16 autocast. Most of the code and ideas are copied from #99272.

Most of the heavy lifting was done by AI.

Fixes #139386

cc @mcarilli @ptrblck @leslie-fang-intel @jgong5

Co-authored-by: Kulin Seth <kulin_seth@apple.com>
Co-authored-by: Siddharth Kotapati <skotapati@apple.com>
@pytorch-bot
Copy link

pytorch-bot bot commented Oct 31, 2024

🔗 Helpful Links

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

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:

✅ You can merge normally! (1 Unrelated Failure)

As of commit e716891 with merge base 3192bde (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

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

@cpuhrsch cpuhrsch requested review from albanD and kulinseth October 31, 2024 22:21
@cpuhrsch cpuhrsch added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Oct 31, 2024
hvaara and others added 3 commits November 2, 2024 23:40
Co-authored-by: Nikita Shulga <2453524+malfet@users.noreply.github.com>
@hvaara hvaara requested a review from malfet November 2, 2024 22:47
@qqaatw qqaatw added release notes: mps Release notes category ciflow/trunk Trigger trunk jobs on your pull request labels Nov 8, 2024
@hvaara
Copy link
Contributor Author

hvaara commented Nov 14, 2024

@malfet is this good to go?

Copy link
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

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

LGTM

@malfet
Copy link
Contributor

malfet commented Nov 20, 2024

@pytorchbot merge -i

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: pull / cuda12.1-py3.10-gcc9-sm75 / test (pr_time_benchmarks, 1, 1, linux.g4dn.metal.nvidia.gpu)

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
This PR adds support for bf16 autocast. Most of the code and ideas are copied from pytorch#99272.

Most of the heavy lifting was done by AI.

Fixes pytorch#139386

Pull Request resolved: pytorch#139390
Approved by: https://github.com/malfet

Co-authored-by: Kulin Seth <kulin_seth@apple.com>
Co-authored-by: Nikita Shulga <2453524+malfet@users.noreply.github.com>
@hg0428
Copy link

hg0428 commented Feb 18, 2025

What happened here?
What's the progress?
How do I use autocast with MPS?

@hvaara
Copy link
Contributor Author

hvaara commented Feb 18, 2025

@hg0428 The PR was merged to main in bc69a19, and is available in stable since v2.6.0. PyTorch's merge process is handled oob which is why the PR is closed on GitHub.

For a primer on how to use autocast please see https://pytorch.org/docs/stable/amp.html and https://pytorch.org/docs/stable/notes/amp_examples.html. If it's still not clear, please ask on https://discuss.pytorch.org/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged module: amp (automated mixed precision) autocast open source release notes: mps Release notes category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MPS] Extend autocast support to bf16

7 participants