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

compiler: Stop manually extending the stack #134153

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

workingjubilee
Copy link
Member

This rips out almost all calls to ensure_sufficient_stack, and disables the actual function itself for the handful of calls that proved too annoying to immediately rip out, for rebasing or type inference reasons.

r? @ghost

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Dec 10, 2024
@rustbot
Copy link
Collaborator

rustbot commented Dec 10, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred to the CTFE machinery

cc @rust-lang/wg-const-eval

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

Some changes occurred in match lowering

cc @Nadrieril

Some changes occurred in match checking

cc @Nadrieril

changes to the core type system

cc @compiler-errors, @lcnr

Some changes occurred in exhaustiveness checking

cc @Nadrieril

@workingjubilee workingjubilee marked this pull request as draft December 10, 2024 23:54
@workingjubilee
Copy link
Member Author

uh... sorry? ^^;

@workingjubilee
Copy link
Member Author

@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 Dec 10, 2024
@workingjubilee workingjubilee removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 10, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 10, 2024
…ms, r=<try>

compiler: Stop manually extending the stack

This rips out almost all calls to `ensure_sufficient_stack`, and disables the actual function itself for the handful of calls that proved too annoying to immediately rip out, for rebasing or type inference reasons.

r? `@ghost`
@bors
Copy link
Contributor

bors commented Dec 10, 2024

⌛ Trying commit 8636992 with merge 0e81fd6...

@compiler-errors
Copy link
Member

what is the motivation for this change? presumably this will cause legitimate regressions on a mixture of both real and pathological examples. are you just trying to figure out the perf implications here?

@workingjubilee
Copy link
Member Author

workingjubilee commented Dec 11, 2024

@compiler-errors Currently, yes, this is just a perf experiment.

I am aware of the regressions because I have committed some of the regression tests that will now fail with this version of the compiler.

If this stops being a perf experiment, it will come with a second commit that covers the real regressions. Hopefully with less of a performance impact in non-pathological cases.

@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)
#16 exporting to docker image format
#16 sending tarball 28.3s done
#16 DONE 33.7s
##[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', '--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
---
   Compiling gccjit v2.2.0
   Compiling rustc_codegen_gcc v0.1.0 (/checkout/compiler/rustc_codegen_gcc)
error: rustc interrupted by SIGSEGV, printing backtrace

/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-1870b16e566575ab.so(+0xb5e0e6)[0x7fce84e890e6]
/lib/x86_64-linux-gnu/libc.so.6(+0x45320)[0x7fce8415a320]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-1870b16e566575ab.so(+0x1e36751)[0x7fce86161751]
### cycle encountered after 3 frames with period 4
### cycle encountered after 3 frames with period 4
/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-1870b16e566575ab.so(+0x1f29da6)[0x7fce86254da6]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-1870b16e566575ab.so(+0x1f115b8)[0x7fce8623c5b8]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-1870b16e566575ab.so(+0x1e22cf3)[0x7fce8614dcf3]
/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-1870b16e566575ab.so(+0x1e1ff63)[0x7fce8614af63]
### recursed 63 times

/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-1870b16e566575ab.so(+0x1f29da6)[0x7fce86254da6]

note: rustc unexpectedly overflowed its stack! this is a bug
note: maximum backtrace depth reached, frames may have been lost
help: you can increase rustc's stack size by setting RUST_MIN_STACK=16777216
help: you can increase rustc's stack size by setting RUST_MIN_STACK=16777216
rustc exited with signal: 11 (SIGSEGV) (core dumped)
error: could not compile `rustc_codegen_gcc` (lib)
Caused by:
Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc /checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_codegen_gcc --edition=2018 compiler/rustc_codegen_gcc/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type dylib --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C debug-assertions=on --cfg 'feature="default"' --cfg 'feature="master"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("default", "master"))' -C metadata=d318bbec14490148 -C extra-filename=-d318bbec14490148 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/release/deps --extern gccjit=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/deps/libgccjit-9e01e5e4d3af194a.rlib -Csymbol-mangling-version=v0 -Zrandomize-layout -Zunstable-options '--check-cfg=cfg(bootstrap)' '--check-cfg=cfg(llvm_enzyme)' -Zmacro-backtrace -Csplit-debuginfo=off -Cllvm-args=-import-instr-limit=10 -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Z binary-dep-depinfo` (exit status: 254)
  local time: Wed Dec 11 00:11:17 UTC 2024
  network time: Wed, 11 Dec 2024 00:11:17 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

@bors
Copy link
Contributor

bors commented Dec 11, 2024

☀️ Try build successful - checks-actions
Build commit: 0e81fd6 (0e81fd6ef5ce355cc007e8fd91211d6285328e77)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (0e81fd6): comparison URL.

Overall result: ✅ improvements - no action needed

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.

@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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-1.4%, -0.1%] 194
Improvements ✅
(secondary)
-0.8% [-2.6%, -0.3%] 144
All ❌✅ (primary) -0.4% [-1.4%, -0.1%] 194

Max RSS (memory usage)

Results (primary -2.4%)

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)
- - 0
Improvements ✅
(primary)
-2.4% [-3.2%, -1.7%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.4% [-3.2%, -1.7%] 3

Cycles

Results (primary -1.3%, secondary 2.6%)

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)
5.4% [3.6%, 7.6%] 4
Improvements ✅
(primary)
-1.3% [-2.4%, -0.8%] 3
Improvements ✅
(secondary)
-2.8% [-3.0%, -2.6%] 2
All ❌✅ (primary) -1.3% [-2.4%, -0.8%] 3

Binary size

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

Bootstrap: 768.372s -> 762.235s (-0.80%)
Artifact size: 331.03 MiB -> 330.01 MiB (-0.31%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 11, 2024
@Zalathar Zalathar added the S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. label Dec 11, 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) S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants