This commit is contained in:
Daniel Lubarov 2021-02-28 21:43:10 -08:00
parent 58425eb548
commit 45da024aef
2 changed files with 7 additions and 11 deletions

View File

@ -97,12 +97,7 @@ impl<F: Field, const W: usize, const R: usize> DeterministicGate<F> for GMiMCGat
.map(|(i, out)| (GateOutputLocation::NextWire(Self::wire_output(i)), out)) .map(|(i, out)| (GateOutputLocation::NextWire(Self::wire_output(i)), out))
.collect(); .collect();
// A degree of 9 is reasonable for most circuits, and it means that we only need wires for OutputGraph { outputs }
// every other addition buffer state.
println!("before");
let out = OutputGraph { outputs }.shrink_degree(9);
println!("after");
out
} }
fn additional_constraints(&self, _config: CircuitConfig) -> Vec<ConstraintPolynomial<F>> { fn additional_constraints(&self, _config: CircuitConfig) -> Vec<ConstraintPolynomial<F>> {

View File

@ -31,7 +31,7 @@ mod wire;
mod witness; mod witness;
// 12 wire polys, 3 Z polys, 4 parts of quotient poly. // 12 wire polys, 3 Z polys, 4 parts of quotient poly.
const PROVER_POLYS: usize = 101 + 3 + 4; // TODO: Check const PROVER_POLYS: usize = 64 + 3 + (9 + 1); // TODO: Check
fn main() { fn main() {
let overall_start = Instant::now(); let overall_start = Instant::now();
@ -55,16 +55,17 @@ fn bench_gmimc<F: Field>() {
constants[i] = F::from_canonical_u64(GMIMC_CONSTANTS[i]); constants[i] = F::from_canonical_u64(GMIMC_CONSTANTS[i]);
} }
let threads = 12; const THREADS: usize = 12;
let hashes_per_poly = 1 << (13 + 3); const LDE_BITS: i32 = 4;
let threads = (0..threads).map(|_i| { let hashes_per_poly = 1 << (13 + LDE_BITS);
let threads = (0..THREADS).map(|_i| {
thread::spawn(move || { thread::spawn(move || {
let mut x = [F::ZERO; 12]; let mut x = [F::ZERO; 12];
for i in 0..12 { for i in 0..12 {
x[i] = F::from_canonical_u64((i as u64) * 123456 + 789); x[i] = F::from_canonical_u64((i as u64) * 123456 + 789);
} }
let hashes_per_thread = hashes_per_poly * PROVER_POLYS / threads; let hashes_per_thread = hashes_per_poly * PROVER_POLYS / THREADS;
let start = Instant::now(); let start = Instant::now();
for _ in 0..hashes_per_thread { for _ in 0..hashes_per_thread {
x = gmimc::gmimc_permute_array::<_, 12, GMIMC_ROUNDS>(x, GMIMC_CONSTANTS); x = gmimc::gmimc_permute_array::<_, 12, GMIMC_ROUNDS>(x, GMIMC_CONSTANTS);