mirror of
https://github.com/rust-lang/rust
synced 2024-09-05 16:57:03 +00:00
Auto merge of #117435 - SparrowLii:nightly_parallel, r=oli-obk,davidtwco
enable parallel rustc front end in nightly builds Refers to the [MCP](https://github.com/rust-lang/compiler-team/issues/681), this pr does: 1. Enable the parallel front end in nightly builds, and keep the default number of threads as 1. Then users can use the parallel rustc front end via -Z threads=n option. 2. Set it up to serial front end for beta/stable builds via bootstrap. 3. Switch over the alt builders from parallel rustc to serial, so we have artifacts without parallel to test against the artifacts with parallel. r? `@oli-obk` cc `@cjgillot` `@nnethercote` `@bjorn3` `@Kobzol`
This commit is contained in:
commit
f9b644636f
|
@ -3005,9 +3005,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "portable-atomic"
|
||||
version = "1.4.2"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f32154ba0af3a075eefa1eda8bb414ee928f62303a54ea85b8d6638ff1a6ee9e"
|
||||
checksum = "3bccab0e7fd7cc19f820a1c8c91720af652d0c88dc9664dd72aef2614f04af3b"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
|
@ -3734,6 +3734,7 @@ dependencies = [
|
|||
"measureme",
|
||||
"memmap2",
|
||||
"parking_lot 0.12.1",
|
||||
"portable-atomic",
|
||||
"rustc-hash",
|
||||
"rustc-rayon",
|
||||
"rustc-rayon-core",
|
||||
|
|
|
@ -47,6 +47,9 @@ features = [
|
|||
memmap2 = "0.2.1"
|
||||
# tidy-alphabetical-end
|
||||
|
||||
[target.'cfg(any(target_arch = "powerpc", target_arch = "mips"))'.dependencies]
|
||||
portable-atomic = "1.5.1"
|
||||
|
||||
[features]
|
||||
# tidy-alphabetical-start
|
||||
rustc_use_parallel_compiler = ["indexmap/rustc-rayon", "rustc-rayon", "rustc-rayon-core"]
|
||||
|
|
|
@ -138,7 +138,6 @@ macro_rules! already_sync {
|
|||
[std::sync::atomic::AtomicUsize]
|
||||
[std::sync::atomic::AtomicU8]
|
||||
[std::sync::atomic::AtomicU32]
|
||||
[std::sync::atomic::AtomicU64]
|
||||
[std::backtrace::Backtrace]
|
||||
[std::io::Error]
|
||||
[std::fs::File]
|
||||
|
@ -148,6 +147,18 @@ macro_rules! already_sync {
|
|||
[crate::owned_slice::OwnedSlice]
|
||||
);
|
||||
|
||||
// PowerPC and MIPS platforms with 32-bit pointers do not
|
||||
// have AtomicU64 type.
|
||||
#[cfg(not(any(target_arch = "powerpc", target_arch = "mips")))]
|
||||
already_sync!(
|
||||
[std::sync::atomic::AtomicU64]
|
||||
);
|
||||
|
||||
#[cfg(any(target_arch = "powerpc", target_arch = "mips"))]
|
||||
already_sync!(
|
||||
[portable_atomic::AtomicU64]
|
||||
);
|
||||
|
||||
macro_rules! impl_dyn_sync {
|
||||
($($($attr: meta)* [$ty: ty where $($generics2: tt)*])*) => {
|
||||
$(unsafe impl<$($generics2)*> DynSync for $ty {})*
|
||||
|
|
|
@ -265,7 +265,15 @@ fn clone(&self) -> Self {
|
|||
|
||||
pub use std::sync::OnceLock;
|
||||
|
||||
pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32, AtomicU64};
|
||||
pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32};
|
||||
|
||||
// PowerPC and MIPS platforms with 32-bit pointers do not
|
||||
// have AtomicU64 type.
|
||||
#[cfg(not(any(target_arch = "powerpc", target_arch = "mips")))]
|
||||
pub use std::sync::atomic::AtomicU64;
|
||||
|
||||
#[cfg(any(target_arch = "powerpc", target_arch = "mips"))]
|
||||
pub use portable_atomic::AtomicU64;
|
||||
|
||||
pub use std::sync::Arc as Lrc;
|
||||
pub use std::sync::Weak as Weak;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#
|
||||
# If `change-id` does not match the version that is currently running,
|
||||
# `x.py` will prompt you to update it and check the related PR for more details.
|
||||
change-id = 116998
|
||||
change-id = 117435
|
||||
|
||||
# =============================================================================
|
||||
# Tweaking how LLVM is compiled
|
||||
|
@ -553,10 +553,11 @@ change-id = 116998
|
|||
# Whether to always use incremental compilation when building rustc
|
||||
#incremental = false
|
||||
|
||||
# Build a multi-threaded rustc
|
||||
# FIXME(#75760): Some UI tests fail when this option is enabled.
|
||||
# NOTE: This option is NOT SUPPORTED. See #48685.
|
||||
#parallel-compiler = false
|
||||
# Build a multi-threaded rustc. This allows users to use parallel rustc
|
||||
# via the unstable option `-Z threads=n`.
|
||||
# Since stable/beta channels only allow using stable features,
|
||||
# `parallel-compiler = false` should be set for these channels.
|
||||
#parallel-compiler = true
|
||||
|
||||
# The default linker that will be hard-coded into the generated
|
||||
# compiler for targets that don't specify a default linker explicitly
|
||||
|
|
|
@ -1072,6 +1072,7 @@ pub fn default_opts() -> Config {
|
|||
config.bindir = "bin".into();
|
||||
config.dist_include_mingw_linker = true;
|
||||
config.dist_compression_profile = "fast".into();
|
||||
config.rustc_parallel = true;
|
||||
|
||||
config.stdout_is_tty = std::io::stdout().is_terminal();
|
||||
config.stderr_is_tty = std::io::stderr().is_terminal();
|
||||
|
@ -1429,7 +1430,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
|
|||
set(&mut config.use_lld, rust.use_lld);
|
||||
set(&mut config.lld_enabled, rust.lld);
|
||||
set(&mut config.llvm_tools_enabled, rust.llvm_tools);
|
||||
config.rustc_parallel = rust.parallel_compiler.unwrap_or(false);
|
||||
config.rustc_parallel = rust
|
||||
.parallel_compiler
|
||||
.unwrap_or(config.channel == "dev" || config.channel == "nightly");
|
||||
config.rustc_default_linker = rust.default_linker;
|
||||
config.musl_root = rust.musl_root.map(PathBuf::from);
|
||||
config.save_toolstates = rust.save_toolstates.map(PathBuf::from);
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
///
|
||||
/// If you make any major changes (such as adding new values or changing default values), please
|
||||
/// ensure that the associated PR ID is added to the end of this list.
|
||||
pub const CONFIG_CHANGE_HISTORY: &[usize] = &[115898, 116998];
|
||||
pub const CONFIG_CHANGE_HISTORY: &[usize] = &[115898, 116998, 117435];
|
||||
|
||||
/// Extra --check-cfg to add when building
|
||||
/// (Mode restriction, config name, config values (if any))
|
||||
|
|
|
@ -98,8 +98,8 @@ if [ "$DEPLOY$DEPLOY_ALT" = "1" ]; then
|
|||
if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
|
||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"
|
||||
elif [ "$DEPLOY_ALT" != "" ]; then
|
||||
if [ "$NO_PARALLEL_COMPILER" = "" ]; then
|
||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.parallel-compiler"
|
||||
if [ "$ALT_PARALLEL_COMPILER" = "" ]; then
|
||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.parallel-compiler=false"
|
||||
fi
|
||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-assertions"
|
||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.verify-llvm-ir"
|
||||
|
|
|
@ -287,6 +287,7 @@
|
|||
"perf-event-open-sys",
|
||||
"pin-project-lite",
|
||||
"polonius-engine",
|
||||
"portable-atomic", // dependency for platforms doesn't support `AtomicU64` in std
|
||||
"ppv-lite86",
|
||||
"proc-macro-hack",
|
||||
"proc-macro2",
|
||||
|
|
Loading…
Reference in a new issue