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

Stop emitting drop loops for every array length #134297

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

Conversation

scottmcm
Copy link
Member

We can just unsize the array to a slice and drop that instead, reusing the same slice loop for every array length.

As part of this (and how I originally noticed this), use PtrMetadata instead of Len for the slice length, for another step closer to being able to remove Rvalue::Len.

Demonstration that yes, every slice length gets its own loop today: https://rust.godbolt.org/z/5EsPjPWv4

@rustbot
Copy link
Collaborator

rustbot commented Dec 14, 2024

r? @BoxyUwU

rustbot has assigned @BoxyUwU.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added 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. labels Dec 14, 2024
@scottmcm
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 14, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 14, 2024
…<try>

Stop emitting drop loops for every array length

We can just unsize the array to a slice and drop that instead, reusing the same slice loop for every array length.

As part of this (and how I originally noticed this), use `PtrMetadata` instead of `Len` for the slice length, for another step closer to being able to remove `Rvalue::Len`.

Demonstration that yes, every slice length gets its own loop today: <https://rust.godbolt.org/z/5EsPjPWv4>
@bors
Copy link
Contributor

bors commented Dec 14, 2024

⌛ Trying commit f6cd47a with merge 41701b3...

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Dec 14, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 14, 2024
We can just unsize the array to a slice and drop that instead, reusing the same loop.

As part of this (and how I originally noticed this), use `PtrMetadata` instead of `Len` for the slice length, for another step closer to being able to remove `Rvalue::Len`.
@scottmcm scottmcm force-pushed the drop-arrays-by-unsizing branch from f6cd47a to aac57cf Compare December 14, 2024 07:03
@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 27.0s done
#16 DONE 32.1s
##[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
---
    Finished `release` profile [optimized] target(s) in 14.95s
##[endgroup]
##[group]Testing stage2 compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu)
thread 'main' panicked at src/tools/compiletest/src/common.rs:716:9:
error: failed to run LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" RUSTC_BOOTSTRAP="1" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--print=all-target-specs-json" "-Zunstable-options"

--- stderr
thread 'main' panicked at compiler/rustc_driver_impl/src/lib.rs:1587:6:
thread 'main' panicked at compiler/rustc_driver_impl/src/lib.rs:1587:6:
Unable to install ctrlc handler: System(Custom { kind: Other, error: EBADF })
   0:     0x7f808a2d3588 - <<std[af8973264cc58d24]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[8accd4e7f4bc6c29]::fmt::Display>::fmt
   1:     0x7f808a3302b3 - core[8accd4e7f4bc6c29]::fmt::write
   2:     0x7f808a2c6f89 - <std[af8973264cc58d24]::sys::pal::unix::stdio::Stderr as std[af8973264cc58d24]::io::Write>::write_fmt
   3:     0x7f808a2d3432 - <std[af8973264cc58d24]::sys::backtrace::BacktraceLock>::print
---
note: please make sure that you have updated to the latest nightly

note: please attach the file at `/checkout/obj/rustc-ice-2024-12-14T07_22_43-21491.txt` to your bug report

note: compiler flags: -C rpath -C debuginfo=0 -Z unstable-options
query stack during panic:
end of query stack

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@scottmcm
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@bors
Copy link
Contributor

bors commented Dec 14, 2024

⌛ Trying commit aac57cf with merge 4ce3fa5...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 14, 2024
…<try>

Stop emitting drop loops for every array length

We can just unsize the array to a slice and drop that instead, reusing the same slice loop for every array length.

As part of this (and how I originally noticed this), use `PtrMetadata` instead of `Len` for the slice length, for another step closer to being able to remove `Rvalue::Len`.

Demonstration that yes, every slice length gets its own loop today: <https://rust.godbolt.org/z/5EsPjPWv4>
@rust-log-analyzer
Copy link
Collaborator

