Avoid ever building rustc_codegen_spirv more than once in release mode. #546
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.
This PR allows these 3 commands to share the same
rustc_codegen_spirv
build (this also meansspirv-tools-sys
also only compiles all the C++ code only once, which can itself take a significant amount of time):Sadly, I'm not aware of relevant automation (though one could already exist), but here's what I found:
syn
(used byserde_derive
->serde
->rustc_codegen_spirv
)libc
(used byjobserver
->cc
->spirv-tools-sys
->rustc_codegen_spirv
)hashbrown
(used byindexmap
->rustc_codegen_spirv
)num_traits
(used byrspirv
->rustc_codegen_spirv
)tests/Cargo.toml
(cargo compiletest
) didn't have the system ofuse-{installed,compiled}-tools
features thatspirv-builder
has, resulting in an extra--cfg 'feature="default"'
passed when buildingrustc_codegen_spirv
[profile.release.build-override]
containscodegen-units = 16
, and that is the default for release mode except the actual default is baked intorustc
, so Cargo doesn't actually normally pass it in release modeI'm not really happy with just fixing it right now, we should try to come up with a test for "did we waste time building
everythingsome things twice" (e.g. checking thetarget
dir for multiple copies of some crates?).But I don't even think we build anything (other than
cargo compiletest
) in release mode on CI.We did try release mode CI in #494, but it took longer and I now think it might be the duplication.
Since we're already running
cargo compiletest
on CI, I suspect that if we land this PR we should be able to move to release mode, and see a benefit. In fact I might just test that myself once we have data for this PR itself.