-
Notifications
You must be signed in to change notification settings - Fork 273
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
Rules Apple Fails on Intel x86 Mac when using CpuInfo (Tensorflow) #1954
Comments
does pytorch/cpuinfo#139 fix this issue as well? I see your mention of it but does it work? maybe we could poke some folks to get it reviewed if so |
Yes that PR would fix the problem for anyone who will update to the version of tensorflow which will eventually contain the cpuinfo fix when it is merged. The problem would still exist retroactively for anyone using older versions of tensorflow (which would be on the older versions of cpuinfo that do not have that fix). I have written a post which shows both ways to patch the problem. The harder way is using the same technique that the cpuinfo MR uses and replicating it across all 3 places cpuinfo is referenced. This creates a double nested patch for tensorflow that consists of 3 patches itself and is quite cumbersome to maintain. |
FYI what change broke this? |
As noted by your comment, there are still 3 projects with open PRs that rely on the It will take a long time for the change from It may be okay to force the change from |
thanks for linking that other library, i submitted a fix there too google/ruy#331 im fine with merging your change, but i do think it would be worth trying to push the other real solutions at the same time, if nothing else it will block any future bazel upgrades until it's solved. |
MediaPipe is also affected by this: google-ai-edge/mediapipe#2324 |
Problem
If you are attempting to use any rule from
@build_bazel_rules_apple
on an Intel x86_64 Mac with anything that relies on the cpuinfo project (like Tensorflow) you will face the build error described by this mediapipe issue and this tensorflow issue.Root Cause
The root cause of the problem falls with the complex interplay between
cpuinfo
,tensorflow
,bazel
, and the@build_bazel_rules_apple library
. Bazel has reverted the default cpu value on x86 macOS to "darwin" in this commit.This means that bazel expects Intel x86_64 Macs to report their cpu as
darwin
.@build_bazel_rules_apple
will report the cpu asdarwin_x86_64
. This cpu does not exist in thecpuinfo
project as it expectsdarwin
. Although there is an unmerged pull request to fix this behavior, it is unlikely to be resolved soon.Solution
In order to fix the problem, I have created a patch so that the library can read the
host_cpu
value which will report asdarwin
on an Intel x86_64 Mac. If this value is present, it will returndarwin
instead ofdarwin_x86_64
.The Fix
It is necessary to add the
--incompatible_enable_apple_toolchain_resolution
flag to your build command and modify@build_bazel_rules_apple
with the following patch:The text was updated successfully, but these errors were encountered: