-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix our default fastbuild
Bazel config
#4363
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3b7664c
to
1d81741
Compare
Causes the default development (`fastbuild`) Bazel build and test to both use ASan, minimal optimizations, and produce good backtraces with source locations. This also fixes all of the non-host configs that were deeply broken for the latest releases of Bazel going back quite some time. The intent of our our Bazel toolchain config was for a minimally optimized, minimal debug info, and ASan + UBSan configuration to be the `fastbuild`, or the default development build of the project. This matches its inclusion of asserts, etc. At some point quite some time ago, all of this stopped working. Bazel no longer has a `nonhost` feature. This was disabled a long time ago, briefly argued to be re-enabled, but has persistently been removed. However, since then the host and non-host features have been separated including the compilation mode, and so none of that is needed now. Instead, we can use a much simpler and more principled approach to all of the feature configuration now which this PR implements. However, we added TCMalloc _after_ all of the ASan stuff became broken, and so we never saw that it is fundamentally incompatible with ASan. So this PR also reworks how TCMalloc is used to only apply to `-c opt` builds on Linux, and it also explicitly disables it when using `--config=asan`. I've not found a convenient way to tie the malloc library choice to a toolchain feature in Bazel, so this relies on the config being used rather than the feature in isolation. Last but not least, with this change `fastbuild` creates substantially larger output and so this change also passes several new flags to reduce the size costs. One is a general improvement from outlining ASan instrumentation. The others are in a special feature as they reduce the error message quality for two of the more expensive UBSan checks in favor of small generated code size. Keeping these last two separate allows disabling this locally if needed to debug a failure.
1d81741
to
3c61f68
Compare
FYI, this should be ready to go! =] |
josh11b
approved these changes
Oct 7, 2024
github-merge-queue bot
pushed a commit
that referenced
this pull request
Oct 25, 2024
AFAICT #4363 made builds of extract.cpp go from ~15s to ~35s. I'm not sure how to really improve on this, short of adding boilerplate to the types in order to reduce template use (e.g., instead of using struct reflection to return fields, we could have something that directly returns fields). But, this switch to `MaybeTrace` seems to be about a 20% build time improvement (down to ~30s), with `noinline` accounting for a part of that.
github-merge-queue bot
pushed a commit
that referenced
this pull request
Oct 30, 2024
https://bazel.build/rules/lib/core/dict#update indicates it returns `None`. Maybe this hasn't worked for a long time, and was missed due to the issue fixed by #4363
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Causes the default development (
fastbuild
) Bazel build and test to both use ASan, minimal optimizations, and produce good backtraces with source locations.This also fixes all of the non-host configs that were deeply broken for the latest releases of Bazel going back quite some time.
The intent of our our Bazel toolchain config was for a minimally optimized, minimal debug info, and ASan + UBSan configuration to be the
fastbuild
, or the default development build of the project. This matches its inclusion of asserts, etc.At some point quite some time ago, all of this stopped working. Bazel no longer has a
nonhost
feature. This was disabled a long time ago, briefly argued to be re-enabled, but has persistently been removed. However, since then the host and non-host features have been separated including the compilation mode, and so none of that is needed now. Instead, we can use a much simpler and more principled approach to all of the feature configuration now which this PR implements.However, we added TCMalloc after all of the ASan stuff became broken, and so we never saw that it is fundamentally incompatible with ASan. So this PR also reworks how TCMalloc is used to only apply to
-c opt
builds on Linux, and it also explicitly disables it when using--config=asan
. I've not found a convenient way to tie the malloc library choice to a toolchain feature in Bazel, so this relies on the config being used rather than the feature in isolation.Last but not least, with this change
fastbuild
creates substantially larger output and so this change also passes several new flags to reduce the size costs. One is a general improvement from outlining ASan instrumentation. The others are in a special feature as they reduce the error message quality for two of the more expensive UBSan checks in favor of small generated code size. Keeping these last two separate allows disabling this locally if needed to debug a failure.