Add back extension suffix for portable lib shared object in pip wheel (#6363)
Summary: Initially our portable lib prebuilt library is named as: ``` _portable_lib.cpython-310-x86_64-linux-gnu.so ``` Where it includes an `EXT_SUFFIX` `cpython-310-x86_64-linux-gnu` consists of architecture and build OS information. This is enforced by `setuptools` following PEP 3149 and there's no good way to change this behavior. https://github.com/pytorch/executorch/issues/5961 was an attempt to rename the .so filename at **packaging** stage to `_portable_lib.so`, so that it is easier to be found by `find_package()` macro in CMake. However https://github.com/pytorch/executorch/issues/5961 is breaking the other prebuilt libraries such as `libcustom_ops_aot_lib.so` which depends on the original `_portable_lib.cpython-310-x86_64-linux-gnu.so` name in its RPATH. This PR is a fix that reverts https://github.com/pytorch/executorch/issues/5961 and restore the full name during packaging, but try to match the `EXT_SUFFIX` in CMake to be able to find the .so file. Pull Request resolved: https://github.com/pytorch/executorch/pull/6363 Test Plan: ```bash EXECUTORCH_BUILD_PYBIND=ON python setup.py bdist_wheel # build wheel including _portable_lib.*.so pip install dist/executorch-0.5.0a0+7510f8c-cp310-cp310-linux_x86_64.whl python -c "from executorch.extension.llm.custom_ops import sdpa_with_kv_cache" # Run torchao script to make sure find_package() works push ao/torchao/experimental bash build_torchao_ops.sh executorch ``` Does not throw `_portable_lib.cpython-310-x86_64-linux-gnu.so` not found error. Reviewed By: kirklandsign Differential Revision: D64635137 Pulled By: larryliu0820 fbshipit-source-id: 7e54ea15361ae63acb8324538ea4982e95d6f07a
M
Mengwei Liu committed
b3932c028dfe9645e4162784bbf8b9d8926bf223
Parent: 4d7b294
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 10/19/2024, 1:32:35 AM