Repository navigation
Description
TF is now on Bazel 3.1.0. We're still on 2.1.0. I think we should upgrade for a few reasons:
- To match TF
- It includes a fix that allows us to build with asan (see Add config to build with asan #2490)
We'll need to upgrade the bazel version in our bazel docker container as well. Probably best to start out by installing both and then remove the old version once everything is switched over.
Issues I've run into so far with just naively upgrading:
-
We have to upgrade bazel_toolchains as well, which means updating our super hacky patch of the bazel toolchains file (https://github.com/google/iree/blob/8078fc65b32bff36e65f919a4b8f9c331fab7726/build_tools/bazel/bazel_toolchains.patch) because make --experimental_repo_remote_exec compatible with rbe_autconfig bazelbuild/bazel#11029 still isn't submitted. I figured out how to do that by manually re-creating the changes there 🤮
-
There's something going on with the rbe toolchain config that I don't quite understand. I think it might require updating the hash passed to rbe_autoconfig
DEBUG: /usr/local/google/home/gcmn/.cache/bazel/_bazel_gcmn/c17d50ae90e3b490378de262a2ee1611/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:185:13: rbe_default not using checked in configs; config struct(config_repos = [], create_cc_configs = True, create_java_configs = True, env = {"ABI_LIBC_VERSION": "glibc_2.19", "ABI_VERSION": "clang", "BAZEL_COMPILER": "clang", "BAZEL_HOST_SYSTEM": "i686-unknown-linux-gnu", "BAZEL_TARGET_CPU": "k8", "BAZEL_TARGET_LIBC": "glibc_2.19", "BAZEL_TARGET_SYSTEM": "x86_64-unknown-linux-gnu", "CC": "clang", "CC_TOOLCHAIN_NAME": "linux_gnu_x86"}, java_home = "/usr/lib/jvm/java-8-openjdk-amd64", name = "10.0.0") was picked/selected, Bazel version 3.1.0 was picked/selected but no checked in config was found in ["11.0.0"]
-
We're running into obnoxious TF toolchain errors again about numpy (Building TF requires Numpy for Python2 #1737).
Details
Repository rule local_python_configure defined at:
/usr/local/google/home/gcmn/.cache/bazel/_bazel_gcmn/c17d50ae90e3b490378de262a2ee1611/external/org_tensorflow/third_party/py/python_configure.bzl:275:26: in
ERROR: An error occurred during the fetch of repository 'local_execution_config_python':
Traceback (most recent call last):
File "/usr/local/google/home/gcmn/.cache/bazel/_bazel_gcmn/c17d50ae90e3b490378de262a2ee1611/external/org_tensorflow/third_party/py/python_configure.bz
l", line 213
_get_numpy_include(<2 more arguments>)
File "/usr/local/google/home/gcmn/.cache/bazel/_bazel_gcmn/c17d50ae90e3b490378de262a2ee1611/external/org_tensorflow/third_party/py/python_configure.bz
l", line 187, in _get_numpy_include
execute(repository_ctx, <3 more arguments>)
File "/usr/local/google/home/gcmn/.cache/bazel/_bazel_gcmn/c17d50ae90e3b490378de262a2ee1611/external/org_tensorflow/third_party/remote_config/common.b
zl", line 208, in execute
fail(<1 more arguments>)
Problem getting numpy include path.
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'numpy'
Is numpy installed?
Activity
GMNGeoffrey commentedon Jul 12, 2020
#2496 is my draft of doing this. It solves Problem 1, but not 2&3.
GMNGeoffrey commentedon Jul 12, 2020
I think problem 3 actually comes from the bazel_toolchains upgrade, not the bazel upgrade, per se. Going back to bazel 2.1.0 but keeping the toolchains upgrade also creates the issue.
GMNGeoffrey commentedon Jul 12, 2020
Running
pip3 install numpyon my local workstation appears to have fixed 3GMNGeoffrey commentedon Jul 12, 2020
A new issue. Trying to actually build with rbe
$ bazel test --config=rbe --config=rs //iree/vm:list_test
https://source.cloud.google.com/results/invocations/24c8b008-3bf8-492a-816a-38d57f346ebf
This one actually appears to be dependent on the bazel version, as does issue 2 above. If I downgrade back to Bazel 2.1.0 the build passes
https://source.cloud.google.com/results/invocations/7d01df42-a0c0-4675-95a0-0d74a9feed52
So I'm guessing this is actually caused by the "checked in config" issue.
GMNGeoffrey commentedon Jul 12, 2020
Ah nevermind. It's caused by my user not being in the docker group. So fixed that one. I still see the warning about the checked in config, but appear to be able to run with RBE and Bazel 3.1.0
https://source.cloud.google.com/results/invocations/ca57770b-6be6-4120-805f-d479f73432a5
GMNGeoffrey commentedon Jul 13, 2020
Ok I think I may have figured out the issue with that warning. RBE and Bazel have some complicated (undocumented) mapping logic to choose compatible versions. The RBE toolchain container I chose to upgrade to is for a later version of Bazel, so I have to use an earlier version, which I can figure out by reversing several map lookups in https://github.com/bazelbuild/bazel-toolchains/blob/df08996080601f04eeae7bd519b5126845928073/configs/ubuntu16_04_clang/versions.bzl
GMNGeoffrey commentedon Jul 13, 2020
Ah except that's a pinned link. I actually need to look at it for the release we're using: https://github.com/bazelbuild/bazel-toolchains/blob/3.1.2/configs/ubuntu16_04_clang/versions.bzl
GMNGeoffrey commentedon Jul 13, 2020
And there are 6 options to choose from. Great.
GMNGeoffrey commentedon Jul 13, 2020
Ah wait. I can update to a later version of bazel_toolchains and now it works. Unclear why
GMNGeoffrey commentedon Jul 13, 2020
Scott has suggested trying a later version of Bazel to get bazelbuild/bazel@8b9f746. We need at least 3.3, and I'd be inclined to get the later patch, so 3.3.1. Looks like TF will accept any 3.x, so that should be fine. We could also go all the way to 3.4.0.
GMNGeoffrey commentedon Jul 13, 2020
Looks like bazel_toolchains doesn't support 3.4 yet. 3.3.1 it is!
[-]Upgrade to Bazel 3.1.0[/-][+]Upgrade Bazel[/+]Add Bazel 3.3.1 to docker images (#2497)
Update Bazel to 3.3.1 (#2496)
Fix layering and turn on layering_check
Fix layering and turn on layering_check (#2540)