-
Notifications
You must be signed in to change notification settings - Fork 188
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
[2/2] Switch ao to use py_limited_api #1277
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/1277
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 1322f88 with merge base 2e032c6 (): This comment was automatically generated by Dr. CI and updates every 15 minutes. |
7001015
to
1afe0e3
Compare
1afe0e3
to
1322f88
Compare
@@ -139,4 +140,7 @@ def get_extensions(): | |||
long_description_content_type="text/markdown", | |||
url="https://github.com/pytorch-labs/ao", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove -labs
as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do as a separate PR, as that isn't related to this change
This PR enables torchao to build 1 python wheel across multiple python versions. How? Our previous PR #1276 replaced reliance on the torch_python/PYBIND11 API in favor of using torch.library to register custom ops. This means that ao's custom extensions are Python free now!
As a result, we can now safely make use of Python/setuptools
py_limited_api
flags to build a Python agnostic wheel by passing the right arguments into Extension and bdist_wheel. Though the core PR has landed: pytorch/pytorch#138088, torchao wheels are built on the stable release (2.5.1 for now) so torch_python.so will still be linked. I have tested locally that linking torch_python.so does not affect the wheel's python agnosticism, because torchao cuda extensions are python free and do not use anything from torch_python.This will have repercussions on built + released wheels and will change their names to, for example,
torchao-0.8.0-cp39-abi3-linux_x86_64.whl
and should be installable on linux_x86_64 across multiple Python versions.Why was this a draft?
I needed to figure out a plan to safely land this (aka test well) and now I'm confident we should land this. How did I test?
The above shows that the torchao wheel built with this change is python agnostic.