-
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
No-op transition causes dependencies to be rebuilt separately from default configuration #11196
Comments
I'll look into it. The code that adds the I'll confirm the current functionality in detail as the next step. |
If we can easily do this, I think it's possible by not calling bazel/src/main/java/com/google/devtools/build/lib/analysis/skylark/FunctionTransitionUtil.java Line 306 in 3262af8
buildOptionsToTransition.equals(buildOptions) or b) newValues is empty (if that's known).
CC @juliexxia if there's subtleties I'm missing. |
The only other thing I'll mention is I have some memory of BuildOptions.equals being an expensive operation and that causing slow downs in the past, relevant to verifying starlark transitions. I think in thatscenario (couldn't find the bug) multiple .equals were being called on every target, starlark transitioned or not, or something like that and this should only happen after transitions so it should be fine, but something to think about. |
cc @bazelbuild/configurability |
BuildOptions.equals caches its result, so it doesn't have to intrinsically be slow. But good point - it does deserve some profiling. If this is basically realistic this would be a great feature for us to implement. |
GitHub issue review: lowering this to P3 not because it doesn't matter but because no one is working on it at this moment. I still agree this is worth doing. And should offer nice value for a small amount of effort. We can up-prioritize this once we've figured out who can own doing it. |
I'm actively working on fixing this now |
Not having this logic in was leading to c++ action conflicts. Before this CL we naively hashed the map of options->values returned by a transition into the output directory fragment. Now we only update the output directory fragment if values actually change. In order to do this, we also need to add the default values of all the output options to the starlark options map (if they don't already have a non-default value in the map) to take care of the set-to-default case also being a no-op. Add a bunch of tests and delete tests that showed the undesirable behavior before. Also fixes #11196 TESTED: patch unknown commit && devblaze build //googlex/koi/... PiperOrigin-RevId: 327116054
Not having this logic in was leading to c++ action conflicts. Before this CL we naively hashed the map of options->values returned by a transition into the output directory fragment. Now we only update the output directory fragment if values actually change. In order to do this, we also need to add the default values of all the output options to the starlark options map (if they don't already have a non-default value in the map) to take care of the set-to-default case also being a no-op. Add a bunch of tests and delete tests that showed the undesirable behavior before. Also fixes bazelbuild#11196 TESTED: patch unknown commit && devblaze build //googlex/koi/... PiperOrigin-RevId: 327116054
Not having this logic in was leading to c++ action conflicts. Before this CL we naively hashed the map of options->values returned by a transition into the output directory fragment. Now we only update the output directory fragment if values actually change. In order to do this, we also need to add the default values of all the output options to the starlark options map (if they don't already have a non-default value in the map) to take care of the set-to-default case also being a no-op. Add a bunch of tests and delete tests that showed the undesirable behavior before. Also fixes #11196 TESTED: patch unknown commit && devblaze build //googlex/koi/... PiperOrigin-RevId: 327116054
Not having this logic in was leading to c++ action conflicts. Before this CL we naively hashed the map of options->values returned by a transition into the output directory fragment. Now we only update the output directory fragment if values actually change. In order to do this, we also need to add the default values of all the output options to the starlark options map (if they don't already have a non-default value in the map) to take care of the set-to-default case also being a no-op. Add a bunch of tests and delete tests that showed the undesirable behavior before. Also fixes #11196 TESTED: patch unknown commit && devblaze build //googlex/koi/... PiperOrigin-RevId: 327116054
Not sure if this is the right issue to comment on. When our transition becomes "no-op" (outputs simply forward the inputs), I'm getting the following type of errors:
I believe what is particular about our transition is that is has both scalar and list inputs (the C++ options). Do you think list inputs might be problematic here? Also let me know if I should file a separate issue for this case. |
Not having this logic in was leading to c++ action conflicts. Before this CL we naively hashed the map of options->values returned by a transition into the output directory fragment. Now we only update the output directory fragment if values actually change. In order to do this, we also need to add the default values of all the output options to the starlark options map (if they don't already have a non-default value in the map) to take care of the set-to-default case also being a no-op. Add a bunch of tests and delete tests that showed the undesirable behavior before. Also fixes bazelbuild/bazel#11196 TESTED: patch unknown commit && devblaze build //googlex/koi/... PiperOrigin-RevId: 327116054
Description of the problem / feature request:
Suppose we have an
x_binary
rule with an incoming edge transition, which can change build settings based on attributes. Most of the time the attributes are not set, so the transition makes no changes (output settings are identical to inputs).In cases where the transition makes no changes, Bazel should act as if no transition were applied. That is, if an
x_binary
depends on a file created by another target (x_library
), the file should only be generated once, whether thex_library
is a dependency ofx_binary
or thex_library
is built directly in the default configuration.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Here's a standalone workspace that reproduces this.
x_library
runsdate
and writes the output to a file.x_binary
just collects files.Building the binary produces one file:
Building the library produces a different file:
What operating system are you running Bazel on?
macOS 10.15.4
What's the output of
bazel info release
?release 3.0.0
The text was updated successfully, but these errors were encountered: