-
Notifications
You must be signed in to change notification settings - Fork 244
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
Optimize spirv-builder
clean build wall time
#858
Comments
Did an experiment to switch to Wall time benefit was just ~1 second though, but would enable real gains if one also finds a way not have |
This comment was marked as outdated.
This comment was marked as outdated.
You could split rustc_codegen_spirv into an rlib containing the actual implementation and a dylib which only depends on the rlib. The rlib will participate in pipelined compilation and the dylib will wait for all dependencies to have fully compiled before doing the final link. It may also be possible to move just the code using spirv-tools to the dylib, allowing most of the code of cg_spirv to be compiled at the same time as spirv-tools-sys. |
ah that is an interesting idea and approach, what do you think of the feasibility of that @eddyb ? |
Ahh I always forget about how dylibs behave just like executables, and the current state of pipelining - it makes sense in the grand scheme of there being no good way (yet) to block What @bjorn3 is suggesting is basically "emulate what should happen, with today's tools" and we should probably do that. If @oisyn wants to tackle this, a first approximation could be as simple as:
For @bjorn3's complete suggestion, I'm guessing this needs to go in the dylib: rust-gpu/crates/rustc_codegen_spirv/src/lib.rs Lines 515 to 561 in 105cbcc
With that |
We should look into improve our clean build times of when building
spriv-builder
&rustc_codegen_spirv
as that is the main scenario in CI and also useful for users if our crates rebuild fast.Right now it looks like we have a couple of quite unfortunate serial dependencies that significantly increases the wall time. Here is the current results with
cargo build --release -p spirv-builder -Z timings
on my AMD 5950x (32 vCPU):Potential optimizations
spirv-builder
be the one depending onspirv-tools
instead ofrustc_codegen_spirv
?serde
, quite crazy it takes 20 seconds to compileModuleResult
output and then the internal decorations that is using more complex serde implementation (CustomDecoration
).serde
+serde_json
is taking such a crazy long time to build here though, can't see any other crates enabling tons of types that serde derive macros are used on or similarModuleResult
would be trivial to replace serde withnanoserde
, could work forCustomDecoration
also?nanoserde
instead ofserde
#860sanitize-filename
dependency that compiles and usesregex
crate for super trivial thingsrspirv
itself somehow?rspirv
repo as far as I could seeDetermine whyreport.rustc_codegen_spirv
is not split in frontend/codegen sections in the profilespriv-builder
itself to start building earlier and before the codegen ofrustc_codegen_spirv
is done.dylib
If we do get rid of serde and manage to make sure
rustc_codegen_spirv
doesn't have to wait for thespirv-tools-sys
build, we could get get a 15+ second wall time improvement here asrustc_codegen_spirv
could start as soon as frontend section ofrspirv
has been built:-
The text was updated successfully, but these errors were encountered: