Skip to content

Commit

Permalink
feat: remove assign in airs (#1710)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtguibas authored Oct 29, 2024
1 parent c3d4d36 commit 465581f
Show file tree
Hide file tree
Showing 25 changed files with 166 additions and 180 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ jobs:
env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native
RUST_BACKTRACE: 1
# FRI_QUERIES: 1
SP1_DEV: 1

test-arm:
Expand Down Expand Up @@ -89,7 +88,6 @@ jobs:
env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native
RUST_BACKTRACE: 1
# FRI_QUERIES: 1
SP1_DEV: 1

lint:
Expand Down
96 changes: 38 additions & 58 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 40 additions & 40 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,49 +71,49 @@ sp1-lib = { path = "crates/zkvm/lib", version = "3.0.0", default-features = fals
sp1-zkvm = { path = "crates/zkvm/entrypoint", version = "3.0.1", default-features = false }

# p3
p3-air = "0.1.4-succinct"
p3-field = "0.1.4-succinct"
p3-commit = "0.1.4-succinct"
p3-matrix = "0.1.4-succinct"
p3-baby-bear = { version = "0.1.4-succinct", features = ["nightly-features"] }
p3-util = "0.1.4-succinct"
p3-challenger = "0.1.4-succinct"
p3-dft = "0.1.4-succinct"
p3-fri = "0.1.4-succinct"
p3-goldilocks = "0.1.4-succinct"
p3-keccak = "0.1.4-succinct"
p3-keccak-air = "0.1.4-succinct"
p3-blake3 = "0.1.4-succinct"
p3-mds = "0.1.4-succinct"
p3-merkle-tree = "0.1.4-succinct"
p3-poseidon2 = "0.1.4-succinct"
p3-symmetric = "0.1.4-succinct"
p3-uni-stark = "0.1.4-succinct"
p3-maybe-rayon = "0.1.4-succinct"
p3-bn254-fr = "0.1.4-succinct"
# p3-air = "0.1.4-succinct"
# p3-field = "0.1.4-succinct"
# p3-commit = "0.1.4-succinct"
# p3-matrix = "0.1.4-succinct"
# p3-baby-bear = { version = "0.1.4-succinct", features = ["nightly-features"] }
# p3-util = "0.1.4-succinct"
# p3-challenger = "0.1.4-succinct"
# p3-dft = "0.1.4-succinct"
# p3-fri = "0.1.4-succinct"
# p3-goldilocks = "0.1.4-succinct"
# p3-keccak = "0.1.4-succinct"
# p3-keccak-air = "0.1.4-succinct"
# p3-blake3 = "0.1.4-succinct"
# p3-mds = "0.1.4-succinct"
# p3-merkle-tree = "0.1.4-succinct"
# p3-poseidon2 = "0.1.4-succinct"
# p3-symmetric = "0.1.4-succinct"
# p3-uni-stark = "0.1.4-succinct"
# p3-maybe-rayon = "0.1.4-succinct"
# p3-bn254-fr = "0.1.4-succinct"

# For local development.

# p3-air = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-field = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-commit = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-matrix = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-baby-bear = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-util = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-challenger = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-dft = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-fri = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-goldilocks = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-keccak = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-keccak-air = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-blake3 = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-mds = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-merkle-tree = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-poseidon2 = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-symmetric = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-uni-stark = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-maybe-rayon = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
# p3-bn254-fr = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v3" }
p3-air = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-field = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-commit = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-matrix = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-baby-bear = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-util = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-challenger = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-dft = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-fri = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-goldilocks = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-keccak = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-keccak-air = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-blake3 = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-mds = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-merkle-tree = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-poseidon2 = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-symmetric = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-uni-stark = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-maybe-rayon = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }
p3-bn254-fr = { git = "https://github.com/Plonky3/Plonky3", branch = "sp1-v4" }

# p3-air = { path = "../Plonky3/air" }
# p3-field = { path = "../Plonky3/field" }
Expand Down
16 changes: 10 additions & 6 deletions crates/core/machine/src/alu/divrem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,16 +556,20 @@ where

// Add remainder.
if i < WORD_SIZE {
c_times_quotient_plus_remainder[i] += local.remainder[i].into();
c_times_quotient_plus_remainder[i] =
c_times_quotient_plus_remainder[i].clone() + local.remainder[i].into();
} else {
// If rem is negative, add 0xff to the upper 4 bytes.
c_times_quotient_plus_remainder[i] += sign_extension.clone();
c_times_quotient_plus_remainder[i] =
c_times_quotient_plus_remainder[i].clone() + sign_extension.clone();
}

// Propagate carry.
c_times_quotient_plus_remainder[i] -= local.carry[i] * base;
c_times_quotient_plus_remainder[i] =
c_times_quotient_plus_remainder[i].clone() - local.carry[i] * base;
if i > 0 {
c_times_quotient_plus_remainder[i] += local.carry[i - 1].into();
c_times_quotient_plus_remainder[i] =
c_times_quotient_plus_remainder[i].clone() + local.carry[i - 1].into();
}
}

Expand Down Expand Up @@ -612,8 +616,8 @@ where
let mut rem_byte_sum = zero.clone();
let mut b_byte_sum = zero.clone();
for i in 0..WORD_SIZE {
rem_byte_sum += local.remainder[i].into();
b_byte_sum += local.b[i].into();
rem_byte_sum = rem_byte_sum.clone() + local.remainder[i].into();
b_byte_sum = b_byte_sum + local.b[i].into();
}

// 1. If remainder < 0, then b < 0.
Expand Down
6 changes: 3 additions & 3 deletions crates/core/machine/src/alu/lt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,10 @@ where
{
// Once the byte flag was set to one, we turn off the quality check flag.
// We can do this by calculating the sum of the flags since only `1` is set to `1`.
is_inequality_visited += flag.into();
is_inequality_visited = is_inequality_visited.clone() + flag.into();

b_comparison_byte += b_byte.clone() * flag;
c_comparison_byte += c_byte.clone() * flag;
b_comparison_byte = b_comparison_byte.clone() + b_byte.clone() * flag;
c_comparison_byte = c_comparison_byte.clone() + c_byte.clone() * flag;

// If inequality is not visited, assert that the bytes are equal.
builder
Expand Down
2 changes: 1 addition & 1 deletion crates/core/machine/src/alu/mul/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ where
for i in 0..PRODUCT_SIZE {
for j in 0..PRODUCT_SIZE {
if i + j < PRODUCT_SIZE {
m[i + j] += b[i].clone() * c[j].clone();
m[i + j] = m[i + j].clone() + b[i].clone() * c[j].clone();
}
}
}
Expand Down
Loading

0 comments on commit 465581f

Please sign in to comment.