1280 Commits

Author SHA1 Message Date
Nicholas Ward
87d8129034 reduce 2021-11-10 09:58:16 -08:00
Nicholas Ward
6232aa68fb fix 2021-11-10 09:58:16 -08:00
Nicholas Ward
f639dd3359 fixes to nonnative 2021-11-10 09:58:15 -08:00
Nicholas Ward
f41c8ee16f fmt 2021-11-10 09:58:15 -08:00
Nicholas Ward
7e81f297f2 another fix 2021-11-10 09:58:15 -08:00
Nicholas Ward
90178b2b0a many fixes 2021-11-10 09:58:15 -08:00
Nicholas Ward
9e49c3f2b4 fix to test 2021-11-10 09:58:15 -08:00
Nicholas Ward
048048cea2 test for list_le 2021-11-10 09:58:15 -08:00
Nicholas Ward
166ab77ee3 biguint_cmp test 2021-11-10 09:58:15 -08:00
Nicholas Ward
62519eeb12 biguint mul test 2021-11-10 09:58:15 -08:00
Nicholas Ward
1402791139 merge 2021-11-10 09:58:14 -08:00
Nicholas Ward
0c182c4621 fix 2021-11-10 09:58:03 -08:00
Nicholas Ward
649c2e2b52 tests for biguint gadget 2021-11-10 09:58:03 -08:00
Nicholas Ward
b045afbb8a biguint methods in fields, and biguint gadget progress 2021-11-10 09:58:00 -08:00
Nicholas Ward
557456ddd9 fix 2021-11-10 09:57:32 -08:00
Nicholas Ward
e8c2813cc7 fixes and fmt 2021-11-10 09:57:32 -08:00
Nicholas Ward
b567cf9baf some more BigUint arithmetic 2021-11-10 09:57:32 -08:00
Nicholas Ward
9077c7fa3c BigUint arithmetic, and cleanup 2021-11-10 09:57:32 -08:00
Nicholas Ward
72aea53d13 mul 2021-11-10 09:57:32 -08:00
Nicholas Ward
956b34c2e9 add_many_u32 2021-11-10 09:57:32 -08:00
Nicholas Ward
a4eac25f3d nonnative add reduction, and nonnative subtraction 2021-11-10 09:57:32 -08:00
Nicholas Ward
b2b7cb3931 merge 2021-11-10 09:57:32 -08:00
Nicholas Ward
97f66b58f5 merge 2021-11-10 09:56:42 -08:00
Nicholas Ward
cc48abff94 sub 2021-11-10 09:56:22 -08:00
Nicholas Ward
18567e570b merge 2021-11-10 09:56:21 -08:00
Nicholas Ward
3fff08aa80 U32 subtraction gate 2021-11-10 09:53:29 -08:00
Nicholas Ward
bdfe124b0c multiple comparison 2021-11-10 09:53:29 -08:00
Nicholas Ward
6dd14eb27a comparison gate should also be <= 2021-11-10 09:53:29 -08:00
Nicholas Ward
26959d11c9 range-check the bits 2021-11-10 09:53:28 -08:00
Nicholas Ward
0ff6e6e0a0 fmt 2021-11-10 09:53:28 -08:00
Nicholas Ward
7e8c021b46 comparison gate 2021-11-10 09:53:28 -08:00
Nicholas Ward
912204d685 merge 2021-11-10 09:53:27 -08:00
Nicholas Ward
ebcfde1d81 updates 2021-11-10 09:53:12 -08:00
Nicholas Ward
8440a0f5cb merge 2021-11-10 09:53:09 -08:00
Nicholas Ward
6b294c1d97 fmt 2021-11-09 18:10:52 -08:00
Nicholas Ward
34eacdada6 progress 2021-11-09 18:10:52 -08:00
Nicholas Ward
f71adac40b fix 2021-11-09 18:10:52 -08:00
Nicholas Ward
e48e0a4a58 fmt 2021-11-09 18:10:52 -08:00
Nicholas Ward
ffb544e4a5 initial non-native add 2021-11-09 18:10:52 -08:00
Nicholas Ward
d334a924b4 merge new circuit builder stuff 2021-11-09 18:10:47 -08:00
Nicholas Ward
7054fcdaf9 initial 2021-11-09 18:09:39 -08:00
Jakub Nabaglo
9711127599
Use Jemalloc (#347) 2021-11-09 15:14:41 -08:00
Jakub Nabaglo
168f572804
Fix rustfmt failures on main (#348) 2021-11-09 14:52:05 -08:00
Daniel Lubarov
b2264752de
Optimize combination of gate constraints in recursive circuit (#342)
Just passing the "combined constraints" buffer into `eval_filtered_recursively`, so that we can combine a mul by the filter with an add into the buffer. Saves 56 wires.
2021-11-07 11:29:15 -08:00
Daniel Lubarov
e9ae9a045f import 2021-11-05 21:36:33 -07:00
Daniel Lubarov
671bb9be2e
Specialize InterpolationGate (#339)
* Specialize `InterpolationGate`

To cosets of subgroups of roots of unity. This way
- `InterpolationGate` needs fewer routed wires, bringing our minimum routed wires down from 28 to 25.
- The recursive `compute_evaluation` avoids some multiplications, saving 100~200 gates depending on `num_routed_wires`.

* Update test

* feedback
2021-11-05 09:29:08 -07:00
Daniel Lubarov
75fe5686a2
Better fixed-base exponentiation and exp_power_of_2 (#340)
Saves 84 gates with `num_routed_wires: 48`.
2021-11-05 09:10:46 -07:00
Daniel Lubarov
1450ffb29c
Small recursion optimizations (#338)
* Small recursion optimizations

Main thing is memoizing arithmetic operations. Overall savings is ~50 gates.

* feedback
2021-11-04 16:23:01 -07:00
Daniel Lubarov
fdce382af3
Standard configs (#337)
`large_config` was similar to `standard_recursion_config`; let's standardize on the latter.
2021-11-03 14:30:32 -07:00
Daniel Lubarov
fb3f5e7db8
Shrink further with another couple layers of recursion (#335)
* More wires for ConstantGate

* fix

* fix

* Optimize recursive Poseidon constraint evaluation

- Avoid `ArithmeticGate`s with unique constants; use `ConstantGate` wires instead
- Avoid an unnecessary squaring in exponentiations

Brings Poseidon evaluation down to a reasonable 273 gates when `num_routed_wires = 48`.

* Shrink further with another couple layers of recursion

To keep it reasonably fast, we shrink to degree 2^12 before we start using a really high rate. Each layer is reasonably quick this way; overall time is ~20s for me.

Final proof is now 52-54kb. It can go down to ~51kb if we add one more layer with `num_routed_wires: 28` (vs 32), but I feel like I may be overcomplicating this already...
2021-11-02 14:43:07 -07:00