[Migrated] Optimize `spirv-builder` clean build wall time
Personne n'a encore pris cette issue.
- Langage dominant
- Rust
- Étoiles
- 3.4k
- Forks
- 126
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/858
Originally creatd by repi on 2022-04-10T11:01:16Z
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
- Could
spirv-builderbe the one depending onspirv-toolsinstead ofrustc_codegen_spirv?- I.e. move the responsibility of running spirv-opt/spirv-val and final linking to the builder.
- Does that sound like it could be doable @eddyb ?
- Remove/replace
serde, quite crazy it takes 20 seconds to compile- Think we only have two use cases, our
ModuleResultoutput and then the internal decorations that is using more complex serde implementation (CustomDecoration). - have no idea how
serde+serde_jsonis 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 similar ModuleResultwould be trivial to replace serde withnanoserde, could work forCustomDecorationalso?- #860
- Think we only have two use cases, our
- Remove/replace
sanitize-filenamedependency that compiles and usesregexcrate for super trivial things - Optimize builds of
rspirvitself somehow?- Unfortunate that it is so slow to build by itself but could be hard to fix and tons of types in it. No open issues on it in the
rspirvrepo as far as I could see
- Unfortunate that it is so slow to build by itself but could be hard to fix and tons of types in it. No open issues on it in the
-
Determine whyreport.rustc_codegen_spirvis not split in frontend/codegen sections in the profile- This would enable
spriv-builderitself to start building earlier and before the codegen ofrustc_codegen_spirvis done. - Update: This is not possible as it it needs to be built as a
dylib
- This would enable
If we do get rid of serde and manage to make sure rustc_codegen_spirv doesn't have to wait for the spirv-tools-sys build, we could get get a 15+ second wall time improvement here as rustc_codegen_spirv could start as soon as frontend section of rspirv has been built:
- 
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par exécuter cargo build --release -p spirv-builder -Z timings et examinez le temps des dépendances lors d’une compilation propre pour spirv-builder et rustc_codegen_spirv. Analysez les relations de dépendance impliquant spirv-tools, serde, serde_json, sanitize-filename, regex et rspirv ; le travail est terminé lorsqu’une réduction mesurée du temps d’exécution d’une compilation propre est obtenue grâce à une optimisation clairement choisie.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- rust
- Domaine
- build-system, performance
- Type d'issue
- Refactorisation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100