Skip to content
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

rules_rust: enable pipelined compilation. #1275

Merged
merged 7 commits into from
Aug 5, 2022

Conversation

gigaroby
Copy link
Contributor

Pipelined compilation allows better parallelism during builds as it
allows libraries to generate lightweight metadata files to unlock other
depencies. These metadata files (.rmeta) can only be used to unlock
library -> library dependencies and do not affect builds in any other
way. This is currently the default in cargo:
https://internals.rust-lang.org/t/evaluating-pipelined-rustc-compilation/10199

@dtolnay
Copy link
Contributor

dtolnay commented Apr 20, 2022

Mentioning @jsgf since you wrote tips on how to implement this in #228 (comment) based on Buck v2.

@gigaroby gigaroby force-pushed the pipeline-bzl branch 9 times, most recently from f35f8f7 to 8f0c279 Compare April 29, 2022 14:49
@gigaroby gigaroby force-pushed the pipeline-bzl branch 2 times, most recently from f668ad9 to 9273c86 Compare May 23, 2022 08:46
@gigaroby gigaroby force-pushed the pipeline-bzl branch 11 times, most recently from d750801 to ea39bfe Compare July 12, 2022 15:40
@gigaroby gigaroby marked this pull request as ready for review July 12, 2022 15:48
@gigaroby gigaroby force-pushed the pipeline-bzl branch 3 times, most recently from 8cfe57e to b462a7b Compare July 13, 2022 12:31
@gigaroby gigaroby force-pushed the pipeline-bzl branch 3 times, most recently from b40a00d to f4eaa71 Compare August 3, 2022 08:32
rust/private/providers.bzl Outdated Show resolved Hide resolved
test/unit/pipelined_compilation/wrap.bzl Outdated Show resolved Hide resolved
rust/private/rustc.bzl Outdated Show resolved Hide resolved
rust/private/rustc.bzl Outdated Show resolved Hide resolved
rust/private/rustc.bzl Outdated Show resolved Hide resolved
@purkhusid
Copy link
Contributor

@gigaroby I'm curious if you have already used this on a decently sized project? If so, did you see any noticeable difference?

@durin42
Copy link
Contributor

durin42 commented Aug 4, 2022

@gigaroby I'm curious if you have already used this on a decently sized project? If so, did you see any noticeable difference?

Building the Rust toolchain using bazel this seems to reduce the wait from 2h to 40 minutes. It's an enormous win!

@purkhusid
Copy link
Contributor

Nice! Looking forward to test this on our repo.

@UebelAndre
Copy link
Collaborator

@gigaroby I'm curious if you have already used this on a decently sized project? If so, did you see any noticeable difference?

Building the Rust toolchain using bazel this seems to reduce the wait from 2h to 40 minutes. It's an enormous win!

What are you building? A a full rust toolchain? So rustc and things? Or do I misunderstand that.

@durin42
Copy link
Contributor

durin42 commented Aug 4, 2022

@gigaroby I'm curious if you have already used this on a decently sized project? If so, did you see any noticeable difference?

Building the Rust toolchain using bazel this seems to reduce the wait from 2h to 40 minutes. It's an enormous win!

What are you building? A a full rust toolchain? So rustc and things? Or do I misunderstand that.

Yes, a full Rust toolchain including LLVM, bootstrapped from an existing beta rustc and clang.

@scentini scentini self-requested a review August 5, 2022 08:31
@scentini scentini merged commit 867fc37 into bazelbuild:main Aug 5, 2022
@purkhusid
Copy link
Contributor

Nice! @scentini is it possible to cut a release with this feature soon?

@jsgf
Copy link

jsgf commented Aug 7, 2022

@durin42 Presumably it had no effect on the llvm bits of the build?

@gigaroby
Copy link
Contributor Author

gigaroby commented Aug 7, 2022

@jsgf not unless those parts of LLVM are in rust themselves. This only unlocks parallelism for rlib -> rlib arches in the build graph.

@gigaroby gigaroby deleted the pipeline-bzl branch August 7, 2022 12:28
Calsign added a commit to Calsign/rules_rust that referenced this pull request Dec 29, 2022
The recent support for pipelined compilation (bazelbuild#1275) is great. There are some situations, however, where we need to disable pipelining for specific crates, e.g. bazelbuild#1584. This PR adds a crate annotation option to disable pipelining for rust_library targets generated by cargo_bazel.
Calsign added a commit to Calsign/rules_rust that referenced this pull request Jan 14, 2023
The recent support for pipelined compilation (bazelbuild#1275) is great. There are some situations, however, where we need to disable pipelining for specific crates, e.g. bazelbuild#1584. This PR adds a crate annotation option to disable pipelining for rust_library targets generated by cargo_bazel.
Calsign added a commit to Calsign/rules_rust that referenced this pull request Jan 14, 2023
The recent support for pipelined compilation (bazelbuild#1275) is great. There are some situations, however, where we need to disable pipelining for specific crates, e.g. bazelbuild#1584. This PR adds a crate annotation option to disable pipelining for rust_library targets generated by cargo_bazel.
Calsign added a commit to Calsign/rules_rust that referenced this pull request Jan 26, 2023
The recent support for pipelined compilation (bazelbuild#1275) is great. There are some situations, however, where we need to disable pipelining for specific crates, e.g. bazelbuild#1584. This PR adds a crate annotation option to disable pipelining for rust_library targets generated by cargo_bazel.
illicitonion pushed a commit that referenced this pull request Jan 26, 2023
The recent support for pipelined compilation (#1275) is great. There are some situations, however, where we need to disable pipelining for specific crates, e.g. #1584. This PR adds a crate annotation option to disable pipelining for rust_library targets generated by cargo_bazel. The alternatives would be patching the crate with the annotations system or disabling pipelining globally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants