209 Commits

Author SHA1 Message Date
wborgeaud
9a54540116 Minor 2021-08-16 11:08:26 +02:00
wborgeaud
5a9c5b295c Minor 2021-08-16 10:41:12 +02:00
wborgeaud
b366482866 The mother of all arithmetic optimizations 2021-08-16 10:18:10 +02:00
wborgeaud
6ba6201b94 Merge branch 'main' into push_to_8192
# Conflicts:
#	src/fri/recursive_verifier.rs
#	src/plonk/circuit_data.rs
#	src/plonk/recursive_verifier.rs
#	src/util/reducing.rs
2021-08-16 08:49:49 +02:00
Daniel Lubarov
e4cbee2b57
Disable ZK in large_config (#180)
* Disable ZK in large_config

Speeds up the tests from ~6m to ~1m (debug mode). `large_config` is crate-private so I don't think we need to worry about real users forgetting ZK, and I don't think ZK seems important in these tests, though we should probably have ZK enabled for a couple tests.

A couple tests need ZK or they fail; I added a TODO to look later.

This led to a few other changes:
- Fixed a bug where `trim` could truncate the final poly to a non-power-of-two length. This was improbable when ZK is on due to randomization.
- Gave a few methods access to the whole `CircuitConfig` vs `FriConfig` -- sort of necessary for the above fix, and I don't think there's much downside.
- Remove `cap_height` from `FriConfig` -- didn't really need it any more after giving more methods access to `CircuitConfig`, and having a single copy of the param feels cleaner/safer to me.

* PR feedback
2021-08-14 10:01:10 -07:00
Daniel Lubarov
f3bfd66657
Add a BoolTarget (#179)
It's just a wrapper around `Target`, which signifies that the wrapped `Target` has already been range checked. Should make it easier to audit code that expects bools.
2021-08-14 08:53:39 -07:00
Daniel Lubarov
9c42fef997
Little refactor (#178) 2021-08-14 08:47:03 -07:00
wborgeaud
bb548fe148 More cleaning 2021-08-13 20:31:04 +02:00
wborgeaud
ceae6b9588 Cleaning 2021-08-13 20:12:20 +02:00
wborgeaud
68af28e9a2 Fix tests 2021-08-13 17:41:26 +02:00
wborgeaud
1c78965763 better 2021-08-13 15:24:38 +02:00
wborgeaud
7da4412de5 working 2021-08-13 15:22:03 +02:00
wborgeaud
75ad055f40 First try 2021-08-13 14:28:05 +02:00
wborgeaud
21669be246 Some arithm optims 2021-08-13 10:40:31 +02:00
Daniel Lubarov
bbfc0f8adc no mut 2021-08-12 13:56:45 -07:00
Daniel Lubarov
b20d6dc191
Minor optimizations (#174) 2021-08-12 13:32:49 -07:00
wborgeaud
702eab1583 Add wide_arithmetic 2021-08-12 16:03:13 +02:00
Daniel Lubarov
090cf79787
Replace some old division code (#171)
- Delete unsafe methods
- Have related methods call the new div_add_extension method to simplify
2021-08-10 11:48:53 -07:00
wborgeaud
94123c456e Fix merge conflict 2021-08-10 09:21:03 +02:00
wborgeaud
4433fd8048 Merge branch 'main' into optimize_arithmetic_ops 2021-08-10 09:11:08 +02:00
wborgeaud
b15e36d29c PR feedback 2021-08-10 09:07:01 +02:00
Daniel Lubarov
b89f4d656d
Update various dependencies (#163) 2021-08-09 10:11:42 -07:00
wborgeaud
3adabbedf1 Fix comments 2021-08-09 14:15:20 +02:00
wborgeaud
905aaa2ed9 Unused 2021-08-09 14:07:32 +02:00
wborgeaud
d0cb1becf0 Minor bis 2021-08-09 14:07:16 +02:00
wborgeaud
8e6c30dc70 Use only one gate for div 2021-08-09 13:55:49 +02:00
wborgeaud
ff68b66bbb Add div_add 2021-08-09 13:46:20 +02:00
wborgeaud
417e6055ae Optimize coset in compute_evaluation 2021-08-09 13:21:42 +02:00
wborgeaud
d27dd92af9 Some more optimization 2021-08-09 13:08:09 +02:00
wborgeaud
4b44578ffa More optimizations 2021-08-09 12:39:37 +02:00
wborgeaud
ed8dc9fdc7 Cleaning 2021-08-09 11:33:38 +02:00
wborgeaud
eeb33f99ca Optimize mul_ext_algebra 2021-08-09 11:30:03 +02:00
wborgeaud
f0f8320b93 First pass 2021-08-09 10:46:29 +02:00
wborgeaud
dd076e5c73 Auto resize partial witness 2021-08-09 09:58:09 +02:00
wborgeaud
db236e4824 Fix tests 2021-08-06 15:14:38 +02:00
wborgeaud
7d11d0f8a1 Change PartialWitness to use Vecs 2021-08-06 14:58:39 +02:00
wborgeaud
a255c320ac
Merge pull request #157 from mir-protocol/remove_reverse_limbs
Remove reversed limbs sum
2021-08-05 21:37:58 +02:00
Daniel Lubarov
7b20f342df
More eval_unfiltered_recursively tweaks (#156) 2021-08-05 08:03:49 -07:00
wborgeaud
df07909f1e Merge branch 'main' into remove_reverse_limbs 2021-08-05 16:04:16 +02:00
wborgeaud
5418026082 Remove reversed sum from BaseSumGate 2021-08-05 13:47:33 +02:00
Nicholas Ward
4eb8153895
Merge pull request #154 from mir-protocol/random_access_gadget
added random access gadget
2021-08-04 14:31:08 -07:00
Nicholas Ward
c7093cd551 addressed comments 2021-08-04 14:19:06 -07:00
Nicholas Ward
32c8c366bf added random access gadget 2021-08-04 10:58:12 -07:00
Daniel Lubarov
079baff718
Optimize some exp methods to use ExponentiationGate (#151) 2021-08-04 09:55:29 -07:00
Daniel Lubarov
d6211b8ab8
Reuse a buffer of generated values (#142)
* Reuse a buffer of generated values

To avoid allocating `GeneratedValues` all the time. Saves ~60ms or so.

* PR feedback
2021-08-02 10:55:10 -07:00
wborgeaud
08b018fc02
Merge pull request #144 from mir-protocol/optimize_small_exp_u64
Hardcode small exponents in `exp_u64_extension`
2021-08-02 19:12:07 +02:00
wborgeaud
df690f92bf Hardcode small exponents in exp_u64_extension 2021-08-02 13:31:12 +02:00
wborgeaud
fc9d64defe Small nits for the exponentiation gate 2021-08-02 13:12:50 +02:00
Daniel Lubarov
36a1386c6f
Small fix in arithmetic_extension_special_cases (#140)
This is detecting the case where we multiply something by 1 and add 0.  In that case we can just return the thing being multiplied by 1. We were using the wrong constant to detect this.

Reduces the cost of `compute_evaluation` from 8 to 6 gates.
2021-07-30 12:00:24 -07:00
Daniel Lubarov
50b07f2ceb
Special cases for extension field arithmetic (#138)
We previously checked for special cases, like arithmetic on constant Targets, in `arithmetic`. We can handle those cases without actually adding an `ArithmeticGate`.

Now that `arithmetic` just calls `arithmetic_extension`, it makes more sense to check for special cases in the latter method, so it applies to both base and extension field arithmetic.

Reduces gate count from 16149 to 15689.
2021-07-30 09:03:11 -07:00