Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opts and tests from the memory project #195

Merged
merged 3 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ jobs:
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: No default features pushed
run: zsh ./scripts/assert_no_default_features.zsh
- name: Set all features on
run: python3 driver.py --all_features
run: python3 driver.py --all-features
- name: Install python reqs
run: python3 driver.py --install
- name: Check
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ __pycache__
.mode.txt
scripts/aby_tests/tests
/flamegraph*.svg
/.ccls-cache
/.vscode
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ bls12_381 = "0.7"
approx = "0.5.0"

[features]
default = ["bellman", "r1cs", "poly", "smt", "zok"]
default = []
# frontends
c = ["lang-c"]
zok = ["smt", "zokrates_parser", "zokrates_pest_ast", "typed-arena", "petgraph"]
Expand Down
27 changes: 25 additions & 2 deletions circ_opt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ Options:
[default: false]
[possible values: true, false]

--ir-fits-in-bits-ip <FITS_IN_BITS_IP>
Use an IP to check bit-constraints

[env: IR_FITS_IN_BITS_IP=]
[default: true]
[possible values: true, false]

--ram <ENABLED>
Whether to use advanced RAM techniques

Expand Down Expand Up @@ -120,7 +127,7 @@ Options:
- uniqueness: Use the GCD-derivative uniqueness argument

--ram-permutation <PERMUTATION>
How to argue that indices are only repeated in blocks
How to permute accesses

