https://github.com/qedprotocol/plonky2-metal-demo
Speed up plonky2/starky proving by 50% on Macs using Metal Acceleration
https://github.com/qedprotocol/plonky2-metal-demo
Last synced: 5 months ago
JSON representation
Speed up plonky2/starky proving by 50% on Macs using Metal Acceleration
- Host: GitHub
- URL: https://github.com/qedprotocol/plonky2-metal-demo
- Owner: QEDProtocol
- License: mit
- Created: 2023-11-01T10:01:38.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-26T08:56:54.000Z (about 2 years ago)
- Last Synced: 2025-02-19T13:14:02.874Z (over 1 year ago)
- Language: Metal
- Size: 361 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Plonky2 Metal Demo
This is a demonstration of using a Metal compute shader to accelerate plonky2/starky proving. QED no longer uses classic poseidon as our default hasher, but we decided release our early implementation since it still provides a **40-50% speed up** to proving time despite being extremely janky.
We hope that this can be the starting point for people that want to experiment with optimizing plonky2.
Notably, proofs generated by this demo are drop in compatible with vanilla plonky2.
Note: This uses a modified version of plonky2 which adds `MerkleHasher` to GenericConfig.
If you don't want to use the fork used by this repo, the changes are relatively simple and can be found [here](https://github.com/QEDProtocol/plonky2-merkle-config/commit/4dfb8791505210408c6ed4c1e04d173ecc0e7639).
Running:
```bash
make main
```
Output Example:
```
num_gates: 16384, degree: 32768
proving: metal took 1362ms
num_gates: 16384, degree: 32768
proving: cpu took 2147ms
metal is 57.635829662261386% faster than cpu+rayon
```
(c) 2023 Zero Knowledge Labs Limited - MIT - ∀