-
Notifications
You must be signed in to change notification settings - Fork 607
Fix wheel build and smoke test #4429
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/4429
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (2 Unrelated Failures)As of commit 371b022 with merge base 76f0b61 ( UNSTABLE - The following jobs failed but were likely due to flakiness present on trunk and has been marked as unstable:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Also need to fix rpath for custom_ops |
@kirklandsign has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@kirklandsign has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
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.
This is looking so much better! Thank you for figuring out the dependency stuff.
CMakeLists.txt
Outdated
@@ -755,6 +753,16 @@ if(EXECUTORCH_BUILD_PYBIND) | |||
# the torch libs are in `site-packages/torch/lib`. | |||
BUILD_RPATH "@loader_path/../../../torch/lib" | |||
INSTALL_RPATH "@loader_path/../../../torch/lib" | |||
BUILD_RPATH "@loader_path/../../" |
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.
Please add a comment explaining these two new RPATH lines, since the "site-packages/torch-lib" comment doesn't apply to them.
CMakeLists.txt
Outdated
portable_lib | ||
PROPERTIES # Assume that this library will be installed in | ||
# `site-packages/executorch/extension/pybindings`, and that | ||
# the custom_ops_aot_lib should be found with relative path. |
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.
Does this mean that custom_ops_aot_lib.so will be installed in the root of the executorch pip package? I'd rather install it in the same directory as portable_lib, or under something like /data/lib.
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.
it should be under site-packages/executorch/extension/llm/custom_ops/
setup.py
Outdated
"executorch", | ||
) | ||
) | ||
ext_modules.append( | ||
# Install the prebuilt library for quantized ops required by custom ops. | ||
BuiltFile( | ||
"kernels/quantized/libquantized_ops_aot_lib.*", | ||
"executorch", |
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.
The second arg to BuiltFile is the name of the destination file or directory. If the intent is to install to a directory, then the destination should end in a /
character. But please see if "executorch/data/lib/" works: that would address my comment above about not installing these in the root of the pip package, though you'd also need to update the RPATH. Or you could try setting the dest to executorch/extension/pybindings/
so that the libs end up in the same directory as _portable_lib.so.
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.
Your script works! Yes the trailing /
makes a difference
@kirklandsign has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@kirklandsign has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
extension/pybindings/portable_lib.py
Outdated
try: | ||
from pathlib import Path | ||
libs = list(Path(__file__).parent.parent.parent.resolve().glob("**/libquantized_ops_aot_lib.*")) | ||
del Path | ||
assert len(libs) == 1, f"Expected 1 library but got {len(libs)}" | ||
_torch.ops.load_library(libs[0]) | ||
except: | ||
pass | ||
|
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.
@kirklandsign has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@kirklandsign has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
kernels/quantized/__init__.py
Outdated
|
||
libs = list( | ||
Path(__file__) | ||
.parent.parent.parent.resolve() |
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.
Ideally the so file should just under the same directory.
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.
I see. I copied to the same directory so Path(file).parent should be good.
@kirklandsign has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
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.
The latest changes look good.
Please update the PR description with a Test Plan:
section explaining how you have been testing all of this. It will be very useful to have the next time we need to mess with wheel issues.
@kirklandsign has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@kirklandsign has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@kirklandsign merged this pull request in bf477e4. |
Summary: Pull Request resolved: pytorch#4429 Test Plan: 1. Label `ciflow/binaries` to build wheel 2. CI and OSS CI. This makes sure that smoke test can pass, and a portable model can export and run E2E. Python 3.9 is not supported for now. 3. Run these helps validate unittest failure for quantized ops ``` pip uninstall executorch -y rm dist/*.whl source build/packaging/env_var_script_m1.sh # or Linux python setup.py bdist_wheel pip install dist/*.whl ``` Then in Python, try ``` from executorch.extension.pybindings import portable_lib from executorch.exir.dialects._ops import ops import executorch.kernels.quantized ops.edge.quantized_decomposed.add.default.to_out_variant().name() ``` Reviewed By: larryliu0820 Differential Revision: D60694247 Pulled By: kirklandsign fbshipit-source-id: 4da77493c0e7a868f86b583c9c33d54d08c3e48b
Test Plan:
ciflow/binaries
to build wheelThen in Python, try