build: fix installation failures of dependencies for macOS#4504
Open
felixtensor wants to merge 2 commits intollvm:mainfrom
Open
build: fix installation failures of dependencies for macOS#4504felixtensor wants to merge 2 commits intollvm:mainfrom
felixtensor wants to merge 2 commits intollvm:mainfrom
Conversation
Add platform-specific dependency declarations for torch and torchvision. This aligns with PyTorch's upstream wheel naming convention, where macOS builds are published to PyPI without a local version specifier, while Linux and Windows CPU builds carry the +cpu suffix (e.g., 2.x.x+cpu) in PyTorch's dedicated WHL index. Use versions with the +cpu suffix on Linux and Windows, and versions without this suffix on macOS, to accommodate the pre-built package naming conventions across different platforms. - [Ref](pytorch/pytorch#110004)
The LTC backend was built with Linux-only linker flags on all platforms, so it never actually worked on macOS. Fix this by using platform-specific properties in CMakeLists: - On macOS: drop the hardcoded SUFFIX ".so" and swap -rdynamic for -undefined dynamic_lookup, so PyTorch symbols (FLAGS_torch_lazy_* etc.) are resolved at load time through the host Python process. - Use @loader_path instead of $ORIGIN in reference_lazy_backend rpath, since $ORIGIN is Linux-only. Also expand the autogen LTC op blacklist with a handful of ops that broke codegen against recent PyTorch: rrelu_with_noise and _assert_tensor_metadata changed return types, and a few scalar/metadata-only ops were never meaningful to lower through LTC anyway. While at it, bring the macOS packaging scripts up to date: - Python 3.9 dropped, add 3.12. - build_macos_packages.sh now picks up Python from the active environment (conda, pyenv, brew) rather than hard-requiring a python.org Framework install. Falls back to /Library/Frameworks for CI. CMAKE_OSX_ARCHITECTURES now defaults to the host arch instead of a fat binary. - install_macos_deps.sh: switch PYTHON_SPECS to a version-keyed map, fix a zsh word-splitting bug that silently broke multi-version installs, clean up .pkg files after install. - Remove build_upload_m1_snapshot.sh, which has been dead since GH Actions gained arm64 runners.
46b7dee to
3ea2dfb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add platform-specific dependency declarations for torch and torchvision to fix installation failures of dependencies on macOS. This aligns with PyTorch's upstream wheel naming convention, where macOS builds are published to PyPI without a local version specifier, while Linux and Windows CPU builds carry the +cpu suffix (e.g., 2.x.x+cpu) in PyTorch's dedicated WHL index. Use versions with the +cpu suffix on Linux and Windows, and versions without this suffix on macOS, to accommodate the pre-built package naming conventions across different platforms.