Daniel Lubarov
c8e043a53f
Optimize recursive Poseidon constraint evaluation ( #333 )
...
* 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`.
2021-11-02 14:42:30 -07:00
Daniel Lubarov
e39af10a6b
More wires for ConstantGate ( #332 )
...
* More wires for ConstantGate
* fix
* fix
2021-11-02 14:41:12 -07:00
Daniel Lubarov
bae26e09c2
D=2 in recursion test ( #336 )
2021-11-02 12:38:46 -07:00
Jakub Nabaglo
184f73c604
Expose optimized Poseidon routines to the Poseidon gate (ARM) ( #331 )
...
* Expose optimized Poseidon routines to the Poseidon gate
* Daniel PR comments
2021-11-02 12:38:30 -07:00
Jakub Nabaglo
bc57a561e6
Delete CrandallField
2021-11-02 12:29:26 -07:00
Daniel Lubarov
c6f91148d5
PoseidonMdsGate ( #330 )
...
PoseidonGate's recursive evaluations were using a lot of gates, and the MDS layer was the main culprit.
The other issue is that `constant_layer_recursive` creates a bunch of `ArithmeticGate`s with unique constants. We could either change `ArithmeticGate` to support different constants per operation, or wire in constants from `ConstantGate`, and change `ConstantGate` to support several constants per gate.
This won't really help anything near term since we're still between 2^12 and 2^13, but could have some benefits later, depending on what recursion arities and security settings we end up using.
`PoseidonMdsGate` needs `2 * D * WIDTH = 48` routed wires, and the combination of adding a gate and increasing routed wires slows down the prover a bit. So for now, I kept it at 28 wires, and the old code path is still used.
2021-11-02 08:16:28 -07:00
Daniel Lubarov
caf95ae9dc
fmt
2021-11-01 21:50:42 -07:00
Daniel Lubarov
eb76bc5f67
cargo fix
2021-11-01 21:42:29 -07:00
Jakub Nabaglo
31fda351c1
Expose vectorized Poseidon layers for use in gate evaluation ( #329 )
2021-11-01 16:20:29 -07:00
Jakub Nabaglo
2bc745946b
Docs (minor): ARM Poseidon explanation fixes ( #328 )
2021-11-01 12:34:11 -07:00
Jakub Nabaglo
9bbbcf783a
Static asserts: check ARM Poseidon constants ( #327 )
2021-11-01 12:34:03 -07:00
Jakub Nabaglo
06e48d0b61
ARM-optimized Goldilocks Poseidon ( #294 )
...
* Optimized Poseidon for ARM
* Hamish comments
* Unused things
2021-10-30 14:32:39 -07:00
Jakub Nabaglo
8a5419d461
Static asserts in x86 Poseidon ( #325 )
...
* Static asserts in x86 Poseidon
* Minor style
2021-10-30 13:10:59 -07:00
Jakub Nabaglo
f286925eaa
Add .DS_Store to .gitignore ( #324 )
2021-10-27 10:44:36 -07:00
Jakub Nabaglo
7d39074e61
Minor optimizations to addition ( #323 )
2021-10-26 18:05:52 -07:00
Jakub Nabaglo
bf421314f9
Batched eval_vanishing_poly_base ( #317 )
...
* Batched eval_vanishing_poly_base
* Reduce the number of allocations
* Lints
* Delete unused things
* Minor: fix a debug_assert
* Daniel PR comments
* Lints
* Daniel PR comments
2021-10-25 13:23:05 -07:00
Daniel Lubarov
f616d6436d
Print overall gate counts ( #322 )
2021-10-25 09:12:42 -07:00
Jakub Nabaglo
7a8e12b8f4
Profile-guided optimization script ( #321 )
2021-10-23 11:55:49 -07:00
Daniel Lubarov
806641d13f
Small optimizations ( #319 )
...
* Small optimizations
* Small optimizations
* feedback
* inline
* feedback
* fix unused import
2021-10-22 19:11:05 -07:00
Jakub Nabaglo
db23416b04
Goldilocks: better constant propagation through add_with_wraparound ( #320 )
2021-10-22 15:02:22 -07:00
Hamish Ivey-Law
c406f464b8
Faster squaring in extension fields ( #318 )
...
* Faster squaring for extension fields; use in cube().
* Add squaring to arithmetic benchmark.
* Rename variable to remove warning; adjust comment.
* Inline always (improves latency measurements a lot).
2021-10-22 16:05:00 +11:00
Jakub Nabaglo
001c979599
AVX2: Fold the constant layer into MDS matrix multiplication ( #302 )
...
* Fuse constant layer with MDS matrix multiplication
* Warnings and lints
* Minor documentation
2021-10-21 16:51:06 -07:00
Daniel Lubarov
7d45c80c03
Have eval_unfiltered_base call the normal Poseidon methods ( #316 )
...
* Have eval_unfiltered_base call the normal Poseidon methods
* fmt
2021-10-21 14:28:07 -07:00
Daniel Lubarov
b0b2a10da0
Only log timing for the final proof in recursion tests ( #315 )
...
* Only log timing for the final proof in recursion tests
Just to reduce noise; the performance of the final proof is most meaningful
* fmt
2021-10-21 14:22:22 -07:00
wborgeaud
6463e4f4e7
Merge pull request #314 from mir-protocol/remove_basesum_gates
...
Ensure only one `BaseSumGate` is instantiated
2021-10-21 16:51:26 +02:00
wborgeaud
1f1827dae7
Clippy
2021-10-21 14:36:36 +02:00
wborgeaud
318185d1c0
Use only one BaseSumGate
2021-10-21 12:56:02 +02:00
wborgeaud
bf6d0266d5
Merge pull request #313 from mir-protocol/arithmetic_params_order
...
Change parameters order in `CircuitBuilder::arithmetic`
2021-10-21 09:41:53 +02:00
wborgeaud
1d2ae77eea
Change parameters order in CircuitBuilder::arithmetic
2021-10-21 08:56:30 +02:00
Daniel Lubarov
22ce2da9e1
Add add_const, mul_const, mul_const_add methods ( #312 )
...
* Add mul_const, mul_const_add methods
To replace some arithmetic calls; I think it's easier to read.
* One more
* Couple more
* tweak
* tweak
2021-10-20 23:43:52 -07:00
Daniel Lubarov
0b75b24c09
Have split_low_high use range_check ( #311 )
2021-10-20 23:43:35 -07:00
Daniel Lubarov
cd13a3be65
Update bimap
2021-10-19 19:35:10 -07:00
Daniel Lubarov
64cd2e5686
2 challenges, 28 routed wires ( #310 )
...
* 2 challenges, 28 routed wires
2 challenges gives certain checks approximately (field_bits - degree_bits) * 2 bits of security, so we maintain our target of 100 bits for circuits with 2^14 gates or fewer.
28 routed wires is the min for `InterpolationGate`. A lower number helps reduce proof sizes. We can go back to a high number if there's any strong reason to reduce our gate count (e.g. if we were trying to hit 2^12).
* Check FRI conjectured security
* Fix
2021-10-19 12:38:20 -07:00
wborgeaud
019ccf537b
Merge pull request #309 from mir-protocol/use_quadratic_extension
...
Generalize `RandomAccessGate` to allow using quadratic field extensions
2021-10-18 22:00:04 +02:00
wborgeaud
0af4b1f02a
Merge pull request #308 from mir-protocol/borrow_new_from_config
...
Minor: Take `CircuitConfig` by reference to avoid a few clones
2021-10-18 21:49:24 +02:00
wborgeaud
e24285c3b0
Separate random access generators
2021-10-18 21:48:40 +02:00
wborgeaud
5f4a244240
PR feedback
2021-10-18 21:38:57 +02:00
wborgeaud
c7674b24ba
Unused imports
2021-10-18 17:27:22 +02:00
wborgeaud
dda14011c5
Forgot a random access check
2021-10-18 17:23:39 +02:00
wborgeaud
5b81006e9a
Fill random access gates to make sure all generators are run
2021-10-18 17:11:59 +02:00
wborgeaud
3f0b5ab9d3
Keep track of the last used RAM gate
2021-10-18 16:48:21 +02:00
wborgeaud
a35cd98b03
New random access gadget
2021-10-18 15:45:52 +02:00
wborgeaud
104fd08e72
Working RAM gate
2021-10-18 15:19:09 +02:00
wborgeaud
9503bb22f4
Take config by reference to avoid clone
2021-10-18 11:11:48 +02:00
wborgeaud
00ce9d9f25
Add num_copies to RAM gate
2021-10-18 11:07:18 +02:00
Jakub Nabaglo
1a43d130d9
Relegate poseidon_naive to testing only. ( #303 )
2021-10-14 18:35:57 -07:00
Jakub Nabaglo
3790b55c4b
Delete obsolete optimizations (Crandall Poseidon on AVX2 and NEON) ( #305 )
2021-10-14 08:59:47 -07:00
Jakub Nabaglo
ff3f0891bc
Minor: unused import warning ( #304 )
2021-10-13 16:20:17 -07:00
Jakub Nabaglo
0f7be8b221
Fix compilation error on Aarch64 ( #301 )
2021-10-13 10:33:36 -07:00
Jakub Nabaglo
609028c899
Poseidon-12 in hand-rolled ASM ( #276 )
...
* Goldilocks Poseidon-12 in asm
* Lints
* Hamish comments
* Reorganize arch-specific files
2021-10-13 09:47:50 -07:00