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

Swap Lru from std::sync::Arc to triomphe::Arc #131629

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GnomedDev
Copy link
Contributor

This swaps rustc_data_structures::sync::Lru to triomphe::Arc when using the parallel compiler, which is a fork of the std Arc without Weak support. This should improve performance, so let's see...

r? @ghost

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 12, 2024
@rust-log-analyzer

This comment has been minimized.

@jieyouxu
Copy link
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 12, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 12, 2024
Swap Lru from std::sync::Arc to triomphe::Arc

This swaps `rustc_data_structures::sync::Lru` to `triomphe::Arc` when using the parallel compiler, which is a fork of the std `Arc` without `Weak` support. This should improve performance, so let's see...

r? `@ghost`
@bors
Copy link
Contributor

bors commented Oct 12, 2024

⌛ Trying commit a4be3b5 with merge b51813e...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-18 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
------
 > importing cache manifest from ghcr.io/rust-lang/rust-ci-cache:c32c805632780b5c1de330e3f44561b336c2efe163bc0990acb392390157a8e1d9f855d75914a239aa40c49d77f4a837247d05d2f8d46f554b98e1f46712a3e3:
------
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-18/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
    Finished `release` profile [optimized] target(s) in 28.77s
##[endgroup]
##[group]Building compiler artifacts (stage0 -> stage1, x86_64-unknown-linux-gnu)
    Updating crates.io index
    Updating git repository `https://github.com/GnomedDev/triomphe`
