Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upEnable codegen_units in dev builds #12297
Conversation
|
@bors-servo r+ Do you have numbers for how much 4 units affects performance? |
|
|
|
I wasn't able to tell any difference in the performance of the dev build with and without codegen, but it's pretty bad to start with :-) |
Enable codegen_units in dev builds <!-- Please describe your changes on the following line: --> r? @metajack This re-enables the use of `codegen-units` on dev builds, which should be fine because dev's perf is already atrocious anyway. The difference on my i7 iMac: full build goes from 6m 30s to 6m rebuild of just the script crate goes from 3m25s to 2m45s --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12297) <!-- Reviewable:end -->
|
|
|
@alexcrichton @brson Would you expect that using
|
|
@larsbergstrom I'd expect more Rust symbols to show up, but not symbols like that... Also the other rust symbols should in theory just be impl details. Weird! |
|
I have one theory for the extra native symbols. With more codegen units there are fewer inlining opportunities, fewer interprocedural optimizations, so some opportunities to completely eliminate unused Rust functions may have been lost. Those functions may pull in other non-Rust symbols that the linker can't remove. |
|
@brson @alexcrichton Aha, thanks, that makes sense! On other platforms, this isn't as big of a deal, but specifically on Android the loader resolves all external symbols for the transitive dependency graph immediately upon load of a dylib. So, I may just have to switch this cargo config to be only for dev builds that are not Android (where we check for unanticipated symbol references). |
|
Can we not fix the bad linking? It sounds like this may just be exposing errors in our link setup? Sounds like under @brson's theory we are not linking libs which we have code that calls because they got removed due to inlining before. |
|
We have a lot of problems with this, in general. Basically, we have FFI crates that wrap all the C functions from underlying libraries. We're then at the mercy of the linker toolchain to "notice" that those Rust wrappers are never called or that the Rust code that calls those Rust wrappers is never called and then discard them. I'm open to other linker flags we could be passing, but this has been the bane of my Android linking existence for a long time (and is why we have the script to check for new symbols, because it's so easy to mess up, since linkers are super fragile here). |
|
Another thought. If you are doing regression testing based on the symbol tables, and codegen-units indeed affects the symbols, then you may find yourself running into spurious errors if the mechanism for selecting codegen units is non-deterministic (as it more-or-less was at one time). It's possible that with incremental compilation changes the codegen units are picked deterministically though. @michaelwoerister would know. |
|
I don't think that there is anything non-deterministic in codegen unit selection. At some point, due to a bug, symbol names for monomorphizations where non-deterministic but that has been fixed. So I'm pretty sure that compiling the same codebase twice will result in the same symbols showing up in the same codegen units. |
|
@bors-servo try |
|
@bors-servo r- try clean force |
|
|
larsbergstrom commentedJul 6, 2016
•
edited
r? @metajack
This re-enables the use of
codegen-unitson dev builds, which should be fine because dev's perf is already atrocious anyway. The difference on my i7 iMac:full build goes from 6m 30s to 6m
rebuild of just the script crate goes from 3m25s to 2m45s
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is