Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
ec8f61e
benches and tests set up
z-tech Feb 18, 2025
68b3299
linter
z-tech Feb 18, 2025
fcf7efe
fix non neon impl
z-tech Feb 18, 2025
3b0fcda
fix non neon impl 2
z-tech Feb 18, 2025
51d3e4c
add trait implementations
benbencik May 22, 2025
42a7ac6
add fp config from algebra
benbencik May 29, 2025
fdd3d98
add hot-fixes to make FpConfig appropriate for older ark_ff
benbencik May 29, 2025
0d6676d
the most basic macro...but works
benbencik Jun 5, 2025
b0dcb5c
copy FpConfig and add hot fixes
benbencik Jun 11, 2025
1212a48
add garbage that compiles
benbencik Jun 12, 2025
5561e7c
add From implementaitons
benbencik Jun 26, 2025
b841569
fix display trait
benbencik Jul 2, 2025
c3eaa65
fix bigint 2
benbencik Jul 8, 2025
29af509
add new
benbencik Jul 8, 2025
a6215e1
make bigint limbs constant
benbencik Jul 9, 2025
884467b
correct indexing of bigint
benbencik Jul 9, 2025
906aa00
fix some todos
benbencik Jul 9, 2025
00f76ce
add naive implementation for inverse
benbencik Jul 9, 2025
1b9a77d
add tests
benbencik Jul 9, 2025
f40a159
run checks on any PR
z-tech Jul 11, 2025
f330ac3
bump to arkworks 0.5
z-tech Jul 11, 2025
30f3a97
merge main
z-tech Jul 11, 2025
60c3b1c
add constant for fixed bigint limbs
benbencik Aug 6, 2025
32af43b
split small fp backend into modules
benbencik Aug 6, 2025
c5e4999
add benches for small fields
benbencik Aug 14, 2025
e476cb6
add dummy separate backend for field arithermtic
benbencik Aug 14, 2025
06fce99
BigInteger expects least-significant limb first.
benbencik Aug 21, 2025
b3f8000
extends tests with small field
benbencik Aug 21, 2025
02cb1e8
add tests
benbencik Aug 22, 2025
57171ec
add overflow handling
benbencik Aug 23, 2025
84a91df
merge main
z-tech Aug 27, 2025
048e9c4
add garbage mont backend
benbencik Aug 27, 2025
eef2324
fix later
benbencik Aug 27, 2025
7607868
move contructor to backend implementation
benbencik Sep 8, 2025
5b7449f
add montgomery prototype
benbencik Sep 8, 2025
70d3e33
select R based on modulus
benbencik Sep 8, 2025
e2e820e
fix errors in multiplication for standard backend
benbencik Sep 16, 2025
d790d99
add computation of two adicity for standard backend
benbencik Sep 16, 2025
85fb1bb
add two adicity computation to mont backend
benbencik Sep 16, 2025
3c63985
cleanup
benbencik Sep 16, 2025
4e16d72
add benches
benbencik Sep 16, 2025
ef1c24b
add implementation for random sampling
benbencik Sep 17, 2025
e2b3566
do not use modulus_128
benbencik Sep 17, 2025
6116c05
fix failing test
benbencik Sep 17, 2025
5c9cb75
rewrite add_assign
benbencik Sep 17, 2025
caa547d
simplify from conversion
benbencik Sep 19, 2025
f715dac
exiting mont domain
benbencik Sep 19, 2025
ab33b8e
add tests for mont field
benbencik Sep 19, 2025
b3ca510
refactor to get rid of safe_mul function in the trait
benbencik Sep 24, 2025
1f87172
simplify neg in place
benbencik Sep 24, 2025
be37213
polish the trait definition
benbencik Sep 24, 2025
6ac0790
refactor bigint casts
benbencik Sep 24, 2025
8dfcef2
fix formating
benbencik Sep 24, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
branches-ignore: []

env:
CARGO_TERM_COLOR: always
Expand Down
18 changes: 17 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ edition = "2021"
[dependencies]
ark-ff = "0.5.0"
ark-poly = "0.5.0"
ark-std = "0.5.0"
ark-serialize = "0.5.0"
ark-std ="0.5.0"
num-bigint = "0.4"
num-traits = "0.2"
zeroize = "1.8.1"
itertools = "0.10.5"
educe = "0.6.0"
memmap2 = "0.9.5"
rayon = { version = "1.10", optional = true }
fields_macro = { path = "fields_macro" }

