Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
aikixd committed Jan 22, 2024
1 parent 9792001 commit d9c2651
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/dag/resolvers/st.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
awaiters::ImmediateAwaiter,
primitives::{Metadata, OrderIx, ResolverIx, Values},
resolver_box::{invocation_binder, Resolver, ResolverBox},
CircuitResolver, CircuitResolverOpts, WitnessSource, WitnessSourceAwaitable,
CircuitResolver, WitnessSource, WitnessSourceAwaitable,
},
field::SmallField,
utils::PipeOp as _,
Expand All @@ -22,6 +22,20 @@ pub struct StCircuitResolverParams {
pub max_variables: usize,
}

impl From<usize> for StCircuitResolverParams {
fn from(value: usize) -> Self {
Self::new(value)
}
}

impl StCircuitResolverParams {
pub fn new(max_variables: usize) -> Self {
Self { max_variables }
}

Check warning on line 34 in src/dag/resolvers/st.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/era-boojum/era-boojum/src/dag/resolvers/st.rs
}



#[derive(Default)]
struct Stats {
resolvers_added: u32,
Expand All @@ -31,7 +45,7 @@ pub struct StCircuitResolver<F, CFG: CSResolverConfig> {
values: Values<F, OrderIx>,
deferrer: Deferrer,
resolver_box: ResolverBox<F>,
options: CircuitResolverOpts,
options: StCircuitResolverParams,
stats: Stats,
phantom: PhantomData<CFG>,
}
Expand Down Expand Up @@ -227,7 +241,7 @@ impl<F: SmallField, CFG: CSResolverConfig> StCircuitResolver<F, CFG> {
}

impl<F: SmallField, CFG: CSResolverConfig> CircuitResolver<F, CFG> for StCircuitResolver<F, CFG> {
type Arg = CircuitResolverOpts;
type Arg = StCircuitResolverParams;

fn new(opts: Self::Arg) -> Self {
let values = Values {
Expand Down Expand Up @@ -316,6 +330,7 @@ impl Deferrer {
#[cfg(test)]
mod test {
use crate::dag::*;
use crate::dag::resolvers::StCircuitResolverParams;
use crate::{
config::{CSConfig, DevCSConfig},
cs::{traits::cs::DstBuffer, Place},
Expand All @@ -334,7 +349,7 @@ mod test {

#[test]
fn resolves_init() {
let mut resolver = StCircuitResolver::<F, Cfg>::new(CircuitResolverOpts::new(111));
let mut resolver = StCircuitResolver::<F, Cfg>::new(StCircuitResolverParams::new(111));

let res_fn = |ins: &[F], outs: &mut DstBuffer<F>| {
outs.push(ins[0]);
Expand All @@ -350,7 +365,7 @@ mod test {

#[test]
fn resolves_chain() {
let mut resolver = StCircuitResolver::<F, Cfg>::new(CircuitResolverOpts::new(111));
let mut resolver = StCircuitResolver::<F, Cfg>::new(StCircuitResolverParams::new(111));

let res_fn = |ins: &[F], outs: &mut DstBuffer<F>| {
outs.push(ins[0]);
Expand All @@ -367,7 +382,7 @@ mod test {

#[test]
fn resolves_delayed_set() {
let mut resolver = StCircuitResolver::<F, Cfg>::new(CircuitResolverOpts::new(111));
let mut resolver = StCircuitResolver::<F, Cfg>::new(StCircuitResolverParams::new(111));

let res_fn = |ins: &[F], outs: &mut DstBuffer<F>| {
outs.push(ins[0]);
Expand Down

0 comments on commit d9c2651

Please sign in to comment.