Skip to content

Enable RBE again - #1275

Closed
buchgr wants to merge 1 commit into
iree-org:masterfrom
buchgr:fix-rbe
Closed

buchgr wants to merge 1 commit into
iree-org:masterfrom
buchgr:fix-rbe

Conversation

@buchgr

@buchgr buchgr commented Mar 26, 2020

Copy link
Copy Markdown
Contributor

This is a workaround to use rbe_autoconfig with
--experimental_repo_remote_exec. It had to be disabled before due
to a naming conflict [1]. More information at [2].

[1] b5331d2
[2] bazelbuild/bazel#11029

@buchgr

buchgr commented Mar 26, 2020

Copy link
Copy Markdown
Contributor Author

@GMNGeoffrey

This should allow you to enable RBE until my patch in Bazel is released. I don't have access to your RBE cluster. Can you please test it?

@ScottTodd
ScottTodd requested a review from GMNGeoffrey March 26, 2020 19:44
@ScottTodd ScottTodd added bazel infrastructure Relating to build systems, CI, or testing labels Mar 26, 2020
@GMNGeoffrey

Copy link
Copy Markdown
Member

Seeing some errors. I can iterate locally on this if you'd like. Does it need a build file to find the patch?

INFO: Call stack for the definition of repository 'bazel_toolchains' which is a http_archive (rule definition at /tmpfs/tmp/bazel/external/bazel_tools/tools/build_defs/repo/http.bzl:292:16):
 - /tmpfs/src/github/iree/WORKSPACE:47:1
 - /tmpfs/src/github/iree/WORKSPACE:47:1
ERROR: An error occurred during the fetch of repository 'bazel_toolchains':
   Traceback (most recent call last):
	File "/tmpfs/tmp/bazel/external/bazel_tools/tools/build_defs/repo/http.bzl", line 83
		patch(ctx)
	File "/tmpfs/tmp/bazel/external/bazel_tools/tools/build_defs/repo/utils.bzl", line 139, in patch
		ctx.patch(patchfile, strip)
Unable to load package for //third_party:bazel_toolchains.patch: Package is considered deleted due to --deleted_packages
ERROR: no such package '@bazel_toolchains//rules': Traceback (most recent call last):
	File "/tmpfs/tmp/bazel/external/bazel_tools/tools/build_defs/repo/http.bzl", line 83
		patch(ctx)
	File "/tmpfs/tmp/bazel/external/bazel_tools/tools/build_defs/repo/utils.bzl", line 139, in patch
		ctx.patch(patchfile, strip)

@buchgr

buchgr commented Mar 26, 2020

Copy link
Copy Markdown
Contributor Author

Does it need a build file to find the patch?

yes. good catch!

@GMNGeoffrey

Copy link
Copy Markdown
Member

Does it need a build file to find the patch?

yes. good catch!

Would you mind also nesting the patch under a directory in third_party? I think we don't want files directly there. Alternatively, it could go in build_tools/bazel

This is a workaround to use rbe_autoconfig with
--experimental_repo_remote_exec. It had to be disabled before due
to a naming conflict [1]. More information at [2].

[1] iree-org@b5331d2
[2] bazelbuild/bazel#11029
@buchgr

buchgr commented Mar 26, 2020

Copy link
Copy Markdown
Contributor Author

Alternatively, it could go in build_tools/bazel

done. that's a better idea.

@GMNGeoffrey

Copy link
Copy Markdown
Member

Well it's successfully loaded the repo rule and is actually building, so looks likely this will pass (I'm able to see streamed logs by rooting around internally). Our caches are probably very cold, so it may take a bit longer than usual, but I think this should do it. Thanks!

@GMNGeoffrey

GMNGeoffrey commented Mar 26, 2020 •

Copy link
Copy Markdown
Member

Oh just realized that this doesn't actually turn rbe back on in the CI, just activates the config 🤦‍♂️ Lemme locally test that it fixed RBE, but this should be ok to merge regardless.

@GMNGeoffrey

GMNGeoffrey commented Mar 26, 2020 •

Copy link
Copy Markdown
Member

I just tried this out locally and am getting errors that it can't find "@rbe_default"

ERROR: While resolving toolchains for target //iree/compiler/Translation/SPIRV/XLAToSPIRV/test:broadcast_in_dim.mlir.test: com.google.devtools.build.lib.packa
ges.BuildFileNotFoundException: no such package '@rbe_default//config': The repository '@rbe_default' could not be resolved

https://source.cloud.google.com/results/invocations/6ce08933-7d38-47dd-839a-509ebcfb2bc4/targets

This is using the config defined in our bazelrc. Does that need to be updated as well? https://github.com/google/iree/blob/d572ef6dc87c54c43531de52d5c4ebf425ddc178/.bazelrc#L59-L105

@buchgr

buchgr commented Mar 27, 2020 •

Copy link
Copy Markdown
Contributor Author

@GMNGeoffrey Strange. What command are you running? Does bazel query @rbe_default//... work for you?

buchgr@buchgr:~/code/iree$ bazel query @rbe_default//...
DEBUG: /home/buchgr/.cache/bazel/_bazel_buchgr/d97ae01fae469033bd55c1fe00588c91/external/bazel_toolchains/rules/rbe_repo.bzl:477:5: Bazel 2.1.0 is used in rbe_default.
@rbe_default//java:jdk
@rbe_default//config:platform
@rbe_default//config:cc-toolchain
@rbe_default//cc:toolchain
Loading: 2 packages loaded

@GMNGeoffrey

GMNGeoffrey commented Mar 27, 2020 •

Copy link
Copy Markdown
Member

I'm running our build with --config=rbe. But actually trying again now that error is gone (bazel query also works). Maybe the bazel server needed to be restarted for some reason? I do see new RBE warning in the logs now though

WARNING: /usr/local/google/home/gcmn/.cache/bazel/_bazel_gcmn/151032d5e60e04f24eb0914f43c91bbf/external/remote_java_tools_linux/BUILD:671:1: in hdrs attribute
 of cc_library rule @remote_java_tools_linux//:combiners: Artifact 'external/remote_java_tools_linux/java_tools/src/tools/singlejar/zip_headers.h' is duplicat
ed (through '@remote_java_tools_linux//:transient_bytes' and '@remote_java_tools_linux//:zip_headers'). Since this rule was created by the macro 'cc_library',
 the error might have been caused by the macro implementation   

Also, it seems that RBE is using a different set of copts than our normal build because it's hitting errors in glslang and other external deps that I'm not seeing without it. We do want to turn on -Werror in our OSS build anyway (#236 warning spam sucks), but we can't quite do that yet. We'll also need to make it treat our third_party deps as system headers, since we're not going to go spelunking for strict errors in glslang... I wonder if these have crept in since we turned off RBE?
With RBE: https://source.cloud.google.com/results/invocations/7f5e4882-ece6-4af9-b62e-79a5eb78c3cf
With local disk cache: https://source.cloud.google.com/results/invocations/adf07108-43cc-412e-b977-90420b06d028

It might be easier to deal with #236 first, although it would be nice to just get rbe working again...

@GMNGeoffrey

Copy link
Copy Markdown
Member

But anyway I think this fixes the flag conflict problem and makes it possible to build with RBE even if building with RBE now fails :-( I'll go ahead and merge it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Relating to build systems, CI, or testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants