Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions Cargo.lock

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

12 changes: 4 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,29 @@
members = [
"arith", # definitions of Field, Extensions, SIMDS
"arith/babybear",
"arith/gf2",
"arith/gf2_128",
"arith/goldilocks",
"arith/mersenne31",
"arith/polynomials",
"bin", # binary executables
"circuit",
"config_macros", # proc macros used to declare a new config, this has to a separate crate due to rust compilation issues
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The config_macros crate is removed from the workspace members, but it appears to be still in use in other parts of the codebase (e.g., in gkr/src/gkr_configs.rs). This will likely cause the build to fail because path dependencies to non-workspace members are not resolved correctly. Please consider re-adding config_macros to the workspace members.

A similar issue might exist for serdes_derive (removed on line 18) if it's still in use.

"gkr",
"gkr_engine", # definitions of GKR engine and associated types
"hasher", # definitions of FiatShamirFieldHasher, FiatShamirBytesHash, and associated types
"poly_commit",
"serdes", # serialization and deserialization of various data structures
"serdes_derive",
"sumcheck",
"crosslayer_prototype",
"transcript", # instantiations of transcripts
"tree",
"utils",
]
resolver = "2"

[workspace.dependencies]
ark-std = "0.4"
ark-bn254 = "0.4.0"
ark-ec = "0.4.0"
ark-ff = { version = "0.4" }
ark-std = "0.5"
ark-bn254 = "0.5.0"
ark-ec = "0.5.0"
ark-ff = "0.5.0"
bytes = "1.6.0"
chrono = "0.4.38"
clap = { version = "4.1", features = ["derive"] }
Expand Down
11 changes: 10 additions & 1 deletion arith/babybear/src/babybear_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,20 @@ impl From<u32> for BabyBearExt3 {
}
}

impl From<u64> for BabyBearExt3 {
#[inline(always)]
fn from(x: u64) -> Self {
BabyBearExt3 {
v: [BabyBear::from(x), BabyBear::zero(), BabyBear::zero()],
}
}
}

impl FFTField for BabyBearExt3 {
const TWO_ADICITY: usize = 27;

fn root_of_unity() -> Self {
Self::from(0x1a427a41)
Self::from(0x1a427a41u32)
}
}

Expand Down
15 changes: 14 additions & 1 deletion arith/babybear/src/babybear_ext3x16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl FFTField for BabyBearExt3x16 {
const TWO_ADICITY: usize = 27;

fn root_of_unity() -> Self {
Self::from(0x1a427a41)
Self::from(0x1a427a41u32)
}
}

Expand Down Expand Up @@ -333,6 +333,19 @@ impl From<u32> for BabyBearExt3x16 {
}
}

impl From<u64> for BabyBearExt3x16 {
#[inline(always)]
fn from(x: u64) -> Self {
BabyBearExt3x16 {
v: [
BabyBearx16::from(x),
BabyBearx16::zero(),
BabyBearx16::zero(),
],
}
}
}

#[inline(always)]
fn add_internal(a: &BabyBearExt3x16, b: &BabyBearExt3x16) -> BabyBearExt3x16 {
let mut vv = a.v;
Expand Down
2 changes: 1 addition & 1 deletion arith/babybear/src/babybearx16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ impl FFTField for BabyBearx16 {
const TWO_ADICITY: usize = 27;

fn root_of_unity() -> Self {
Self::from(0x1a427a41)
Self::from(0x1a427a41u32)
}
}
7 changes: 7 additions & 0 deletions arith/babybear/src/babybearx16/babybear_avx256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,13 @@ impl From<u32> for AVXBabyBear {
}
}

impl From<u64> for AVXBabyBear {
#[inline(always)]
fn from(x: u64) -> Self {
AVXBabyBear::pack_full(&BabyBear::from(x))
}
}

impl Neg for AVXBabyBear {
type Output = AVXBabyBear;
#[inline(always)]
Expand Down
7 changes: 7 additions & 0 deletions arith/babybear/src/babybearx16/babybear_avx512.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,13 @@ impl From<u32> for AVXBabyBear {
}
}

impl From<u64> for AVXBabyBear {
#[inline(always)]
fn from(x: u64) -> Self {
AVXBabyBear::pack_full(&BabyBear::from(x))
}
}

impl Neg for AVXBabyBear {
type Output = AVXBabyBear;
#[inline(always)]
Expand Down
8 changes: 8 additions & 0 deletions arith/babybear/src/babybearx16/babybear_neon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@ impl From<u32> for NeonBabyBear {
}
}

impl From<u64> for NeonBabyBear {
#[inline(always)]
fn from(value: u64) -> Self {
// BabyBear::new converts to Montgomery form
NeonBabyBear::pack_full(&BabyBear::new(value))
}
}

impl Neg for NeonBabyBear {
type Output = Self;

Expand Down
7 changes: 7 additions & 0 deletions arith/gf2/src/gf2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ impl From<u32> for GF2 {
}
}

impl From<u64> for GF2 {
#[inline(always)]
fn from(v: u64) -> Self {
GF2 { v: (v % 2) as u8 }
}
}

impl From<bool> for GF2 {
#[inline(always)]
fn from(value: bool) -> Self {
Expand Down
12 changes: 12 additions & 0 deletions arith/gf2/src/gf2x128/avx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,18 @@ impl From<u32> for AVXGF2x128 {
}
}

impl From<u64> for AVXGF2x128 {
#[inline(always)]
fn from(v: u64) -> Self {
assert!(v < 2);
if v == 0 {
AVXGF2x128::ZERO
} else {
AVXGF2x128::ONE
}
}
}

impl From<GF2> for AVXGF2x128 {
#[inline(always)]
fn from(v: GF2) -> Self {
Expand Down
12 changes: 12 additions & 0 deletions arith/gf2/src/gf2x128/neon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,18 @@ impl From<u32> for NeonGF2x128 {
}
}

impl From<u64> for NeonGF2x128 {
#[inline(always)]
fn from(v: u64) -> Self {
assert!(v < 2);
if v == 0 {
NeonGF2x128::ZERO
} else {
NeonGF2x128::ONE
}
}
}

impl From<GF2> for NeonGF2x128 {
#[inline(always)]
fn from(v: GF2) -> Self {
Expand Down
12 changes: 12 additions & 0 deletions arith/gf2/src/gf2x64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,18 @@ impl From<u32> for GF2x64 {
}
}

impl From<u64> for GF2x64 {
#[inline(always)]
fn from(v: u64) -> Self {
assert!(v < 2);
if v == 0 {
GF2x64 { v: 0 }
} else {
GF2x64 { v: !0u64 }
}
}
}

impl From<GF2> for GF2x64 {
#[inline(always)]
fn from(v: GF2) -> Self {
Expand Down
12 changes: 12 additions & 0 deletions arith/gf2/src/gf2x8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,18 @@ impl From<u32> for GF2x8 {
}
}

impl From<u64> for GF2x8 {
#[inline(always)]
fn from(v: u64) -> Self {
assert!(v < 2);
if v == 0 {
GF2x8 { v: 0 }
} else {
GF2x8 { v: 0xFF }
}
}
}

impl From<GF2> for GF2x8 {
#[inline(always)]
fn from(v: GF2) -> Self {
Expand Down
9 changes: 9 additions & 0 deletions arith/gf2_128/src/gf2_ext128/avx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,15 @@ impl From<u32> for AVXGF2_128 {
}
}

impl From<u64> for AVXGF2_128 {
#[inline(always)]
fn from(v: u64) -> Self {
AVXGF2_128 {
v: unsafe { std::mem::transmute::<[u64; 2], __m128i>([v, 0]) },
}
}
}

#[inline(always)]
fn add_internal(a: &AVXGF2_128, b: &AVXGF2_128) -> AVXGF2_128 {
AVXGF2_128 {
Expand Down
9 changes: 9 additions & 0 deletions arith/gf2_128/src/gf2_ext128/neon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,15 @@ impl From<u32> for NeonGF2_128 {
}
}

impl From<u64> for NeonGF2_128 {
#[inline(always)]
fn from(v: u64) -> Self {
NeonGF2_128 {
v: unsafe { transmute::<[u64; 2], uint32x4_t>([v, 0]) },
}
}
}

// multiply the polynomial by x^32, without reducing the irreducible polynomial
// equivalent to _mm_shuffle_epi32(a, 147)
#[inline(always)]
Expand Down
11 changes: 11 additions & 0 deletions arith/gf2_128/src/gf2_ext128x8/avx256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,17 @@ impl From<u32> for AVX256GF2_128x8 {
}
}

impl From<u64> for AVX256GF2_128x8 {
#[inline(always)]
fn from(v: u64) -> AVX256GF2_128x8 {
assert!(v < 2); // only 0 and 1 are allowed
let data = unsafe { _mm256_set_epi64x(0, v as i64, 0, v as i64) };
AVX256GF2_128x8 {
data: [data, data, data, data],
}
}
}

impl Neg for AVX256GF2_128x8 {
type Output = AVX256GF2_128x8;

Expand Down
9 changes: 9 additions & 0 deletions arith/gf2_128/src/gf2_ext128x8/avx512.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,15 @@ impl From<u32> for AVX512GF2_128x8 {
}
}

impl From<u64> for AVX512GF2_128x8 {
#[inline(always)]
fn from(v: u64) -> AVX512GF2_128x8 {
assert!(v < 2); // only 0 and 1 are allowed
let data = unsafe { _mm512_set_epi64(0, v as i64, 0, v as i64, 0, v as i64, 0, v as i64) };
AVX512GF2_128x8 { data: [data, data] }
}
}

impl Neg for AVX512GF2_128x8 {
type Output = AVX512GF2_128x8;

Expand Down
18 changes: 18 additions & 0 deletions arith/gf2_128/src/gf2_ext128x8/neon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,24 @@ impl From<u32> for NeonGF2_128x8 {
}
}

impl From<u64> for NeonGF2_128x8 {
fn from(v: u64) -> Self {
NeonGF2_128x8 {
v: [
unsafe { transmute::<[u64; 2], uint64x2_t>([v, 0]) },
unsafe { transmute::<[u64; 2], uint64x2_t>([v, 0]) },
unsafe { transmute::<[u64; 2], uint64x2_t>([v, 0]) },
unsafe { transmute::<[u64; 2], uint64x2_t>([v, 0]) },
unsafe { transmute::<[u64; 2], uint64x2_t>([v, 0]) },
unsafe { transmute::<[u64; 2], uint64x2_t>([v, 0]) },
unsafe { transmute::<[u64; 2], uint64x2_t>([v, 0]) },
unsafe { transmute::<[u64; 2], uint64x2_t>([v, 0]) },
unsafe { transmute::<[u64; 2], uint64x2_t>([v, 0]) },
],
}
}
}

#[inline(always)]
fn add_internal(a: &NeonGF2_128x8, b: &NeonGF2_128x8) -> NeonGF2_128x8 {
NeonGF2_128x8 {
Expand Down
10 changes: 10 additions & 0 deletions arith/goldilocks/src/goldilocks_ext2x8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,16 @@ impl From<u32> for GoldilocksExt2x8 {
}
}

impl From<u64> for GoldilocksExt2x8 {
#[inline]
fn from(value: u64) -> Self {
Self {
c0: Goldilocksx8::from(value),
c1: Goldilocksx8::ZERO,
}
}
}

#[inline(always)]
fn add_internal(a: &GoldilocksExt2x8, b: &GoldilocksExt2x8) -> GoldilocksExt2x8 {
GoldilocksExt2x8 {
Expand Down
8 changes: 8 additions & 0 deletions arith/mersenne31/src/m31.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@ impl From<u32> for M31 {
}
}

impl From<u64> for M31 {
#[inline(always)]
fn from(x: u64) -> Self {
assert!(x <= u32::MAX as u64, "Value out of range for M31");
Self::from(x as u32)
}
}

impl M31 {
#[inline(always)]
fn exp_power_of_2(&self, power_log: usize) -> Self {
Expand Down
Loading
Loading