mirror of
https://github.com/circify/circ.git
synced 2026-04-21 03:00:54 -04:00
* Configuration system. Kill DFL_T
* add circ::cfg::CircCfg that holds cfg info
* it's constructible from circ_opt::CircOpt
* implements clap::Args, so you can set it from your compiler's
CLI/envvars
* defined in external crate to keep clap out of our main build
* organized by circ module, but not feature gated
* no point: the build wouldn't meaningfully change
* includes a way to set the default field
* added circ::cfg::set and circ::cfg::cfg
* also circ::cfg::set_default and circ::cfg::set_cfg
* access a sync::once_cell, static configuration
* killed DFL_T
* workflows
* unit-tested component probably need to not read circ::cfg::cfg.
* compilers need to call circ::cfg::set or circ::cfg::set_default.
* rm dead features
36 lines
984 B
Rust
36 lines
984 B
Rust
use circ::cfg::clap::{self, Parser};
|
|
use circ::ir::term::*;
|
|
use circ::target::aby::assignment::ilp;
|
|
use circ::term;
|
|
|
|
#[derive(Debug, Parser)]
|
|
#[command(
|
|
name = "opa_bench",
|
|
about = "Optimal Protocol Assignment via ILP benchmarker"
|
|
)]
|
|
struct Options {
|
|
/// Number of parties for an MPC. If missing, generates a proof circuit.
|
|
#[arg(name = "MULTS")]
|
|
n_mults: u32,
|
|
}
|
|
|
|
fn main() {
|
|
env_logger::Builder::from_default_env()
|
|
.format_level(false)
|
|
.format_timestamp(None)
|
|
.init();
|
|
let options = Options::parse();
|
|
let v = leaf_term(Op::Var("a".to_owned(), Sort::BitVector(32)));
|
|
let mut t = v.clone();
|
|
for _i in 0..options.n_mults {
|
|
t = term![BV_MUL; t.clone(), t.clone()];
|
|
}
|
|
let cs = Computation {
|
|
outputs: vec![term![Op::Eq; t, v]],
|
|
metadata: ComputationMetadata::default(),
|
|
precomputes: Default::default(),
|
|
};
|
|
let _assignment = ilp::assign(&cs, "hycc");
|
|
//dbg!(&assignment);
|
|
}
|