[env: RAM_PERMUTATION=]
[default: msh]
Expand Down Expand Up @@ -212,14 +219,16 @@ Options:
Which field to use [env: IR_FIELD_TO_BV=] [default: wrap] [possible values: wrap, panic]
--ir-frequent-gc <FREQUENT_GC>
Garbage collection after each optimization pass [env: IR_FREQUENT_GC=] [default: false] [possible values: true, false]
--ir-fits-in-bits-ip <FITS_IN_BITS_IP>
Use an IP to check bit-constraints [env: IR_FITS_IN_BITS_IP=] [default: true] [possible values: true, false]
--ram <ENABLED>
Whether to use advanced RAM techniques [env: RAM=] [default: false] [possible values: true, false]
--ram-range <RANGE>
How to argue that values are in a range [env: RAM_RANGE=] [default: sort] [possible values: bit-split, sort]
--ram-index <INDEX>
How to argue that indices are only repeated in blocks [env: RAM_INDEX=] [default: uniqueness] [possible values: sort, uniqueness]
--ram-permutation <PERMUTATION>
How to argue that indices are only repeated in blocks [env: RAM_PERMUTATION=] [default: msh] [possible values: waksman, msh]
How to permute accesses [env: RAM_PERMUTATION=] [default: msh] [possible values: waksman, msh]
--ram-rom <ROM>
ROM approach [env: RAM_ROM=] [default: haboeck] [possible values: haboeck, permute]
--fmt-use-default-field <USE_DEFAULT_FIELD>
Expand Down Expand Up @@ -259,6 +268,7 @@ BinaryOpt {
ir: IrOpt {
field_to_bv: Wrap,
frequent_gc: false,
fits_in_bits_ip: true,
},
ram: RamOpt {
enabled: false,
Expand Down Expand Up @@ -305,6 +315,7 @@ BinaryOpt {
ir: IrOpt {
field_to_bv: Wrap,
frequent_gc: false,
fits_in_bits_ip: true,
},
ram: RamOpt {
enabled: false,
Expand Down Expand Up @@ -349,6 +360,7 @@ BinaryOpt {
ir: IrOpt {
field_to_bv: Wrap,
frequent_gc: false,
fits_in_bits_ip: true,
},
ram: RamOpt {
enabled: false,
Expand Down Expand Up @@ -393,6 +405,7 @@ BinaryOpt {
ir: IrOpt {
field_to_bv: Wrap,
frequent_gc: false,
fits_in_bits_ip: true,
},
ram: RamOpt {
enabled: false,
Expand Down Expand Up @@ -437,6 +450,7 @@ BinaryOpt {
ir: IrOpt {
field_to_bv: Wrap,
frequent_gc: false,
fits_in_bits_ip: true,
},
ram: RamOpt {
enabled: false,
Expand Down Expand Up @@ -481,6 +495,7 @@ BinaryOpt {
ir: IrOpt {
field_to_bv: Wrap,
frequent_gc: false,
fits_in_bits_ip: true,
},
ram: RamOpt {
enabled: false,
Expand Down Expand Up @@ -525,6 +540,7 @@ BinaryOpt {
ir: IrOpt {
field_to_bv: Wrap,
frequent_gc: false,
fits_in_bits_ip: true,
},
ram: RamOpt {
enabled: false,
Expand Down Expand Up @@ -569,6 +585,7 @@ BinaryOpt {
ir: IrOpt {
field_to_bv: Wrap,
frequent_gc: false,
fits_in_bits_ip: true,
},
ram: RamOpt {
enabled: false,
Expand Down Expand Up @@ -616,6 +633,7 @@ BinaryOpt {
ir: IrOpt {
field_to_bv: Wrap,
frequent_gc: false,
fits_in_bits_ip: true,
},
ram: RamOpt {
enabled: false,
Expand Down Expand Up @@ -661,6 +679,7 @@ BinaryOpt {
ir: IrOpt {
field_to_bv: Wrap,
frequent_gc: false,
fits_in_bits_ip: true,
},
ram: RamOpt {
enabled: false,
Expand Down Expand Up @@ -708,6 +727,7 @@ BinaryOpt {
ir: IrOpt {
field_to_bv: Wrap,
frequent_gc: false,
fits_in_bits_ip: true,
},
ram: RamOpt {
enabled: false,
Expand Down Expand Up @@ -753,6 +773,7 @@ BinaryOpt {
ir: IrOpt {
field_to_bv: Wrap,
frequent_gc: false,
fits_in_bits_ip: true,
},
ram: RamOpt {
enabled: false,
Expand Down Expand Up @@ -800,6 +821,7 @@ BinaryOpt {
ir: IrOpt {
field_to_bv: Wrap,
frequent_gc: false,
fits_in_bits_ip: true,
},
ram: RamOpt {
enabled: false,
Expand Down Expand Up @@ -845,6 +867,7 @@ BinaryOpt {
ir: IrOpt {
field_to_bv: Wrap,
frequent_gc: false,
fits_in_bits_ip: true,
},
ram: RamOpt {
enabled: false,
Expand Down
22 changes: 20 additions & 2 deletions circ_opt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl Default for BuiltinField {
}

/// Options for the prime field used
#[derive(Args, Debug, Default, Clone, PartialEq, Eq)]
#[derive(Args, Debug, Clone, PartialEq, Eq)]
pub struct IrOpt {
/// Which field to use
#[arg(
Expand All @@ -186,6 +186,24 @@ pub struct IrOpt {
default_value = "false"
)]
pub frequent_gc: bool,
/// Use an IP to check bit-constraints
#[arg(
long = "ir-fits-in-bits-ip",
env = "IR_FITS_IN_BITS_IP",
action = ArgAction::Set,
default_value = "true"
)]
pub fits_in_bits_ip: bool,
}

impl Default for IrOpt {
fn default() -> Self {
Self {
field_to_bv: Default::default(),
frequent_gc: Default::default(),
fits_in_bits_ip: true,
}
}
}

#[derive(ValueEnum, Debug, PartialEq, Eq, Clone, Copy)]
Expand Down Expand Up @@ -231,7 +249,7 @@ pub struct RamOpt {
default_value = "uniqueness"
)]
pub index: IndexStrategy,
/// How to argue that indices are only repeated in blocks.
/// How to permute accesses
#[arg(
long = "ram-permutation",
env = "RAM_PERMUTATION",
Expand Down
Loading
Loading