Skip to content
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

Cross compile TorchVision for Apple M1 #5171

Closed
malfet opened this issue Jan 6, 2022 · 1 comment
Closed

Cross compile TorchVision for Apple M1 #5171

malfet opened this issue Jan 6, 2022 · 1 comment

Comments

@malfet
Copy link
Contributor

malfet commented Jan 6, 2022

🚀 The feature

PyTorch cross-compiles nightly binaries for M1 for a while now, it's a pity that torchvision for M1 is not available in nightlies yet

Motivation, pitch

It should be pretty simple - just add a CI workflow that downloads M1 package (actually even x86_64 one will do, as symbols should be identical) and compiles it by passing "-arch arm64" option, i.e. something along those lines:

% git diff
diff --git a/setup.py b/setup.py
index a62895d76..f211411e4 100644
--- a/setup.py
+++ b/setup.py
@@ -181,7 +181,7 @@ def get_extensions():
 
     define_macros = []
 
-    extra_compile_args = {"cxx": []}
+    extra_compile_args = {"cxx": ["-arch", "arm64"]}
     if (torch.cuda.is_available() and ((CUDA_HOME is not None) or is_rocm_pytorch)) or os.getenv(
         "FORCE_CUDA", "0"
     ) == "1":

Alternatives

Keep building torchvision manually at irregular cadence

Additional context

No response

cc @seemethere

@malfet
Copy link
Contributor Author

malfet commented May 30, 2022

Closing, as we can compile natively

@malfet malfet closed this as completed May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants