Skip to content

Commit e5dc550

Browse files
committed
Merge remote-tracking branch 'origin/yshekel/V3' into nonam3e/V3
2 parents 9f08507 + 9759cef commit e5dc550

File tree

18 files changed

+242
-206
lines changed

18 files changed

+242
-206
lines changed

docs/docs/icicle/arch_overview.md

-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ ICICLE is designed to be extensible, allowing developers to integrate new backen
2121
- **Custom Backends:** Developers can create their own backends to leverage different hardware or optimize for specific use cases. The process of building and integrating a custom backend is documented in the [Build Your Own Backend](./build_your_own_backend.md) section.
2222
- **Pluggable Components:** ICICLE's architecture allows for easy integration of additional cryptographic primitives or enhancements, ensuring that the framework can evolve with the latest advancements in cryptography and hardware acceleration.
2323

24-
TODO ADD diagram
25-
2624
## Multi-Device Support
2725

2826
- **Scalability:** ICICLE supports multi-device configurations, enabling the distribution of workloads across multiple GPUs or other hardware accelerators. This feature allows for scaling ZK proofs and other cryptographic operations across larger data centers or high-performance computing environments.
29-
- **Device Management:** The architecture includes tools for managing multiple devices, ensuring that resources are efficiently utilized and that workloads are balanced across available hardware.
3027

3128
---
3229

docs/docs/icicle/getting_started.md

+29-22
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ICICLE can be built and tested in C++ using CMake. The build process is straight
2020
2. **Configure the build:**
2121
```bash
2222
mkdir -p build && rm -rf build/*
23-
cmake -S icicle -B build -DCMAKE_BUILD_TYPE=Release -DFIELD=babybear
23+
cmake -S icicle -B build -DFIELD=babybear
2424
```
2525

2626
:::note
@@ -40,22 +40,24 @@ ICICLE can be built and tested in C++ using CMake. The build process is straight
4040
target_link_libraries(yourApp PRIVATE icicle_field_babybear icicle_device)
4141
```
4242

43-
4443
5. **Installation (optional):**
4544
To install the libs, specify the install prefix in the [cmake command](./getting_started.md#build-commands)
46-
`-DCMAKE_INSTALL_PREFIX=/install/dir/`. Default install path is `/usr/local` if not specified.
45+
`-DCMAKE_INSTALL_PREFIX=/install/dir/`. Default install path on linux is `/usr/local` if not specified. For other systems it may differ. The cmake command will print it to the log
46+
```
47+
-- CMAKE_INSTALL_PREFIX=/install/dir/for/cmake/install
48+
```
4749
Then after building, use cmake to install the libraries:
4850
```
49-
cmake -S icicle_v3 -B build -DCMAKE_INSTALL_PREFIX=/path/to/install/dir/ -DCMAKE_BUILD_TYPE=Release -DFIELD=babybear
50-
cmake --build build -j # build ICICLE
51-
cmake --install build # install icicle in /path/to/install/dir/
51+
cmake -S icicle -B build -DFIELD=babybear -DCMAKE_INSTALL_PREFIX=/path/to/install/dir/
52+
cmake --build build -j # build
53+
cmake --install build # install icicle to /path/to/install/dir/
5254
```
5355

5456
6. **Run tests (optional):**
5557
Add `-DBUILD_TESTS=ON` to the [cmake command](./getting_started.md#build-commands) and build.
5658
Execute all tests
5759
```bash
58-
cmake -S icicle_v3 -B build --DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DFIELD=babybear
60+
cmake -S icicle -B build -DFIELD=babybear -DBUILD_TESTS=ON
5961
cmake --build build -j
6062
cd build/tests
6163
ctest
@@ -67,19 +69,17 @@ ICICLE can be built and tested in C++ using CMake. The build process is straight
6769
./build/tests/test_field_api --gtest_filter="*ntt*"
6870
```
6971
:::note
70-
Some tests assume a cuda backend exists and will fail otherwise.
71-
:::
72-
:::note
73-
Each C++ test-suite is an executable that links to gtest.
72+
Most tests assume a cuda backend exists and will fail otherwise if cannot find a CUDA device.
7473
:::
7574

7675
#### Build Flags
7776

7877
You can customize your ICICLE build with the following flags:
7978

80-
- `-DCPU_BACKEND=ON/OFF`: Enable or disable built it CPU backend. Default=ON.
81-
- `-DBUILD_TESTS=ON/OFF`: Enable or disable tests. Default=OFF.
82-
- `-DCMAKE_INSTALL_PREFIX=/install/dir`: Specify install dir. Default=/usr/local.
79+
- `-DCPU_BACKEND=ON/OFF`: Enable or disable built-in CPU backend. `default=ON`.
80+
- `-DCMAKE_INSTALL_PREFIX=/install/dir`: Specify install directory. `default=/usr/local`.
81+
- `-DBUILD_TESTS=ON/OFF`: Enable or disable tests. `default=OFF`.
82+
- `-DBUILD_BENCHMARKS=ON/OFF`: Enable or disable benchmarks. `default=OFF`.
8383

8484
### Rust: Build, Test, and Install
8585

@@ -91,22 +91,28 @@ To build and test ICICLE in Rust, follow these steps:
9191
```
9292

9393
2. **Build the Rust project:**
94-
```bash
95-
TODO what about features? Now it doesn't make sense to disable features.
94+
TODO what about features? Now it doesn't make sense to disable features.
95+
```bash
9696
cargo build --release
9797
```
9898

99-
3. **Run tests:**
99+
4. **Run tests:**
100100
```bash
101101
cargo test
102102
```
103+
:::note
104+
Most tests assume a CUDA backend is installed and fail otherwise.
105+
:::
103106

104-
4. **Install the library:**: The libraries are installed to the `target/<buildmode>/deps/icicle` dir by default. For custom install dir. define the env variable `export ICICLE_INSTALL_DIR=/path/to/install/dir` before building or via cargo:
107+
5. **Install the library:**
108+
109+
By default, the libraries are installed to the `target/<buildmode>/deps/icicle` dir. For custom install dir. define the env variable:
105110
```bash
106-
TODO support cargo install
107-
cargo install --path /path/to/install/dir
111+
export ICICLE_INSTALL_DIR=/path/to/install/dir
108112
```
109113

114+
(TODO: cargo install ?)
115+
110116
#### Use as cargo dependency
111117

112118
In cargo.toml, specify the ICICLE libs to use:
@@ -116,15 +122,16 @@ In cargo.toml, specify the ICICLE libs to use:
116122
icicle-runtime = { path = "git = "https://github.com/ingonyama-zk/icicle.git"" }
117123
icicle-core = { path = "git = "https://github.com/ingonyama-zk/icicle.git"" }
118124
icicle-bls12-377 = { path = "git = "https://github.com/ingonyama-zk/icicle.git" }
125+
# add other ICICLE crates here if need additional fields/curves
119126
```
120127
121128
:::note
122129
Can specify `branch = <branch-name>` or `tag = <tag-name>` or `rev = <commit-id>`.
123130
:::
124131
125-
The libs will be built and installed to `target/<buildmode>/deps/icicle` so you can easily link to them. Alternatively you can set `ICICLE_INSTALL_DIR` env variable to have it installed elsewhere.
132+
As explained above, the libs will be built and installed to `target/<buildmode>/deps/icicle` so you can easily link to them. Alternatively you can set `ICICLE_INSTALL_DIR` env variable for a custom install directory.
126133
:::note
127-
Make sure to have the icicle libs available when deploying an application that depends on icicle shared libs.
134+
Make sure to install the icicle libs when installing a library/application that depends on icicle.
128135
:::
129136
130137
### Go: Build, Test, and Install (TODO)

docs/docs/icicle/libraries.md

+13-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
# ICICLE libraries
22

3-
TODO : review this page and see the hashes really exist
3+
ICICLE is composed of two main logical parts:
4+
1. [**ICICLE device library**](#icicle-device)
5+
2. [**ICICLE template core library**](#icicle-core)
46

57
## ICICLE device
68

79
The ICICLE device library serves as an abstraction layer for interacting with various hardware devices. It provides a comprehensive interface for tasks such as setting the active device, querying device-specific information like free and total memory, determining the number of available devices, and managing memory allocation. Additionally, it offers functionality for copying data to and from devices, managing task queues (streams) for efficient device utilization, and abstracting the complexities of device management away from the user.
810

9-
TODO update links
10-
11-
[C++ device APIs](https://github.com/ingonyama-zk/icicle/blob/yshekel/V3/icicle_v3/include/icicle/runtime.h)
12-
13-
[Rust icicle-runtime crate](https://github.com/ingonyama-zk/icicle/tree/yshekel/V3/wrappers/rust_v3/icicle-runtime)
14-
15-
TODO Golang
11+
See programmers guide for more details. [C++](./programmers_guide/cpp#device-management), [Rust](./programmers_guide/rust#device-management), [Go TODO](./programmers_guide/go)
1612

1713
## ICICLE Core
1814

@@ -31,22 +27,22 @@ Each library has a corresponding crate. See [programmers guide](./programmers_gu
3127
| Operation\Curve | [bn254](https://neuromancer.sk/std/bn/bn254) | [bls12-377](https://neuromancer.sk/std/bls/BLS12-377) | [bls12-381](https://neuromancer.sk/std/bls/BLS12-381) | [bw6-761](https://eprint.iacr.org/2020/351) | grumpkin |
3228
| --------------------------------------------------- | :------------------------------------------: | :---------------------------------------------------: | :---------------------------------------------------: | :-----------------------------------------: | :------: |
3329
| [MSM](./primitives/msm) ||||||
34-
| G2 ||||||
30+
| G2 MSM ||||||
3531
| [NTT](./primitives/ntt) ||||||
3632
| ECNTT ||||||
37-
| VecOps ||||||
33+
| [Vector operations](./primitives/vec_ops) ||||||
3834
| [Polynomials](./polynomials/overview) ||||||
3935
| [Poseidon](primitives/poseidon) ||||||
4036
| [Merkle Tree](primitives/poseidon#the-tree-builder) ||||||
4137

4238
#### Supported fields and operations
4339

44-
| Operation\Field | [babybear](https://eprint.iacr.org/2023/824.pdf) | [Stark252](https://docs.starknet.io/documentation/architecture_and_concepts/Cryptography/p-value/) |
45-
| ------------------------------------- | :----------------------------------------------: | :------------------------------------------------------------------------------------------------: |
46-
| VecOps |||
47-
| [Polynomials](./polynomials/overview) |||
48-
| [NTT](primitives/ntt) |||
49-
| Extension Field |||
40+
| Operation\Field | [babybear](https://eprint.iacr.org/2023/824.pdf) | [Stark252](https://docs.starknet.io/documentation/architecture_and_concepts/Cryptography/p-value/) |
41+
| ----------------------------------------- | :----------------------------------------------: | :------------------------------------------------------------------------------------------------: |
42+
| [Vector operations](./primitives/vec_ops) |||
43+
| [Polynomials](./polynomials/overview) |||
44+
| [NTT](primitives/ntt) |||
45+
| Extension Field |||
5046

5147
#### Supported hashes
5248

@@ -60,4 +56,4 @@ Each backend may implement
6056
- One or more ICICLE library. For example implement only bn254 curve.
6157
- One or more APIs in this library. For example MSM only.
6258

63-
See [Build Your Own Backend](./build_your_own_backend.md) for more details.
59+
See [CUDA backend](./install_cuda_backend.md) and [Build Your Own Backend](./build_your_own_backend.md) for more info about implementing a backend.

docs/docs/icicle/primitives/msm.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ eIcicleError msm(const S* scalars, const A* bases, int msm_size, const MSMConfig
8080
```
8181
8282
:::note
83-
The API is template and can work with all ICICLE curves (if corresponding lib is linked).
83+
The API is template and can work with all ICICLE curves (if corresponding lib is linked), including G2 groups.
8484
:::
8585
8686
### Batched MSM
@@ -91,14 +91,17 @@ Config fields `are_bases_shared` and `batch_size` are used to configure msm for
9191
9292
### G2 MSM
9393
94-
G2 MSM is also supported for most curves. It is similar to G1 MSM but using the G2 types instead.
94+
for G2 MSM, use the [same msm api](#msm-function) with the G2 types.
9595
96+
:::note
97+
Supported curves have types for both G1 and G2.
98+
:::
9699
97100
### Precompution
98101
99102
#### What It Does:
100103
101-
- Precomputation: The function computes a set of additional points derived from the original base points. These precomputed points are stored and later reused during the MSM computation.
104+
- The function computes a set of additional points derived from the original base points. These precomputed points are stored and later reused during the MSM computation.
102105
- Purpose: By precomputing and storing these points, the MSM operation can reduce the number of operations needed at runtime, which can significantly speed up the calculation.
103106
104107
#### When to Use:
@@ -112,18 +115,18 @@ eIcicleError msm_precompute_bases(const A* input_bases, int bases_size, const MS
112115
```
113116

114117
:::note
115-
User is allocating the `output_bases` (on host or device memory) and later use it when calling msm.
118+
User is allocating the `output_bases` (on host or device memory) and later use it as bases when calling msm.
116119
:::
117120

118121
## Rust and Go bindings
119122

123+
The Rust and Go bindings provide equivalent functionality for their respective environments. Refer to their documentation for details on usage.
124+
120125
- [Golang](../golang-bindings/msm.md)
121126
- [Rust](../rust-bindings/msm.md)
122127

123-
The Rust and Go bindings provide equivalent functionality for their respective environments. Refer to their documentation for details on usage.
124-
125128
## CUDA backend MSM
126-
This section describes the CUDA msm implementation and how to use it.
129+
This section describes the CUDA msm implementation and how to customize it (optional).
127130

128131
### Algorithm description
129132

0 commit comments

Comments
 (0)