-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
--distinct_host_configuration=false causes conflicting actions on bazel test --test_arg #14848
Comments
Hi @aherrmann . I hear your point. Addressing this is a bit nuanced since we're basically deprecating For that reason I'm not going to prioritize this issue. But I'd love to hear what value For what it's worth, going forward we'd like to provide other mechanisms to offer the benefits |
As far as I know, TensorFlow also uses See https://cs.opensource.google/tensorflow/tensorflow/+/master:.bazelrc;l=361-364 |
@gregestren It's to avoid duplicate builds of the same targets to reduce build times. The use-case is the daml repository. One of the main components in this repository is a compiler which is both built for |
@aherrmann That's a very similar use case as TensorFlow. Not sure if we can make Bazel share action cache between host and exec config when the configuration are essentially the same? |
@meteorcloudy Thanks for the reference, that's good to know.
This sounds related to the wider issue in #13281. I'm not sure if this is possible in this case. If it were, then, yes, it may well avoid the duplicate builds. |
I got the same error in Tensorflow in these days: It's really very sneaky |
I think 78d0fc9 is going to be a big performance regression for TensorFlow if they switch to Bazel 6.0 since it'll essentially cause most things to be built twice |
CC @learning-to-play, as this might be needed to be an FYI ahead of time |
This didn't matter because we have --distinct_host_configuration=true enabled for Windows, but this flag is an no-op with Bazel@HEAD, see bazelbuild/bazel#14848 (comment) Fixes #56755 PiperOrigin-RevId: 460956334
@meteorcloudy acknowledged. What's the best way for us to evaluate the concern? Can anyone else help frame the problem? I don't know what the right tool is in our arsenal to address this (there could be a few). But I'm certainly not interested in regressions a major project. |
In case this is helpful as a data point, we found that 18% of a typical build at Stripe was targets being built a second time in host configuration (before/after being built in target configuration). |
@gregestren The problem is when the host and target platforms are the same, TensorFlow uses --distinct_host_configuration=false to avoid recompiling 80% of the entire build for host configuration, but after 78d0fc9 this no longer works. So the question is basically: is there a new way to tell Bazel host and target platform can use the same toolchain and cache can also be shared? |
Since the exec configuration uses both different flag defaults (e.g. compilation mode and cflags) and a different output directory, it differs substantially from the target configuration. I thus wouldn't expect future solutions to #13281 and related issues to have any impact on the problem TensorFlow is facing.
There is a code path that makes the exec configuration behave like this, but I don't know whether or how it can be triggered. On https://github.com/fmeum/bazel/tree/distinct-exec-configuration, I added a |
One of the problems here is that tensorflow makes the assumption that the host platform is the target platform. This is a mistaken use of the option
and explicitly build with |
Oh, so that's what that option does (I still have a TODO to document/remove it). I guess the path forward is to remove and move to |
Interesting, I am already doing some tests to dial in TensorFlow's RBE usage. I will throw in some tests to see the full impact of |
Doubling back on this before i forget, the removal of the |
@fmeum Thanks for pointing out that! I think that sounds like the solution. |
@sdtwigg is the expert on this. |
Compile substantially all of workerd in the bazel 'target' configuration instead of 'exec', which allows us to avoid compiling major components twice. This should offer a large performance improvement, especially when rebuilding after a V8 update or building all targets and drive down the worst-case CI build time significantly. Bazel supports an exec configuration for building code that needs to run on the host machine during the build, e.g. tools used to generate source files or type definitions. When not cross-compiling exec and target will be the same, but bazel does not offer a flag to use just one configuration when the configurations are identical (bazelbuild/bazel#14848), making manual changes necessary. Bazel appears to offer no way to detect if exec and host are the same, so this feature is implemented through an opt-in command line flag enabled in .bazelrc, which makes it possible to easily disable the change when cross-compilation support is needed.
Compile substantially all of workerd in the bazel 'target' configuration instead of 'exec', which allows us to avoid compiling major components twice. This should offer a large performance improvement, especially when rebuilding after a V8 update or building all targets and drive down the worst-case CI build time significantly. Bazel supports an exec configuration for building code that needs to run on the host machine during the build, e.g. tools used to generate source files or type definitions. When not cross-compiling exec and target will be the same, but bazel does not offer a flag to use just one configuration when the configurations are identical (bazelbuild/bazel#14848), making manual changes necessary. Bazel appears to offer no way to detect if exec and host are the same, so this feature is implemented through an opt-in command line flag enabled in .bazelrc, which makes it possible to easily disable the change when cross-compilation support is needed.
Compile substantially all of workerd in the bazel 'target' configuration instead of 'exec', which allows us to avoid compiling major components twice. This should offer a large performance improvement, especially when rebuilding after a V8 update or building all targets and drive down the worst-case CI build time significantly. Bazel supports an exec configuration for building code that needs to run on the host machine during the build, e.g. tools used to generate source files or type definitions. When not cross-compiling exec and target will be the same, but bazel does not offer a flag to use just one configuration when the configurations are identical (bazelbuild/bazel#14848), making manual changes necessary. Bazel appears to offer no way to detect if exec and host are the same, so this feature is implemented through an opt-in command line flag enabled in .bazelrc, which makes it possible to easily disable the change when cross-compilation support is needed.
Compile substantially all of workerd in the bazel 'target' configuration instead of 'exec', which allows us to avoid compiling major components twice. This should offer a large performance improvement, especially when rebuilding after a V8 update or building all targets and drive down the worst-case CI build time significantly. Bazel supports an exec configuration for building code that needs to run on the host machine during the build, e.g. tools used to generate source files or type definitions. When not cross-compiling exec and target will be the same, but bazel does not offer a flag to use just one configuration when the configurations are identical (bazelbuild/bazel#14848), making manual changes necessary. Bazel appears to offer no way to detect if exec and host are the same, so this feature is implemented through an opt-in command line flag enabled in .bazelrc, which makes it possible to easily disable the change when cross-compilation support is needed.
Compile substantially all of workerd in the bazel 'target' configuration instead of 'exec', which allows us to avoid compiling major components twice. This should offer a large performance improvement, especially when rebuilding after a V8 update or building all targets and drive down the worst-case CI build time significantly. Bazel supports an exec configuration for building code that needs to run on the host machine during the build, e.g. tools used to generate source files or type definitions. When not cross-compiling exec and target will be the same, but bazel does not offer a flag to use just one configuration when the configurations are identical (bazelbuild/bazel#14848), making manual changes necessary. Bazel appears to offer no way to detect if exec and host are the same, so this feature is implemented through an opt-in command line flag enabled in .bazelrc, which makes it possible to easily disable the change when cross-compilation support is needed.
Compile substantially all of workerd in the bazel 'target' configuration instead of 'exec', which allows us to avoid compiling major components twice. This should offer a large performance improvement, especially when rebuilding after a V8 update or building all targets and drive down the worst-case CI build time significantly. Bazel supports an exec configuration for building code that needs to run on the host machine during the build, e.g. tools used to generate source files or type definitions. When not cross-compiling exec and target will be the same, but bazel does not offer a flag to use just one configuration when the configurations are identical (bazelbuild/bazel#14848), making manual changes necessary. Bazel makes it very difficult to set the config for a target at build time, so default to using cfg "target" globally for now.
Compile substantially all of workerd in the bazel 'target' configuration instead of 'exec', which allows us to avoid compiling major components twice. This should offer a large performance improvement, especially when rebuilding after a V8 update or building all targets and drive down the worst-case CI build time significantly. Bazel supports an exec configuration for building code that needs to run on the host machine during the build, e.g. tools used to generate source files or type definitions. When not cross-compiling exec and target will be the same, but bazel does not offer a flag to use just one configuration when the configurations are identical (bazelbuild/bazel#14848), making manual changes necessary. Bazel makes it very difficult to set the config for a target at build time, so default to using cfg "target" globally for now.
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
Description of the problem:
Enabling
--distinct_host_configuration=false
causes tests to fail to build when--test_arg
is set.Specifically, a
bazel test --test_arg=...
following abazel test
without--test_arg
set fails in this manner.The test succeeds if both commands do not set
--test_arg
or if both set the same--test_arg
.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Make sure to have
bazelisk
installed and run the following script in an empty directory.Note, this seems to be a regression. Using Bazel version 4.2.2 instead of 5.0.0 does not trigger this issue.
What operating system are you running Bazel on?
Ubuntu 21.04
What's the output of
bazel info release
?release 5.0.0
Any other information, logs, or outputs that you want to share?
This issue was discovered here and then stripped down to a minimal repro.
The text was updated successfully, but these errors were encountered: