mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-09 01:03:08 +00:00
more trials
This commit is contained in:
parent
74c2be5090
commit
af0ea25fc8
@ -1,3 +1,4 @@
|
||||
use std::collections::HashMap;
|
||||
use std::convert::{identity, TryInto};
|
||||
use std::fmt::Debug;
|
||||
|
||||
@ -198,6 +199,11 @@ pub(crate) fn generate_partial_witness<F: Field>(
|
||||
}
|
||||
});
|
||||
|
||||
let mut parents: HashMap<usize, Vec<usize>> = HashMap::new();
|
||||
for i in 0..witness.0.len() {
|
||||
parents.entry(witness.0[i].parent).or_default().push(i);
|
||||
}
|
||||
|
||||
// Build a list of "pending" generators which are queued to be run. Initially, all generators
|
||||
// are queued.
|
||||
let mut pending_generator_indices: Vec<_> = (0..generators.len()).collect();
|
||||
@ -217,14 +223,20 @@ pub(crate) fn generate_partial_witness<F: Field>(
|
||||
}
|
||||
|
||||
let finished = generators[generator_idx].run(&witness, &mut buffer);
|
||||
// dbg!(&generators[generator_idx], &buffer);
|
||||
if finished {
|
||||
generator_is_expired[generator_idx] = true;
|
||||
}
|
||||
|
||||
// Enqueue unfinished generators that were watching one of the newly populated targets.
|
||||
for &(watch, _) in &buffer.target_values {
|
||||
for &watching_generator_idx in &generator_indices_by_watches[witness.1(watch)] {
|
||||
next_pending_generator_indices.push(watching_generator_idx);
|
||||
let parent = witness.0[witness.1(watch)].parent;
|
||||
for &yo in &parents[&parent] {
|
||||
for &watching_generator_idx in &generator_indices_by_watches[yo] {
|
||||
if !generator_is_expired[watching_generator_idx] {
|
||||
next_pending_generator_indices.push(watching_generator_idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,17 +246,12 @@ pub(crate) fn generate_partial_witness<F: Field>(
|
||||
pending_generator_indices = next_pending_generator_indices;
|
||||
}
|
||||
|
||||
for i in 0..degree {
|
||||
for j in 0..num_wires {
|
||||
if !witness.contains(Target::Wire(Wire { gate: i, input: j })) {
|
||||
println!("{} {}", i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
// for i in 0..generator_is_expired.len() {
|
||||
// if !generator_is_expired[i] {
|
||||
// println!("{:?}", generators[i]);
|
||||
// println!("{:?}", generators[i].watch_list());
|
||||
// println!("{}: {:?}", i, generators[i]);
|
||||
// for a in generators[i].watch_list() {
|
||||
// println!("{:?} {}", a, witness.contains(a));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
assert!(
|
||||
@ -266,6 +273,7 @@ pub trait WitnessGenerator<F: Field>: 'static + Send + Sync + Debug {
|
||||
}
|
||||
|
||||
/// Values generated by a generator invocation.
|
||||
#[derive(Debug)]
|
||||
pub struct GeneratedValues<F: Field> {
|
||||
pub(crate) target_values: Vec<(Target, F)>,
|
||||
}
|
||||
|
||||
@ -35,8 +35,9 @@ pub(crate) fn prove<F: Extendable<D>, const D: usize>(
|
||||
let num_challenges = config.num_challenges;
|
||||
let quotient_degree = common_data.quotient_degree();
|
||||
let degree = common_data.degree();
|
||||
println!("{}", prover_data.gate_instances[0].gate_ref.0.id());
|
||||
println!("{}", prover_data.gate_instances[1].gate_ref.0.id());
|
||||
// for i in 0..prover_data.gate_instances.len() {
|
||||
// println!("{}: {}", i, prover_data.gate_instances[i].gate_ref.0.id());
|
||||
// }
|
||||
|
||||
let nrw = config.num_routed_wires;
|
||||
let nw = config.num_wires;
|
||||
@ -71,6 +72,12 @@ pub(crate) fn prove<F: Extendable<D>, const D: usize>(
|
||||
partial_witness[parent].value = Some(v);
|
||||
}
|
||||
});
|
||||
// let t = partial_witness[target_index(Target::Wire(Wire {
|
||||
// gate: 14,
|
||||
// input: 16,
|
||||
// }))];
|
||||
// dbg!(t);
|
||||
// dbg!(partial_witness[t.parent]);
|
||||
// let mut partial_witness = inputs;
|
||||
let mut partial_witness = Yo(partial_witness, Box::new(target_index));
|
||||
timed!(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user