|
1 | | -# halo2 [](https://crates.io/crates/halo2) # |
| 1 | +## Icicle Halo2 Usage Guide |
2 | 2 |
|
3 | | -## [Documentation](https://privacy-scaling-explorations.github.io/halo2/halo2_proofs) |
| 3 | +This repository contains a ICICLE integration fork of [ezkl-halo2](https://github.com/zkonduit/halo2), designed for efficient proof generation using CUDA. |
4 | 4 |
|
5 | | -For experimental features `privacy-scaling-explorations/halo2` fork adds, please refer to [`experimental-features.md`](./book/src/user/experimental-features.md). |
| 5 | +### Prerequisites |
6 | 6 |
|
7 | | -## Minimum Supported Rust Version |
| 7 | +* **Environment Variable Setup**: |
8 | 8 |
|
9 | | -Requires Rust **1.65.0** or higher. |
| 9 | + Before running the CUDA backend, set the following environment variable: |
10 | 10 |
|
11 | | -Minimum supported Rust version can be changed in the future, but it will be done with a |
12 | | -minor version bump. |
| 11 | + ```bash |
| 12 | + export ICICLE_BACKEND_INSTALL_DIR=halo2/icicle/backend/cuda |
| 13 | + ``` |
13 | 14 |
|
14 | | -## Controlling parallelism |
| 15 | +## Benchmarks |
15 | 16 |
|
16 | | -`halo2` currently uses [rayon](https://github.com/rayon-rs/rayon) for parallel computation. The `RAYON_NUM_THREADS` environment variable can be used to set the number of threads. |
| 17 | +We benched the code on this setup: |
| 18 | +- 4080 & i9–13900K |
17 | 19 |
|
18 | | -When compiling to WASM-targets, notice that since version `1.7`, `rayon` will fallback automatically (with no need to handle features) to require `getrandom` in order to be able to work. For more info related to WASM-compilation. |
| 20 | +We used the circuits in the MoPro’s benchmark repository to compare the proving systems. |
| 21 | + |
| 22 | +- **Simple Lookup**: Defines a lookup table that doubles input values and verifies this relation using both a lookup constraint and a simple identity gate. |
| 23 | +- **Plonk**: Implements a gate that supports both multiplication and addition. It repeatedly computes a^2 + a, verifies correctness using gate constraints. |
| 24 | +- **Lookups**: Defines a lookup-heavy computation using a simple 8-bit lookup table and multiple redundant lookup constraints to inflate the degree of the constraint system. |
| 25 | + |
| 26 | +<p align="center"> |
| 27 | + <img src="./figures/lookups_ms_log_scale.png" alt="4090 Benchmark" width="45%"> |
| 28 | + <img src="./figures/lookups.png" alt="4080 Benchmark" width="45%"> |
| 29 | +</p> |
| 30 | + |
| 31 | +<p align="center"> |
| 32 | + <img src="./figures/simple_ms_log_scale.png" alt="4090 Benchmark" width="45%"> |
| 33 | + <img src="./figures/simple.png" alt="4080 Benchmark" width="45%"> |
| 34 | +</p> |
| 35 | + |
| 36 | +<p align="center"> |
| 37 | + <img src="./figures/plonk_ms_log_scale.png" alt="4090 Benchmark" width="45%"> |
| 38 | + <img src="./figures/plonk.png" alt="4080 Benchmark" width="45%"> |
| 39 | +</p> |
| 40 | + |
| 41 | +## Reproducing the benchmarks |
| 42 | + |
| 43 | +We have used the existing benchmark circuits under the halo2 repository. You can reporduce the benchmarks by running |
| 44 | + |
| 45 | +```bash |
| 46 | +cargo run --package halo2_proofs --example lookups |
| 47 | +cargo run --package halo2_proofs --example simple-lookup |
| 48 | +cargo run --package halo2_proofs --example plonk |
| 49 | +``` |
19 | 50 |
|
20 | | -See: [Rayon: Usage with WebAssembly](https://github.com/rayon-rs/rayon#usage-with-webassembly) for more |
21 | 51 |
|
22 | 52 | ## License |
23 | 53 |
|
|
0 commit comments