The job dist-x86_64-linux failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
file:.git/config remote.origin.url=https://github.com/rust-lang-ci/rust
file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config gc.auto=0
file:.git/config http.https://github.com/.extraheader=AUTHORIZATION: basic ***
file:.git/config branch.try.remote=origin
file:.git/config branch.try.merge=refs/heads/try
file:.git/config remote.upstream.fetch=+refs/heads/*:refs/remotes/upstream/*
file:.git/config submodule.library/backtrace.active=true
file:.git/config submodule.library/backtrace.url=https://github.com/rust-lang/backtrace-rs.git
file:.git/config submodule.library/stdarch.active=true
---
    0: Cannot gather rustc PGO profiles
    1: Command LLVM_PROFILE_FILE=/tmp/tmp-multistage/opt-artifacts/rustc-pgo/default_%m_%p.profraw RUSTC=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/rustc RUSTC_BOOTSTRAP=1 RUST_LOG=collector=debug /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo run -p collector --bin collector -- profile_local eprintln /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc --id Test --cargo /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo --profiles Check,Debug,Opt --scenarios All --include externs,ctfe-stress-5,cargo-0.60.0,token-stream-stress,match-stress,tuple-stress,diesel-1.4.8,bitmaps-3.1.0 [at /tmp/tmp-multistage/opt-artifacts/rustc-perf] has failed with exit code Some(1)

Stack backtrace:
   0: <anyhow::Error>::msg::<alloc::string::String>
             at /rust/deps/anyhow-1.0.93/src/backtrace.rs:27:14
   1: <opt_dist::exec::CmdBuilder>::run
             at /rustc/4ce3fa524ad0178d972dccadd8443eaa761148f8/src/tools/opt-dist/src/exec.rs:80:17
             at /rustc/4ce3fa524ad0178d972dccadd8443eaa761148f8/src/tools/opt-dist/src/training.rs:155:9
   3: opt_dist::utils::with_log_group::<opt_dist::training::gather_rustc_profiles::{closure#0}, core::result::Result<(), anyhow::Error>>
             at /rustc/4ce3fa524ad0178d972dccadd8443eaa761148f8/src/tools/opt-dist/src/utils/mod.rs:66:22
   4: opt_dist::training::gather_rustc_profiles
   4: opt_dist::training::gather_rustc_profiles
             at /rustc/4ce3fa524ad0178d972dccadd8443eaa761148f8/src/tools/opt-dist/src/training.rs:154:5
   5: opt_dist::execute_pipeline::{closure#1}::{closure#1}
             at /rustc/4ce3fa524ad0178d972dccadd8443eaa761148f8/src/tools/opt-dist/src/main.rs:229:45
   6: <opt_dist::timer::TimerSection>::section::<opt_dist::execute_pipeline::{closure#1}::{closure#1}, opt_dist::training::RustcPGOProfile>
             at /rustc/4ce3fa524ad0178d972dccadd8443eaa761148f8/src/tools/opt-dist/src/timer.rs:111:22
             at /rustc/4ce3fa524ad0178d972dccadd8443eaa761148f8/src/tools/opt-dist/src/main.rs:228:23
             at /rustc/4ce3fa524ad0178d972dccadd8443eaa761148f8/src/tools/opt-dist/src/main.rs:228:23
   8: <opt_dist::timer::TimerSection>::section::<opt_dist::execute_pipeline::{closure#1}, opt_dist::training::RustcPGOProfile>
             at /rustc/4ce3fa524ad0178d972dccadd8443eaa761148f8/src/tools/opt-dist/src/timer.rs:111:22
             at /rustc/4ce3fa524ad0178d972dccadd8443eaa761148f8/src/tools/opt-dist/src/main.rs:211:29
  10: opt_dist::main
             at /rustc/4ce3fa524ad0178d972dccadd8443eaa761148f8/src/tools/opt-dist/src/main.rs:401:18
  11: <fn() -> core::result::Result<(), anyhow::Error> as core::ops::function::FnOnce<()>>::call_once
  11: <fn() -> core::result::Result<(), anyhow::Error> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/core/src/ops/function.rs:250:5
  12: std::sys::backtrace::__rust_begin_short_backtrace::<fn() -> core::result::Result<(), anyhow::Error>, core::result::Result<(), anyhow::Error>>
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/sys/backtrace.rs:154:18
  13: std::rt::lang_start::<core::result::Result<(), anyhow::Error>>::{closure#0}
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/rt.rs:195:18
  14: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
  15: std::panicking::try::do_call
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/panicking.rs:557:40
  16: std::panicking::try
             at /rustc/b4297a573b4eefacd62e7ea1ba071536282d3254/library/std/src/panicking.rs:520:19

@bors
Copy link
Contributor

bors commented Dec 14, 2024

💔 Test failed - checks-actions

@lqd
Copy link
Member

lqd commented Dec 14, 2024

(These failures within opt-dist running rustc-perf aren't super clear... I'll try to see how to improve that.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-perf Status: Waiting on a perf run to be completed. 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.

7 participants