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

Compilation taking unexpected long after 1.84 #135457

Closed
mrain opened this issue Jan 13, 2025 · 13 comments · Fixed by #135618
Closed

Compilation taking unexpected long after 1.84 #135457

mrain opened this issue Jan 13, 2025 · 13 comments · Fixed by #135618
Assignees
Labels
C-bug Category: This is a bug. I-compiletime Issue: Problems and improvements with respect to compile times. P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. S-has-bisection Status: a bisection has been found for this issue S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Milestone

Comments

@mrain
Copy link

mrain commented Jan 13, 2025

I'm building jf-pcs library from https://github.com/EspressoSystems/jellyfish

On rust version 1.83

rust version meta

[$] rustc --version --verbose                                                                                             
rustc 1.83.0 (90b35a623 2024-11-26)
binary: rustc
commit-hash: 90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf
commit-date: 2024-11-26
host: aarch64-apple-darwin
release: 1.83.0
LLVM version: 19.1.1

It only took ~11s to build the library

[$] cargo build -p jf-pcs                                                                                                        
   Compiling proc-macro2 v1.0.86
   Compiling unicode-ident v1.0.12
   ... [excess outputs omitted]
   Compiling jf-utils v0.4.4 (https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbef)
   Compiling jf-pcs v0.1.0 (/Users/chengyu/espressosys/jellyfish/pcs)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 11.43s

Now on rust 1.84 the compilation runs almost forever:

rust version meta

rustc 1.84.0 (9fc6b4312 2025-01-07)
binary: rustc
commit-hash: 9fc6b43126469e3858e2fe86cafb4f0fd5068869
commit-date: 2025-01-07
host: aarch64-apple-darwin
release: 1.84.0
LLVM version: 19.1.5

[$] cargo build -p jf-pcs                                                                                                  
   Compiling proc-macro2 v1.0.86
   Compiling unicode-ident v1.0.12
   ... [excess outputs omitted]
   Compiling jf-utils v0.4.4 (https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbef)
   Compiling jf-pcs v0.1.0 (/Users/chengyu/espressosys/jellyfish/pcs)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 26m 43s

Suspect that this is due to the new trait solver.

@mrain mrain added the C-bug Category: This is a bug. label Jan 13, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 13, 2025
@jieyouxu jieyouxu added I-compiletime Issue: Problems and improvements with respect to compile times. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc labels Jan 13, 2025
@theemathas

This comment has been minimized.

@rustbot rustbot added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jan 14, 2025
@aDotInTheVoid aDotInTheVoid added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Jan 14, 2025
@lqd
Copy link
Member

lqd commented Jan 14, 2025

Indeed, this bisects to #130654 cc @rust-lang/initiative-trait-system-refactor. I'll look into minimizing this.

@rustbot label -E-needs-bisection

@rustbot rustbot removed the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Jan 14, 2025
@lsunsi

This comment has been minimized.

@lcnr

This comment has been minimized.

@lsunsi

This comment has been minimized.

@lcnr

This comment has been minimized.

@lqd

This comment has been minimized.

@lsunsi

This comment has been minimized.

@lqd
Copy link
Member

lqd commented Jan 14, 2025

2 crates:

  • src/lib.rs
pub trait Pairing {}

pub trait AffineRepr:
    // without the following line: super fast.
    Mul<Self::ScalarField, Output = Self::Group> +
    // without the following line: super fast.
    for<'a> Mul<&'a Self::ScalarField, Output = Self::Group>
    // note: combinations of the `Output`s above can be changed to `ScalarField` for 2x faster
{
    type ScalarField;
    type Group;
}

pub trait Mul<T> { type Output; }
  • src/main.rs:
use repro::{Pairing, AffineRepr};

struct S<E>(E);
impl<T, E> From<T> for S<E>
where
    T: AffineRepr,
    E: Pairing,
{
    fn from(_value: T) -> Self {
        unimplemented!()
    }
}

fn main() {}
$ cargo clean -q && time CARGO_INCREMENTAL=0 cargo rustc -q --bin=repro -- -Znext-solver=no

real    0m0.206s
user    0m0.083s
sys     0m0.159s

$ cargo clean -q && time CARGO_INCREMENTAL=0 cargo rustc -q --bin=repro -- -Znext-solver=coherence

real    0m5.636s
user    0m5.519s
sys     0m0.152s

There may be others in there, I'm not sure.

@lcnr
Copy link
Contributor

lcnr commented Jan 14, 2025

@rustbot claim

Thank you @mrain for reporting this and an enormous thank you to @lqd for the very nice minimization ❤️

@jieyouxu jieyouxu added S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue S-has-bisection Status: a bisection has been found for this issue T-types Relevant to the types team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) and removed E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 14, 2025
@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jan 15, 2025
bors added a commit to rust-lang-ci/rust that referenced this issue Jan 15, 2025
don't check for overlap if its allowed regardless

fixes rust-lang#135457. I am not a big fan of this tbh, want to figure out why the proof tree visitor is so damn slow here.

r? `@compiler-errors`
@bors bors closed this as completed in 8e59cf9 Jan 18, 2025
@lcnr
Copy link
Contributor

lcnr commented Jan 20, 2025

reopening to track stable-backport (if it happens)

@lcnr lcnr reopened this Jan 20, 2025
@cuviper
Copy link
Member

cuviper commented Jan 30, 2025

Should be fixed now in 1.84.1.

@cuviper cuviper closed this as completed Jan 30, 2025
@cuviper cuviper added this to the 1.84.1 milestone Jan 30, 2025
sveitser added a commit to EspressoSystems/espresso-sequencer that referenced this issue Feb 3, 2025
The regression that caused increased compile times for jf-pcs has been
fixed in rust 1.84.1

See rust-lang/rust#135457

We originally pinned rust to 1.83 in
220df37 to work around this regression.
sveitser added a commit to EspressoSystems/espresso-sequencer that referenced this issue Feb 3, 2025
The regression that caused increased compile times for jf-pcs has been
fixed in rust 1.84.1

See rust-lang/rust#135457

We originally pinned rust to 1.83 in
220df37 to work around this regression.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-compiletime Issue: Problems and improvements with respect to compile times. P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. S-has-bisection Status: a bisection has been found for this issue S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types 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
10 participants