742 Commits

Author SHA1 Message Date
Nicholas Ward
ed49bbc7f2 cleanup 2021-08-03 09:03:14 -07:00
Nicholas Ward
fa5a5c5ebf cargo fmt 2021-08-03 08:59:25 -07:00
Nicholas Ward
51473b48d9 merge 2021-08-03 08:54:45 -07:00
Nicholas Ward
1db727d954 addressed comments 2021-08-03 08:53:20 -07:00
Nicholas Ward
acc59327e7 random access gate 2021-08-02 17:58:45 -07:00
Nicholas Ward
53f1acc566 random access gate 2021-08-02 17:01:51 -07:00
Daniel Lubarov
f150f7ec09
More timing code for FRI prover (#146) 2021-08-02 15:49:06 -07:00
Daniel Lubarov
9fb780d34e
Move evaluation of L_1(x) outside of loop (#147)
Just a minor optimization.
2021-08-02 15:27:48 -07:00
Daniel Lubarov
5c96e7b366 Trivial fixes from "cargo fix" 2021-08-02 10:58:03 -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
730962ceac
Merge pull request #145 from mir-protocol/test_eval_fns
Test `eval_unfiltered_*` functions
2021-08-02 19:50:27 +02:00
Daniel Lubarov
63e78826ae Imports 2021-08-02 10:41:02 -07:00
Daniel Lubarov
1229d90fae
Add a tree of scopes for proving times (#141)
* Add a tree of scopes for proving times

To replace the old `timed!` macro, which had no hierarchy.

It's similar to `ContextTree`, which tracks gate counts of circuit operations.

This gives a more organized output, with indentation levels based on scope depth, parent durations listed before child durations, etc.

* PR feedback
2021-08-02 10:38:09 -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
f564498f0b
Merge pull request #143 from mir-protocol/exponentiation_nits
Small nits for the exponentiation gate
2021-08-02 19:10:53 +02:00
wborgeaud
2bbcf17699 Test eval_unfiltered_* functions 2021-08-02 14:17:42 +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
94b85b0806
Small optimization -- use mul_add instead of mul + add (#137) 2021-07-30 09:03:23 -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
Daniel Lubarov
bb316fb146
Use batch inversion to compute the quoients for Z (#136)
Shaves about a second off the recursive proof time! Down to 2.45s on my laptop.
2021-07-30 09:02:56 -07:00
Daniel Lubarov
018fb005f8
Move stuff around (#135)
No functional changes here. The biggest change was moving certain files into new directories like `plonk` and `iop` (for things like `Challenger` that could be used in STARKs or other IOPs). I also split a few files, renames, etc, but again nothing functional, so I don't think a careful review is necessary (just a sanity check).
2021-07-29 22:00:29 -07:00
Nicholas Ward
c02d48036e
Merge pull request #134 from mir-protocol/exp_gate_config
Exponentiation gate calculates number of bit wires
2021-07-29 15:37:03 -07:00
Nicholas Ward
9eda81c293 minor changes 2021-07-29 15:31:04 -07:00
Nicholas Ward
8440a4cbdf fix 2021-07-29 15:15:40 -07:00
Nicholas Ward
cfda56e3d3 Merge branch 'main' into exp_gate_config 2021-07-29 14:19:24 -07:00
Nicholas Ward
a111fc3164 fixes 2021-07-29 14:18:18 -07:00
Nicholas Ward
95503ff7fa Merge branch 'main' into exp_gate_config 2021-07-29 14:10:35 -07:00
Nicholas Ward
e46bd08f00 exponention gate takes only bits 2021-07-29 12:59:11 -07:00
Daniel Lubarov
c5da582f4f Logging tweaks 2021-07-29 12:06:32 -07:00
Daniel Lubarov
e382decc9f Import fixes 2021-07-29 11:45:58 -07:00
Nicholas Ward
56b62f1964 new exp gate takes in CircuitConfig and determines num_bits 2021-07-29 10:26:46 -07:00
Daniel Lubarov
df03c22c48 Fix order 2021-07-29 09:12:24 -07:00
Daniel Lubarov
5f79b9630e
Update division calls (#132)
We have two division methods: one "unsafe" one, which permits 0/0 = anything, and one "safe" one, for which 0/0 results in an unsatisfiable instance. The latter is slightly more expensive.

I switched a few calls over to safe division, where unsafe division didn't seem sound (or at least it wasn't obvious). For calls where unsafe division did seem sound, I added comments explaining why.

Closes #97.
2021-07-28 18:06:32 -07:00
Nicholas Ward
f7e9af6f0a
Merge pull request #133 from mir-protocol/exp_gadget
Exponentiation gadget
2021-07-28 17:37:46 -07:00
Nicholas Ward
fa06cc5509 fix 2021-07-28 17:37:26 -07:00
Nicholas Ward
17217f1143 addressed nit 2021-07-28 17:34:41 -07:00
Nicholas Ward
2fd9ce2114 fixes to exp functions 2021-07-28 13:38:41 -07:00
Nicholas Ward
247fa39386 exponentiation gadget 2021-07-28 10:56:12 -07:00
Nicholas Ward
6749a94c52 fix 2021-07-28 10:17:32 -07:00
Nicholas Ward
a1aa5d6349
Merge pull request #131 from mir-protocol/exp_gate
Exponentiation gate
2021-07-28 10:10:25 -07:00
Nicholas Ward
607d0a89cb fixed max_power_bits 2021-07-28 10:09:35 -07:00
Nicholas Ward
68672c0038 addressed comments 2021-07-28 09:20:20 -07:00
Nicholas Ward
a38a5e227d select_ext takes bit as extension; used in recursive eval 2021-07-27 22:51:40 -07:00
Nicholas Ward
33ba269ccb fixes 2021-07-27 15:58:19 -07:00
Nicholas Ward
3944c5e68e added eval_unfiltered_recursively 2021-07-27 13:29:57 -07:00
Nicholas Ward
044eb597c2 added eval_unfiltered_base 2021-07-27 13:18:42 -07:00
Nicholas Ward
21ec75335a fix: power bits in test now LE 2021-07-27 13:09:28 -07:00
Nicholas Ward
b5418bffb3 added output wire 2021-07-27 13:09:15 -07:00