[dev-dependencies]
criterion = "0.7"
Expand All @@ -31,3 +37,13 @@ parallel = [
name = "provers"
path = "benches/provers.rs"
harness = false

[[bench]]
name = "arithmetic_backend"
path = "benches/arithmetic_backend.rs"
harness = false

[[bench]]
name = "cast_128"
path = "benches/cast_128.rs"
harness = false
33 changes: 33 additions & 0 deletions benches/arithmetic_backend.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use ark_ff::Field;
use criterion::{criterion_group, criterion_main, Criterion};
use space_efficient_sumcheck::tests::{SmallF32, SmallF32Mont};
use std::hint::black_box;

fn bench_mul_standard(c: &mut Criterion) {
c.bench_function("SmallField_mul", |b| {
b.iter(|| {
let mut v = SmallF32::ONE;
let v2 = SmallF32::new(20);
for _ in 0..1_000_000 {
v *= v2;
}
black_box(v);
})
});
}

fn bench_mul_montgomery(c: &mut Criterion) {
c.bench_function("SmallFieldMont_mul", |b| {
b.iter(|| {
let mut v = SmallF32Mont::ONE;
let v2 = SmallF32Mont::new(20);
for _ in 0..1_000_000 {
v *= v2;
}
black_box(v);
})
});
}

criterion_group!(benches, bench_mul_standard, bench_mul_montgomery);
criterion_main!(benches);
49 changes: 49 additions & 0 deletions benches/cast_128.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
use criterion::{criterion_group, criterion_main, Criterion};
use std::hint::black_box;

fn mult_u128(c: &mut Criterion) {
c.bench_function("u128_mult", |b| {
b.iter(|| {
let a: u8 = 5;
let b: u8 = 254;
let c: u128 = (a as u128) * (b as u128);
black_box((c % 255) as u8);
})
});
}

fn mult_u16(c: &mut Criterion) {
c.bench_function("u16_mult", |b| {
b.iter(|| {
let a: u8 = 5;
let b: u8 = 254;
let c: u16 = (a as u16) * (b as u16);
black_box((c % 255) as u8);
})
});
}

fn add_u128(c: &mut Criterion) {
c.bench_function("u128_add", |b| {
b.iter(|| {
let a: u8 = 5;
let b: u8 = 254;
let c: u128 = (a as u128) + (b as u128);
black_box((c % 255) as u8);
})
});
}

fn add_u16(c: &mut Criterion) {
c.bench_function("u8_add", |b| {
b.iter(|| {
let a: u8 = 5;
let b: u8 = 25;
let c: u8 = a + b;
black_box((c % 255) as u8);
})
});
}

criterion_group!(benches, mult_u128, mult_u16, add_u128, add_u16);
criterion_main!(benches);
4 changes: 3 additions & 1 deletion benches/explanation.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
fn main() {
eprintln!("Error: This project uses a custom benchmarking workflow.");
eprintln!("Please navigate to the appropriate bench directory and call the shell './run_bench.sh' directly.");
eprintln!("Please choose a bench:");
eprintln!(" Full Protocol Benches: 'cd ./benches/sumcheck-benches/ && cargo build --release && ./run_benches.sh'");
eprintln!(" Lagrange Polynomial Benches: 'cd ./benches/lag-poly-benches/ && cargo build --release && ./run_benches.sh'");
std::process::exit(1);
}
4 changes: 4 additions & 0 deletions benches/lag-poly-benches/Cargo.lock

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

24 changes: 16 additions & 8 deletions benches/sumcheck-benches/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ use space_efficient_sumcheck::{
TimeProverConfig,
},
multilinear_product::{
BlendyProductProver, BlendyProductProverConfig, TimeProductProver, TimeProductProverConfig, SpaceProductProver,
SpaceProductProverConfig,
BlendyProductProver, BlendyProductProverConfig, SpaceProductProver,
SpaceProductProverConfig, TimeProductProver, TimeProductProverConfig,
},
order_strategy::SignificantBitOrder,
prover::{Prover, ProverConfig},
streams::{multivariate_claim, multivariate_product_claim},
tests::{BenchStream, F128, F64},
tests::{BenchStream, SmallF128, SmallF32, SmallF64, F128, F64},
ProductSumcheck, Sumcheck,
};

Expand All @@ -34,11 +34,10 @@ fn run_on_field<F: Field>(bench_args: BenchArgs) {
bench_args.num_variables,
s,
);
let transcript =
Sumcheck::<F>::prove::<BenchStream<F>, BlendyProver<F, BenchStream<F>>>(
&mut BlendyProver::<F, BenchStream<F>>::new(config),
&mut rng,
);
let transcript = Sumcheck::<F>::prove::<BenchStream<F>, BlendyProver<F, BenchStream<F>>>(
&mut BlendyProver::<F, BenchStream<F>>::new(config),
&mut rng,
);
assert!(transcript.is_accepted);
}
AlgorithmLabel::VSBW => {
Expand Down Expand Up @@ -133,5 +132,14 @@ fn main() {
FieldLabel::FieldBn254 => {
run_on_field::<BN254Field>(bench_args);
}
FieldLabel::SmallF32 => {
run_on_field::<SmallF32>(bench_args);
}
FieldLabel::SmallF64 => {
run_on_field::<SmallF64>(bench_args);
}
FieldLabel::SmallF128 => {
run_on_field::<SmallF128>(bench_args);
}
};
}
18 changes: 16 additions & 2 deletions benches/sumcheck-benches/src/validation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ pub enum FieldLabel {
Field64,
Field128,
FieldBn254,
SmallF32,
SmallF64,
SmallF128,
}

#[derive(Debug)]
Expand Down Expand Up @@ -62,17 +65,28 @@ pub fn validate_and_format_command_line_args(argsv: Vec<String>) -> BenchArgs {
_ => AlgorithmLabel::ProductBlendy, // this is checked in previous line
};
// field_label
if !(argsv[2] == "Field64" || argsv[2] == "Field128" || argsv[2] == "FieldBn254") {
if !(argsv[2] == "Field64"
|| argsv[2] == "Field128"
|| argsv[2] == "FieldBn254"
|| argsv[2] == "SmallF32"
|| argsv[2] == "SmallF64"
|| argsv[2] == "SmallF128")
{
eprintln!(
"Usage: {} field_label algorithm_label num_variables stage_size",
argsv[0]
);
eprintln!("Invalid input: field_label must be one of (Field64, Field128, FieldBn254)");
eprintln!(
"Invalid input: field_label must be one of (Field64, Field128, FieldBn254, SmallF32, SmallF64, SmallF128)"
);
std::process::exit(1);
}
let field_label = match argsv[2].as_str() {
"Field64" => FieldLabel::Field64,
"Field128" => FieldLabel::Field128,
"SmallF32" => FieldLabel::SmallF32,
"SmallF64" => FieldLabel::SmallF64,
"SmallF128" => FieldLabel::SmallF128,
_ => FieldLabel::FieldBn254, // this is checked in previous line
};
// num_variables
Expand Down
Loading