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

macOS_arm64 build #1302

Closed
simonmaurer opened this issue Feb 16, 2021 · 5 comments
Closed

macOS_arm64 build #1302

simonmaurer opened this issue Feb 16, 2021 · 5 comments

Comments

@simonmaurer
Copy link
Contributor

simonmaurer commented Feb 16, 2021

hi y'all

with the aim of compiling the benchmark_model in TF (as this depends on XNNPACK) on commit c2db3a8fae0f6558e9dbdee79e67e74c1e95981c I was trying to build the end2end_bench using bazel 4.0.0 (ARM64)

the docs state a macOS support for arm64, I assume this only holds true when using cmake.
so I added configs macos_arm64by updating .bazelrc, build_defs.bzl, cpuinfo.BUILD, BUILD.bazel and then run:

bazel build --config=macos_arm64 :end2end_bench

compiling with ios_arm64 as build config works fine. however not with macos_arm64 even though the macOS should be using the iOS kernels

could you give me a hint on how to build for platform macos_arm64 with bazel ? @Maratyszcza

@simonmaurer
Copy link
Contributor Author

any feedback with respect to this?

@Maratyszcza
Copy link
Contributor

Bazel build for ARM64 Mac is currently not supported. CMake build should work.

@simonmaurer
Copy link
Contributor Author

simonmaurer commented Feb 27, 2021

@Maratyszcza okay thanks for the feedback. issued a pull request in the official TensorFlow repo to allow building on platform macos_arm64 using cmake.

could you give me a hint on where to make changes to allow bazel builds ? already modified the following files:
bazel.rc, BUILD.bazel, build_defs.bzl, third_party/cpuinfo.BUILD, see the changes (inspired by this commit in the official TF repo)

@Maratyszcza
Copy link
Contributor

These changes should be sufficient

@simonmaurer
Copy link
Contributor Author

simonmaurer commented Mar 5, 2021

PR to resolve this.
allows compilation for macos_arm64on M1 host using:

bazel build -c opt --config=macos_arm64 :end2end_bench

cross compilation on other platforms (e.g. Linux or macOS_x86-64) does not work yet due to missing toolchains.
at least I get the following errors when building on a macOS_x86-64 platform for macos_arm64:

ERROR: /private/var/tmp/**/**/external/local_config_cc/BUILD:48:19: in cc_toolchain_suite rule @local_config_cc//:toolchain: cc_toolchain_suite '@local_config_cc//:toolchain' does not contain a toolchain for cpu 'darwin_arm64' INFO: Repository cpuinfo instantiated at: /**/**/**/**/xnnpack_simonmaurer/WORKSPACE:66:13: in <toplevel> Repository rule http_archive defined at: /private/var/tmp/**/**/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel> ERROR: Analysis of target '//:end2end_bench' failed; build aborted: Analysis of target '@local_config_cc//:toolchain' failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants