361 Commits

Author SHA1 Message Date
Daniel Lubarov
3f22663296
Split up PartitionWitness data (#273)
* Split up `PartitionWitness` data

This addresses two minor inefficiencies:
- Some preprocessed forest data was being cloned during proving.
- Some of the `ForestNode` data (like node sizes) is only needed in preprocessing, not proving. It was taking up cache space during proving because it was interleaved with data that is used during proving (parents, values).

Now `Forest` contains the disjoint-set forest. `PartitionWitness` is now mainly a Vec of target values; it also holds a reference to the (preprocessed) representative map.

On my laptop, this speeds up witness generation ~12%, resulting in an overall ~0.5% speedup.

* Feedback

* No size data (#278)

* No size data

* feedback
2021-09-28 22:31:20 -07:00
Daniel Lubarov
bd38ada0d1 Change case to get rid of warning 2021-09-27 22:39:42 -07:00
wborgeaud
1a508d0c19
Merge pull request #270 from mir-protocol/poseidon_8
Use `SPONGE_WIDTH` instead of hardcoded values in various places
2021-09-27 12:55:46 +02:00
wborgeaud
df9a211475 PR comments 2021-09-27 12:29:27 +02:00
wborgeaud
1a55538e23 8->SPONGE_WIDTH in most places 2021-09-24 15:50:48 +02:00
wborgeaud
42a7ff9cc2 Working 2021-09-24 13:06:07 +02:00
Nicholas Ward
23b1161d27
Merge pull request #249 from mir-protocol/sorting_gadget
Memory sorting gadget
2021-09-23 09:28:47 -07:00
Nicholas Ward
2ec3b29741 addressed comments 2021-09-22 11:49:28 -07:00
Nicholas Ward
644d87e495 fixes galore 2021-09-21 18:01:21 -07:00
Jakub Nabaglo
2f8286ff98
Fix a few warnings (#259) 2021-09-21 13:12:46 -07:00
wborgeaud
0be8650bca PR feedback 2021-09-18 09:23:39 +02:00
wborgeaud
b8f6b3a778 Merge branch 'main' into poseidon_gate 2021-09-18 08:55:54 +02:00
Nicholas Ward
2c1c116ead fixes (addressed comments) 2021-09-17 13:09:24 -07:00
wborgeaud
14bbf5ae11 Fix AVX2 conflict 2021-09-17 17:50:43 +02:00
wborgeaud
675f32835b Minor 2021-09-17 13:50:42 +02:00
wborgeaud
f83c587cc5 Comments 2021-09-17 13:47:08 +02:00
Nicholas Ward
8681cdec54 intermediate wires 2021-09-16 11:16:32 -07:00
wborgeaud
5d7f4de2a6 Working recursively 2021-09-16 19:17:37 +02:00
wborgeaud
c508fe4362 Minor 2021-09-16 18:16:19 +02:00
wborgeaud
49ba7ccb52 Working 2021-09-16 18:16:05 +02:00
Nicholas Ward
7abf48cd07 addressed comments (apart from intermediate wires) 2021-09-16 08:51:44 -07:00
wborgeaud
b11e54d6ed Semi-working 2021-09-16 17:51:07 +02:00
Nicholas Ward
0acff53e1a fixes 2021-09-15 17:55:15 -07:00
Nicholas Ward
7a7bf371eb fmt 2021-09-15 17:55:15 -07:00
Nicholas Ward
c207a02852 changes and fixes (z --> most_significant_diff) 2021-09-15 17:55:15 -07:00
Nicholas Ward
44dc1cd4ed removed z 2021-09-15 17:55:15 -07:00
Nicholas Ward
677165fda7 range check of chunks 2021-09-15 17:55:15 -07:00
Nicholas Ward
a68094d378 eval_unfiltered_recusively 2021-09-15 17:55:15 -07:00
Nicholas Ward
806f4af92c eval_unfiltered_base 2021-09-15 17:55:15 -07:00
Nicholas Ward
8a4259cc28 addressed comments 2021-09-15 17:55:15 -07:00
Nicholas Ward
1a1358c081 cleanup (using reduce_with_powers) 2021-09-15 17:55:15 -07:00
Nicholas Ward
9fe6dab045 cleanup 2021-09-15 17:55:15 -07:00
Nicholas Ward
2f0ba9f98f cleanup (references) 2021-09-15 17:55:15 -07:00
Nicholas Ward
8efa5a54b1 fixed test (first is actually smaller than second :P) 2021-09-15 17:55:15 -07:00
Nicholas Ward
26c3edf465 removed copies 2021-09-15 17:55:15 -07:00
Nicholas Ward
8a726d5a86 fmt 2021-09-15 17:55:15 -07:00
Nicholas Ward
4eda0e9e9b fix (z calculated incorrectly) 2021-09-15 17:55:15 -07:00
Nicholas Ward
63246bc2f7 fix (wires were out of order) 2021-09-15 17:55:15 -07:00
Nicholas Ward
75ff36decb fmt 2021-09-15 17:55:15 -07:00
Nicholas Ward
6807c14c41 fix 2021-09-15 17:55:15 -07:00
Nicholas Ward
4484a42d93 test_gate_constraints 2021-09-15 17:55:15 -07:00
Nicholas Ward
18738e5984 fixes 2021-09-15 17:55:15 -07:00
Nicholas Ward
8731f8136f some tests 2021-09-15 17:55:15 -07:00
Nicholas Ward
542bc6283c added num_bits 2021-09-15 17:55:15 -07:00
Nicholas Ward
ada79f7072 cleanup 2021-09-15 17:55:15 -07:00
Nicholas Ward
93e6bc626d fixed errors 2021-09-15 17:55:15 -07:00
Nicholas Ward
9fa0500390 comparison gate 2021-09-15 17:55:15 -07:00
Daniel Lubarov
b3008b9475
Some changes to generator_indices_by_watches (#234)
* Some changes to generator_indices_by_watches

- Index generators by the representatives (in disjoint-set forest terminology) of their watched targets, rather than the watched targets themselves.  Enqueuing generators based on their watch lists then works correctly, so we no longer need the step where we reenqueue all generators.
- In #195, it was pointed out that this slows down witness generation a bit. I moved the indexing code to preprocessing, so the prover is a bit faster (~7ms for me).

* Outdated comment

* Panic instead of infinite loop if we get stuck

* BTree

* fmt
2021-09-13 16:38:55 -07:00
Daniel Lubarov
91f7b4e300
Replace CrandallQuarticField with a more generic QuarticExtension (#232)
* Replace `CrandallQuarticField` with a more generic `QuarticExtension`

And likewise for `CrandallQuadraticField`.

There are a few parameters which we can't automatically derive (in const Rust), so I specified them in a `AutoExtendable` trait.

This would make it fairly easy to add extension fields for `GoldilocksField` and any future fields.

* Attempt to derive 2-adicity, see Hamish's feedback

* Simplify TWO_ADICITY based on chat with Hamish

* PR feedback

* Merge AutoExtendable into Extendable (#235)
2021-09-13 11:45:17 -07:00
Daniel Lubarov
3bc34c59d8
Refactor GMiMC code (#224)
* Refactor GMiMC code

Adds a sub-trait of `Field` called `GMiMCInterface`, which is similar to `PoseidonInterface`.

This lets us have different fields with different GMiMC constants in a type-safe way.

* Remove `Interface`

* Const generic for width
2021-09-07 18:28:28 -07:00