From 572d70aaa60fbff8111c69086eb145983e1c8f6f Mon Sep 17 00:00:00 2001 From: ohad-starkware Date: Thu, 6 Feb 2025 01:41:40 +0200 Subject: [PATCH] bump toolchain and revert llvm issue patch --- .github/workflows/benchmarks-pages.yaml | 2 +- .github/workflows/ci.yaml | 40 +++++++++---------- .github/workflows/coverage.yaml | 4 +- crates/prover/Cargo.toml | 3 -- crates/prover/src/core/backend/simd/circle.rs | 5 ++- crates/prover/src/core/circle.rs | 3 +- crates/prover/src/core/queries.rs | 2 +- crates/prover/src/core/vcs/blake2_merkle.rs | 2 +- .../prover/src/core/vcs/poseidon252_merkle.rs | 2 +- .../examples/xor/gkr_lookups/accumulation.rs | 4 +- .../src/examples/xor/gkr_lookups/mle_eval.rs | 8 ++-- rust-toolchain.toml | 2 +- scripts/clippy.sh | 2 +- scripts/rust_fmt.sh | 2 +- scripts/test_avx.sh | 2 +- 15 files changed, 40 insertions(+), 43 deletions(-) diff --git a/.github/workflows/benchmarks-pages.yaml b/.github/workflows/benchmarks-pages.yaml index fc87b2d94..64634a4f0 100644 --- a/.github/workflows/benchmarks-pages.yaml +++ b/.github/workflows/benchmarks-pages.yaml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2025-01-02 + toolchain: nightly-2025-02-05 - name: Run benchmark run: ./scripts/bench.sh -- --output-format bencher | tee output.txt - name: Download previous benchmark data diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 69accc877..b50788574 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,7 +25,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: rustfmt - toolchain: nightly-2025-01-02 + toolchain: nightly-2025-02-05 - uses: Swatinem/rust-cache@v2 - run: scripts/rust_fmt.sh --check @@ -36,7 +36,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: clippy - toolchain: nightly-2025-01-02 + toolchain: nightly-2025-02-05 - uses: Swatinem/rust-cache@v2 - run: scripts/clippy.sh @@ -46,9 +46,9 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2025-01-02 + toolchain: nightly-2025-02-05 - uses: Swatinem/rust-cache@v2 - - run: cargo +nightly-2025-01-02 doc + - run: cargo +nightly-2025-02-05 doc run-wasm32-wasip1-tests: runs-on: ubuntu-latest @@ -56,7 +56,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2025-01-02 + toolchain: nightly-2025-02-05 targets: wasm32-wasip1 - uses: taiki-e/install-action@v2 with: @@ -73,7 +73,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2025-01-02 + toolchain: nightly-2025-02-05 targets: wasm32-unknown-unknown - uses: Swatinem/rust-cache@v2 - uses: jetli/wasm-pack-action@v0.4.0 @@ -89,9 +89,9 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2025-01-02 + toolchain: nightly-2025-02-05 - uses: Swatinem/rust-cache@v2 - - run: cargo +nightly-2025-01-02 test + - run: cargo +nightly-2025-02-05 test env: RUSTFLAGS: -C target-feature=+neon @@ -104,9 +104,9 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2025-01-02 + toolchain: nightly-2025-02-05 - uses: Swatinem/rust-cache@v2 - - run: cargo +nightly-2025-01-02 test + - run: cargo +nightly-2025-02-05 test env: RUSTFLAGS: -C target-cpu=native -C target-feature=+${{ matrix.target-feature }} @@ -116,7 +116,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2025-01-02 + toolchain: nightly-2025-02-05 - name: Run benchmark run: | cargo install cargo-criterion @@ -144,7 +144,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2025-01-02 + toolchain: nightly-2025-02-05 - name: Run benchmark run: | cargo install cargo-criterion @@ -172,9 +172,9 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2025-01-02 + toolchain: nightly-2025-02-05 - uses: Swatinem/rust-cache@v2 - - run: cargo +nightly-2025-01-02 test + - run: cargo +nightly-2025-02-05 test run-slow-tests: runs-on: ubuntu-latest @@ -182,9 +182,9 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2025-01-02 + toolchain: nightly-2025-02-05 - uses: Swatinem/rust-cache@v2 - - run: cargo +nightly-2025-01-02 test --release --features="slow-tests" + - run: cargo +nightly-2025-02-05 test --release --features="slow-tests" run-tests-parallel: runs-on: ubuntu-latest @@ -192,9 +192,9 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2025-01-02 + toolchain: nightly-2025-02-05 - uses: Swatinem/rust-cache@v2 - - run: cargo +nightly-2025-01-02 test --features="parallel" + - run: cargo +nightly-2025-02-05 test --features="parallel" machete: runs-on: ubuntu-latest @@ -205,9 +205,9 @@ jobs: toolchain: nightly-2024-01-04 - uses: Swatinem/rust-cache@v2 - name: Install Machete - run: cargo +nightly-2025-01-02 install --locked cargo-machete + run: cargo +nightly-2025-02-05 install --locked cargo-machete - name: Run Machete (detect unused dependencies) - run: cargo +nightly-2025-01-02 machete + run: cargo +nightly-2025-02-05 machete all-tests: runs-on: ubuntu-latest diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 05a1482cb..e3efd49d9 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -12,14 +12,14 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: rustfmt - toolchain: nightly-2025-01-02 + toolchain: nightly-2025-02-05 - uses: Swatinem/rust-cache@v2 - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov # TODO: Merge coverage reports for tests on different architectures. # - name: Generate code coverage - run: cargo +nightly-2025-01-02 llvm-cov --codecov --output-path codecov.json + run: cargo +nightly-2025-02-05 llvm-cov --codecov --output-path codecov.json env: RUSTFLAGS: "-C target-feature=+avx512f" - name: Upload coverage to Codecov diff --git a/crates/prover/Cargo.toml b/crates/prover/Cargo.toml index 03e99ae28..21c6bd150 100644 --- a/crates/prover/Cargo.toml +++ b/crates/prover/Cargo.toml @@ -55,9 +55,6 @@ nonstandard-style = "deny" rust-2018-idioms = "deny" unused = "deny" -[lints.clippy] -missing_const_for_fn = "warn" - [[bench]] harness = false name = "bit_rev" diff --git a/crates/prover/src/core/backend/simd/circle.rs b/crates/prover/src/core/backend/simd/circle.rs index 58cb6ed8d..4bf7ff5fa 100644 --- a/crates/prover/src/core/backend/simd/circle.rs +++ b/crates/prover/src/core/backend/simd/circle.rs @@ -1,5 +1,6 @@ use std::iter::zip; use std::mem::transmute; +use std::ops::Div; use std::simd::Simd; use bytemuck::Zeroable; @@ -76,7 +77,7 @@ impl SimdBackend { mappings.reverse(); let n = mappings.len(); let n0 = (n - LOG_N_LANES as usize) / 2; - let n1 = (n - LOG_N_LANES as usize + 1) / 2; + let n1 = (n - LOG_N_LANES as usize).div_ceil(2); let (ab, c) = mappings.split_at_mut(n1); let (a, _b) = ab.split_at_mut(n0); // Swap content of a,c. @@ -391,7 +392,7 @@ fn slow_eval_at_point( if poly.log_size() > CACHED_FFT_LOG_SIZE { let n = mappings.len(); let n0 = (n - LOG_N_LANES as usize) / 2; - let n1 = (n - LOG_N_LANES as usize + 1) / 2; + let n1 = (n - LOG_N_LANES as usize).div(2); let (ab, c) = mappings.split_at_mut(n1); let (a, _b) = ab.split_at_mut(n0); // Swap content of a,c. diff --git a/crates/prover/src/core/circle.rs b/crates/prover/src/core/circle.rs index a20ee3451..9f7c99d82 100644 --- a/crates/prover/src/core/circle.rs +++ b/crates/prover/src/core/circle.rs @@ -126,8 +126,7 @@ impl + FieldExpOps + Sub + Neg type Output = Self; fn add(self, rhs: Self) -> Self::Output { - // TODO(ShaharS): Revert once Rust solves compiler [issue](https://github.com/rust-lang/rust/issues/134457). - let x = self.x.clone() * rhs.x.clone() + (-self.y.clone() * rhs.y.clone()); + let x = self.x.clone() * rhs.x.clone() - self.y.clone() * rhs.y.clone(); let y = self.x * rhs.y + self.y * rhs.x; Self { x, y } } diff --git a/crates/prover/src/core/queries.rs b/crates/prover/src/core/queries.rs index 946380000..7f3e26299 100644 --- a/crates/prover/src/core/queries.rs +++ b/crates/prover/src/core/queries.rs @@ -112,7 +112,7 @@ mod tests { let folded_queries = queries.fold(n_folds); let repeated_folded_queries = folded_queries .iter() - .flat_map(|q| std::iter::repeat(q).take(ratio)); + .flat_map(|q| std::iter::repeat_n(q, ratio)); for (query, folded_query) in queries.iter().zip(repeated_folded_queries) { // Check only the x coordinate since folding might give you the conjugate point. assert_eq!( diff --git a/crates/prover/src/core/vcs/blake2_merkle.rs b/crates/prover/src/core/vcs/blake2_merkle.rs index 15e043723..1500b0d98 100644 --- a/crates/prover/src/core/vcs/blake2_merkle.rs +++ b/crates/prover/src/core/vcs/blake2_merkle.rs @@ -31,7 +31,7 @@ impl MerkleHasher for Blake2sMerkleHasher { let padded_values = column_values .iter() .copied() - .chain(std::iter::repeat(BaseField::zero()).take(rem)); + .chain(std::iter::repeat_n(BaseField::zero(), rem)); for chunk in padded_values.array_chunks::<16>() { state = compress( state, diff --git a/crates/prover/src/core/vcs/poseidon252_merkle.rs b/crates/prover/src/core/vcs/poseidon252_merkle.rs index f39a2c62d..88fa66cad 100644 --- a/crates/prover/src/core/vcs/poseidon252_merkle.rs +++ b/crates/prover/src/core/vcs/poseidon252_merkle.rs @@ -32,7 +32,7 @@ impl MerkleHasher for Poseidon252MerkleHasher { let padded_values = column_values .iter() .copied() - .chain(std::iter::repeat(BaseField::zero()).take(padding_length)); + .chain(std::iter::repeat_n(BaseField::zero(), padding_length)); for chunk in padded_values.array_chunks::() { let mut word = FieldElement252::default(); for x in chunk { diff --git a/crates/prover/src/examples/xor/gkr_lookups/accumulation.rs b/crates/prover/src/examples/xor/gkr_lookups/accumulation.rs index 8e0ae2d74..69c01c8e2 100644 --- a/crates/prover/src/examples/xor/gkr_lookups/accumulation.rs +++ b/crates/prover/src/examples/xor/gkr_lookups/accumulation.rs @@ -136,7 +136,7 @@ impl DynMle { #[cfg(test)] mod tests { - use std::iter::repeat; + use std::iter::repeat_n; use num_traits::Zero; @@ -183,6 +183,6 @@ mod tests { B: MleOps, F: Field, { - Mle::new(repeat(v).take(1 << n_variables).collect()) + Mle::new(repeat_n(v, 1 << n_variables).collect()) } } diff --git a/crates/prover/src/examples/xor/gkr_lookups/mle_eval.rs b/crates/prover/src/examples/xor/gkr_lookups/mle_eval.rs index bde4097a2..2ba65c33e 100644 --- a/crates/prover/src/examples/xor/gkr_lookups/mle_eval.rs +++ b/crates/prover/src/examples/xor/gkr_lookups/mle_eval.rs @@ -731,7 +731,7 @@ fn hadamard_product( #[cfg(test)] mod tests { use std::array; - use std::iter::{repeat, zip}; + use std::iter::{repeat_n, zip}; use itertools::{chain, Itertools}; use mle_coeff_column::{MleCoeffColumnComponent, MleCoeffColumnEval}; @@ -988,7 +988,7 @@ mod tests { const EQ_EVAL_TRACE: usize = 0; const AUX_TRACE: usize = 1; let mut rng = SmallRng::seed_from_u64(0); - let mle = Mle::new(repeat(SecureField::one()).take(1 << N_VARIABLES).collect()); + let mle = Mle::new(repeat_n(SecureField::one(), 1 << N_VARIABLES).collect()); let eval_point: [SecureField; N_VARIABLES] = array::from_fn(|_| rng.gen()); let mle_eval_point = MleEvalPoint::new(&eval_point); let trace = build_trace(&mle, &eval_point, mle.eval_at_point(&eval_point)); @@ -1025,7 +1025,7 @@ mod tests { const EQ_EVAL_TRACE: usize = 0; const AUX_TRACE: usize = 1; let mut rng = SmallRng::seed_from_u64(0); - let mle = Mle::new(repeat(SecureField::one()).take(1 << N_VARIABLES).collect()); + let mle = Mle::new(repeat_n(SecureField::one(), 1 << N_VARIABLES).collect()); let eval_point: [SecureField; N_VARIABLES] = array::from_fn(|_| rng.gen()); let mle_eval_point = MleEvalPoint::new(&eval_point); let trace = build_trace(&mle, &eval_point, mle.eval_at_point(&eval_point)); @@ -1062,7 +1062,7 @@ mod tests { const EQ_EVAL_TRACE: usize = 0; const AUX_TRACE: usize = 1; let mut rng = SmallRng::seed_from_u64(0); - let mle = Mle::new(repeat(SecureField::one()).take(1 << N_VARIABLES).collect()); + let mle = Mle::new(repeat_n(SecureField::one(), 1 << N_VARIABLES).collect()); let eval_point: [SecureField; N_VARIABLES] = array::from_fn(|_| rng.gen()); let mle_eval_point = MleEvalPoint::new(&eval_point); let trace = build_trace(&mle, &eval_point, mle.eval_at_point(&eval_point)); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 27381425f..416081fbb 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly-2025-01-02" +channel = "nightly-2025-02-05" diff --git a/scripts/clippy.sh b/scripts/clippy.sh index 9198c8648..bcad1c049 100755 --- a/scripts/clippy.sh +++ b/scripts/clippy.sh @@ -1,3 +1,3 @@ #!/bin/bash -cargo +nightly-2025-01-02 clippy "$@" --all-targets --all-features -- -D warnings -D future-incompatible \ +cargo +nightly-2025-02-05 clippy "$@" --all-targets --all-features -- -D warnings -D future-incompatible \ -D nonstandard-style -D rust-2018-idioms -D unused diff --git a/scripts/rust_fmt.sh b/scripts/rust_fmt.sh index 9f80b191c..a070f4aca 100755 --- a/scripts/rust_fmt.sh +++ b/scripts/rust_fmt.sh @@ -1,3 +1,3 @@ #!/bin/bash -cargo +nightly-2025-01-02 fmt --all -- "$@" +cargo +nightly-2025-02-05 fmt --all -- "$@" diff --git a/scripts/test_avx.sh b/scripts/test_avx.sh index eb4429d3a..6776fdb1a 100755 --- a/scripts/test_avx.sh +++ b/scripts/test_avx.sh @@ -1,4 +1,4 @@ #!/bin/bash # Can be used as a drop in replacement for `cargo test` with avx512f flag on. # For example, `./scripts/test_avx.sh` will run all tests(not only avx). -RUSTFLAGS="-Awarnings -C target-cpu=native -C target-feature=+avx512f -C opt-level=2" cargo +nightly-2025-01-02 test "$@" +RUSTFLAGS="-Awarnings -C target-cpu=native -C target-feature=+avx512f -C opt-level=2" cargo +nightly-2025-02-05 test "$@"