Skip to content

Commit aa318e5

Browse files
authored
opts and tests from the memory project (#195)
1 parent ca70537 commit aa318e5

36 files changed

+2954
-76
lines changed

.github/workflows/ci.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ jobs:
2222
with:
2323
toolchain: stable
2424
- uses: Swatinem/rust-cache@v2
25+
- name: No default features pushed
26+
run: zsh ./scripts/assert_no_default_features.zsh
2527
- name: Set all features on
26-
run: python3 driver.py --all_features
28+
run: python3 driver.py --all-features
2729
- name: Install python reqs
2830
run: python3 driver.py --install
2931
- name: Check

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ __pycache__
1515
.mode.txt
1616
scripts/aby_tests/tests
1717
/flamegraph*.svg
18+
/.ccls-cache
19+
/.vscode

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ bls12_381 = "0.7"
6161
approx = "0.5.0"
6262

6363
[features]
64-
default = ["bellman", "r1cs", "poly", "smt", "zok"]
64+
default = []
6565
# frontends
6666
c = ["lang-c"]
6767
zok = ["smt", "zokrates_parser", "zokrates_pest_ast", "typed-arena", "petgraph"]

circ_opt/README.md

+25-2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ Options:
9292
[default: false]
9393
[possible values: true, false]
9494

95+
--ir-fits-in-bits-ip <FITS_IN_BITS_IP>
96+
Use an IP to check bit-constraints
97+
98+
[env: IR_FITS_IN_BITS_IP=]
99+
[default: true]
100+
[possible values: true, false]
101+
95102
--ram <ENABLED>
96103
Whether to use advanced RAM techniques
97104
@@ -120,7 +127,7 @@ Options:
120127
- uniqueness: Use the GCD-derivative uniqueness argument
121128

122129
--ram-permutation <PERMUTATION>
123-
How to argue that indices are only repeated in blocks
130+
How to permute accesses
124131
125132
[env: RAM_PERMUTATION=]
126133
[default: msh]
@@ -212,14 +219,16 @@ Options:
212219
Which field to use [env: IR_FIELD_TO_BV=] [default: wrap] [possible values: wrap, panic]
213220
--ir-frequent-gc <FREQUENT_GC>
214221
Garbage collection after each optimization pass [env: IR_FREQUENT_GC=] [default: false] [possible values: true, false]
222+
--ir-fits-in-bits-ip <FITS_IN_BITS_IP>
223+
Use an IP to check bit-constraints [env: IR_FITS_IN_BITS_IP=] [default: true] [possible values: true, false]
215224
--ram <ENABLED>
216225
Whether to use advanced RAM techniques [env: RAM=] [default: false] [possible values: true, false]
217226
--ram-range <RANGE>
218227
How to argue that values are in a range [env: RAM_RANGE=] [default: sort] [possible values: bit-split, sort]
219228
--ram-index <INDEX>
220229
How to argue that indices are only repeated in blocks [env: RAM_INDEX=] [default: uniqueness] [possible values: sort, uniqueness]
221230
--ram-permutation <PERMUTATION>
222-
How to argue that indices are only repeated in blocks [env: RAM_PERMUTATION=] [default: msh] [possible values: waksman, msh]
231+
How to permute accesses [env: RAM_PERMUTATION=] [default: msh] [possible values: waksman, msh]
223232
--ram-rom <ROM>
224233
ROM approach [env: RAM_ROM=] [default: haboeck] [possible values: haboeck, permute]
225234
--fmt-use-default-field <USE_DEFAULT_FIELD>
@@ -259,6 +268,7 @@ BinaryOpt {
259268
ir: IrOpt {
260269
field_to_bv: Wrap,
261270
frequent_gc: false,
271+
fits_in_bits_ip: true,
262272
},
263273
ram: RamOpt {
264274
enabled: false,
@@ -305,6 +315,7 @@ BinaryOpt {
305315
ir: IrOpt {
306316
field_to_bv: Wrap,
307317
frequent_gc: false,
318+
fits_in_bits_ip: true,
308319
},
309320
ram: RamOpt {
310321
enabled: false,
@@ -349,6 +360,7 @@ BinaryOpt {
349360
ir: IrOpt {
350361
field_to_bv: Wrap,
351362
frequent_gc: false,
363+
fits_in_bits_ip: true,
352364
},
353365
ram: RamOpt {
354366
enabled: false,
@@ -393,6 +405,7 @@ BinaryOpt {
393405
ir: IrOpt {
394406
field_to_bv: Wrap,
395407
frequent_gc: false,
408+
fits_in_bits_ip: true,
396409
},
397410
ram: RamOpt {
398411
enabled: false,
@@ -437,6 +450,7 @@ BinaryOpt {
437450
ir: IrOpt {
438451
field_to_bv: Wrap,
439452
frequent_gc: false,
453+
fits_in_bits_ip: true,
440454
},
441455
ram: RamOpt {
442456
enabled: false,
@@ -481,6 +495,7 @@ BinaryOpt {
481495
ir: IrOpt {
482496
field_to_bv: Wrap,
483497
frequent_gc: false,
498+
fits_in_bits_ip: true,
484499
},
485500
ram: RamOpt {
486501
enabled: false,
@@ -525,6 +540,7 @@ BinaryOpt {
525540
ir: IrOpt {
526541
field_to_bv: Wrap,
527542
frequent_gc: false,
543+
fits_in_bits_ip: true,
528544
},
529545
ram: RamOpt {
530546
enabled: false,
@@ -569,6 +585,7 @@ BinaryOpt {
569585
ir: IrOpt {
570586
field_to_bv: Wrap,
571587
frequent_gc: false,
588+
fits_in_bits_ip: true,
572589
},
573590
ram: RamOpt {
574591
enabled: false,
@@ -616,6 +633,7 @@ BinaryOpt {
616633
ir: IrOpt {
617634
field_to_bv: Wrap,
618635
frequent_gc: false,
636+
fits_in_bits_ip: true,
619637
},
620638
ram: RamOpt {
621639
enabled: false,
@@ -661,6 +679,7 @@ BinaryOpt {
661679
ir: IrOpt {
662680
field_to_bv: Wrap,
663681
frequent_gc: false,
682+
fits_in_bits_ip: true,
664683
},
665684
ram: RamOpt {
666685
enabled: false,
@@ -708,6 +727,7 @@ BinaryOpt {
708727
ir: IrOpt {
709728
field_to_bv: Wrap,
710729
frequent_gc: false,
730+
fits_in_bits_ip: true,
711731
},
712732
ram: RamOpt {
713733
enabled: false,
@@ -753,6 +773,7 @@ BinaryOpt {
753773
ir: IrOpt {
754774
field_to_bv: Wrap,
755775
frequent_gc: false,
776+
fits_in_bits_ip: true,
756777
},
757778
ram: RamOpt {
758779
enabled: false,
@@ -800,6 +821,7 @@ BinaryOpt {
800821
ir: IrOpt {
801822
field_to_bv: Wrap,
802823
frequent_gc: false,
824+
fits_in_bits_ip: true,
803825
},
804826
ram: RamOpt {
805827
enabled: false,
@@ -845,6 +867,7 @@ BinaryOpt {
845867
ir: IrOpt {
846868
field_to_bv: Wrap,
847869
frequent_gc: false,
870+
fits_in_bits_ip: true,
848871
},
849872
ram: RamOpt {
850873
enabled: false,

circ_opt/src/lib.rs

+20-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl Default for BuiltinField {
168168
}
169169

170170
/// Options for the prime field used
171-
#[derive(Args, Debug, Default, Clone, PartialEq, Eq)]
171+
#[derive(Args, Debug, Clone, PartialEq, Eq)]
172172
pub struct IrOpt {
173173
/// Which field to use
174174
#[arg(
@@ -186,6 +186,24 @@ pub struct IrOpt {
186186
default_value = "false"
187187
)]
188188
pub frequent_gc: bool,
189+
/// Use an IP to check bit-constraints
190+
#[arg(
191+
long = "ir-fits-in-bits-ip",
192+
env = "IR_FITS_IN_BITS_IP",
193+
action = ArgAction::Set,
194+
default_value = "true"
195+
)]
196+
pub fits_in_bits_ip: bool,
197+
}
198+
199+
impl Default for IrOpt {
200+
fn default() -> Self {
201+
Self {
202+
field_to_bv: Default::default(),
203+
frequent_gc: Default::default(),
204+
fits_in_bits_ip: true,
205+
}
206+
}
189207
}
190208

191209
#[derive(ValueEnum, Debug, PartialEq, Eq, Clone, Copy)]
@@ -231,7 +249,7 @@ pub struct RamOpt {
231249
default_value = "uniqueness"
232250
)]
233251
pub index: IndexStrategy,
234-
/// How to argue that indices are only repeated in blocks.
252+
/// How to permute accesses
235253
#[arg(
236254
long = "ram-permutation",
237255
env = "RAM_PERMUTATION",

0 commit comments

Comments
 (0)