Daniel Lubarov
239c795a9d
Address some more arithmetic gates that have unique constants ( #361 )
...
Saves 131 gates, though only when not using `PoseidonMdsGate`, so not relevant for the 2^12 branch.
2021-11-15 10:10:37 -08:00
Jakub Nabaglo
168f572804
Fix rustfmt failures on main ( #348 )
2021-11-09 14:52:05 -08: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
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
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
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
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
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
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
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
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
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
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
wborgeaud
bc95563f43
PR feedback
2021-10-08 08:15:55 +02:00
wborgeaud
64d386051b
More cleaning
2021-10-07 22:41:30 +02:00
wborgeaud
e531eda576
Cleaning
2021-10-07 22:32:58 +02:00
wborgeaud
64ad8783eb
Fix path compression
2021-10-07 22:19:26 +02:00
Daniel Lubarov
3d39925973
Couple tweaks for Goldilocks ( #274 )
...
- impl `RichField`
- Fix missing imports (easy to miss since they're conditionally compiled)
- Have the benchmarks use Goldilocks
2021-09-28 10:03:19 -07:00
Hamish Ivey-Law
a0de564806
Implement Poseidon width 8 and 12 for Goldilocks field. ( #268 )
...
* Implement Poseidon width 8 and 12 for Goldilocks field.
* Comment on generating Poseidon implementations.
* Update Goldilocks 8 constants with corrected MDS matrix.
* Add Goldilocks test vectors and refactor tests.
* Add test vectors of all -1's.
* cargo fmt pedantry.
2021-09-28 10:51:03 +10: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
747c9f894b
Back to width 12
2021-09-26 20:09:26 +02:00
Daniel Lubarov
f382289896
Derive challenges from other proof fields ( #262 )
...
* Derive challenges from other proof fields
* Delete failing test
Seems really hard to get the challenges right with the new model.
* Move PoW check
* Other feedback
2021-09-25 19:41:48 -07: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
Jakub Nabaglo
2f8286ff98
Fix a few warnings ( #259 )
2021-09-21 13:12:46 -07:00
Daniel Lubarov
43cbb84cc9
Have verify_merkle_proof call permute_swapped ( #257 )
...
Rather than adding the gate "manually".
2021-09-21 12:29:37 -07:00
wborgeaud
5d8241760f
Merge pull request #255 from mir-protocol/better_compressed_merkle_paths
...
Simpler Merkle paths compression
2021-09-21 08:56:34 +02:00
wborgeaud
391759479e
PR feedback
2021-09-21 08:37:23 +02:00
Jakub Nabaglo
1369dd7c76
Many small optimizations to scalar Poseidon ( #253 )
...
* Many small optimizations
* Lints
* Hamish comments
* Inlining
2021-09-20 10:52:12 -07:00
wborgeaud
1f42916bfc
Comments
2021-09-20 17:58:25 +02:00
wborgeaud
36e4d3608d
Working (de)compression for FRI proofs
2021-09-20 17:34:52 +02:00
Daniel Lubarov
471ace6d85
Remove loop unrolling in a few more places where it doesn't seem important ( #254 )
...
LLVM will do some unrolling/inlining, but I think we should only force it in places we know it's really justified.
2021-09-20 07:50:00 -07:00
wborgeaud
422e72954c
Working path (de)compression
2021-09-20 14:37:28 +02: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
Jakub Nabaglo
d3de2b5518
Fix alignment assumptions in AVX2 Poseidon
2021-09-17 10:04:05 -07:00
wborgeaud
14bbf5ae11
Fix AVX2 conflict
2021-09-17 17:50:43 +02:00