---
   Compiling icu_provider_adapters v1.5.0
   Compiling tracing-tree v0.3.1
   Compiling rustc_baked_icu_data v0.0.0 (/checkout/compiler/rustc_baked_icu_data)
   Compiling rustc_log v0.0.0 (/checkout/compiler/rustc_log)
   Compiling triomphe v0.1.14 (https://github.com/GnomedDev/triomphe?branch=dropck-eyepatch#a9614f96)
   Compiling stable_mir v0.1.0-preview (/checkout/compiler/stable_mir)
   Compiling rustc_serialize v0.0.0 (/checkout/compiler/rustc_serialize)
   Compiling rustc_index v0.0.0 (/checkout/compiler/rustc_index)
   Compiling rustc_data_structures v0.0.0 (/checkout/compiler/rustc_data_structures)
---
   Compiling icu_locid_transform v1.5.0
   Compiling icu_list v1.5.0
   Compiling icu_provider_adapters v1.5.0
   Compiling rustc_baked_icu_data v0.0.0 (/checkout/compiler/rustc_baked_icu_data)
   Compiling triomphe v0.1.14 (https://github.com/GnomedDev/triomphe?branch=dropck-eyepatch#a9614f96)
   Compiling stable_mir v0.1.0-preview (/checkout/compiler/stable_mir)
   Compiling rustc_serialize v0.0.0 (/checkout/compiler/rustc_serialize)
   Compiling rustc_index v0.0.0 (/checkout/compiler/rustc_index)
   Compiling rustc_data_structures v0.0.0 (/checkout/compiler/rustc_data_structures)
---

---- [ui] tests/ui/macros/nonterminal-matching.rs stdout ----
diff of stderr:

- error: no rules expected the token `enum E {}`
-    |
-    |
- LL |     macro n(a $nt_item b) {
-    |     --------------------- when calling this macro
- ...
- LL |     n!(a $nt_item b);
-    |          ^^^^^^^^ no rules expected this token in macro call
- ...
- LL | complex_nonterminal!(enum E {});
-    |
- note: while trying to match `enum E {}`
-   --> $DIR/nonterminal-matching.rs:15:15
-    |
-    |
- LL |     macro n(a $nt_item b) {
- ...
- ...
- LL | complex_nonterminal!(enum E {});
-    | ------------------------------- in this macro invocation
-    = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
-    = note: see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
-    = help: try using `:tt` instead in the macro definition
-    = note: this error originates in the macro `complex_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info)
26 error: no rules expected the token `3`
27   --> $DIR/nonterminal-matching.rs:32:35
28    |


111    = help: try using `:tt` instead in the macro definition
112    = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
- error: aborting due to 5 previous errors
+ error: aborting due to 4 previous errors
115 
116 
---
To only update this specific test, also pass `--test-args macros/nonterminal-matching.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/macros/nonterminal-matching.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/macros/nonterminal-matching" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/macros/nonterminal-matching/auxiliary"
--- stderr -------------------------------
error: no rules expected the token `3`
##[error]  --> /checkout/tests/ui/macros/nonterminal-matching.rs:32:35
   |
   |
LL |     (expr $x:expr) => { bar!(expr $x); }; //~ ERROR: no rules expected the token `3`
   |                                   ^^ no rules expected this token in macro call
LL | macro_rules! bar {
   | ---------------- when calling this macro
...
...
LL | foo!(expr 3);
   |
note: while trying to match `3`
  --> /checkout/tests/ui/macros/nonterminal-matching.rs:42:11
   |
   |
LL |     (expr 3) => {};
   |           ^
   = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
   = note: see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
   = help: try using `:tt` instead in the macro definition
   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: no rules expected the token `4`
##[error]  --> /checkout/tests/ui/macros/nonterminal-matching.rs:33:44
   |
   |
LL |     (literal $x:literal) => { bar!(literal $x); }; //~ ERROR: no rules expected the token `4`
   |                                            ^^ no rules expected this token in macro call
LL | macro_rules! bar {
   | ---------------- when calling this macro
...
...
LL | foo!(literal 4);
   |
note: while trying to match `4`
  --> /checkout/tests/ui/macros/nonterminal-matching.rs:43:14
   |
   |
LL |     (literal 4) => {};
   |              ^
   = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
   = note: see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
   = help: try using `:tt` instead in the macro definition
   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

error: no rules expected the token `a::b::c`
   |
   |
LL |     (path $x:path) => { bar!(path $x); }; //~ ERROR: no rules expected the token `a::b::c`
   |                                   ^^ no rules expected this token in macro call
LL | macro_rules! bar {
   | ---------------- when calling this macro
...
...
LL | foo!(path a::b::c);
   |
note: while trying to match `a`
  --> /checkout/tests/ui/macros/nonterminal-matching.rs:44:11
   |
   |
LL |     (path a::b::c) => {};
   |           ^
   = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
   = note: see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
   = help: try using `:tt` instead in the macro definition
   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)

error: no rules expected the token `let abc = 0`
   |
   |
LL |     (stmt $x:stmt) => { bar!(stmt $x); }; //~ ERROR: no rules expected the token `let abc = 0`
   |                                   ^^ no rules expected this token in macro call
LL | macro_rules! bar {
   | ---------------- when calling this macro
...
...
LL | foo!(stmt let abc = 0);
   |
note: while trying to match `let`
  --> /checkout/tests/ui/macros/nonterminal-matching.rs:45:11
   |
   |
LL |     (stmt let abc = 0) => {};
   |           ^^^
   = note: captured metavariables except for `:tt`, `:ident` and `:lifetime` cannot be compared to other tokens
   = note: see <https://doc.rust-lang.org/nightly/reference/macros-by-example.html#forwarding-a-matched-fragment> for more information
   = help: try using `:tt` instead in the macro definition
   = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
------------------------------------------


@bors
Copy link
Contributor

bors commented Oct 12, 2024

☀️ Try build successful - checks-actions
Build commit: b51813e (b51813e3477b886def1e80cd04b5870e5ad3526c)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b51813e): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.4% [0.2%, 0.8%] 6
Regressions ❌
(secondary)
0.3% [0.2%, 0.3%] 9
Improvements ✅
(primary)
-0.3% [-0.5%, -0.2%] 5
Improvements ✅
(secondary)
-0.2% [-0.4%, -0.1%] 7
All ❌✅ (primary) 0.1% [-0.5%, 0.8%] 11

Max RSS (memory usage)

Results (primary -0.5%, secondary 1.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.1% [0.7%, 1.5%] 2
Regressions ❌
(secondary)
2.8% [0.9%, 6.2%] 4
Improvements ✅
(primary)
-0.9% [-1.4%, -0.5%] 10
Improvements ✅
(secondary)
-2.2% [-2.9%, -1.6%] 2
All ❌✅ (primary) -0.5% [-1.4%, 1.5%] 12

Cycles

Results (secondary 2.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.7% [2.7%, 2.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 780.1s -> 785.891s (0.74%)
Artifact size: 332.11 MiB -> 332.03 MiB (-0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-testsuite Area: The testsuite used to check the correctness of rustc perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants