Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ImmanuelSegol committed Jan 22, 2024
1 parent b2e5423 commit 275db6d
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 36 deletions.
17 changes: 17 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.docusaurus/
node_modules/
yarn.lock
.DS_Store

# tex build artifacts
.aux
.bbl
.bcf
.blg
.fdb_latexmk
.fls
.log
.out
.xml
.gz
.toc
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"proseWrap": "preserve",
"endOfLine": "lf"
}
1 change: 0 additions & 1 deletion docs/contributor-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ When opening a [pull request](https://github.com/ingonyama-zk/icicle/pulls) plea
## Questions?

Find us on [Discord](https://discord.gg/6vYrE7waPj).

7 changes: 3 additions & 4 deletions docs/icicle/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ICICLE has been used by companies like [Celer Network](https://github.com/celer-network), [Gnark](https://github.com/Consensys/gnark) and others to accelerate their ZK proving pipeline.

Many of these integrations have been a collaboration between Ingonyama and the integrating company. We have learned a lot about designing GPU based ZK provers.
Many of these integrations have been a collaboration between Ingonyama and the integrating company. We have learned a lot about designing GPU based ZK provers.

If you're interested in understanding these integrations better or learning how you can use ICICLE to accelerate your existing ZK proving pipeline this is the place for you.

Expand All @@ -12,7 +12,7 @@ Lets illustrate an ICICLE integration, so you can understand the core API and de

![ICICLE architecture](../../static/img/architecture-high-level.png)

Engineers usually use a cryptography library to implement their ZK protocols. These libraries implement efficient primitives which are used as building blocks for the protocol; ICICLE is such a library. The difference is that ICICLE is designed from the start to run on GPUs; the Rust and Golang APIs abstract away all low level CUDA details. Our goal was to allow developers with no GPU experience to quickly get started with ICICLE.
Engineers usually use a cryptography library to implement their ZK protocols. These libraries implement efficient primitives which are used as building blocks for the protocol; ICICLE is such a library. The difference is that ICICLE is designed from the start to run on GPUs; the Rust and Golang APIs abstract away all low level CUDA details. Our goal was to allow developers with no GPU experience to quickly get started with ICICLE.

A developer may use ICICLE with two main approaches in mind.

Expand Down Expand Up @@ -61,7 +61,7 @@ To switch over to ICICLE proving, make sure to change the backend you are using,
```
// toggle on
proofIci, err := groth16.Prove(ccs, pk, secretWitness, backend.WithIcicleAcceleration())
// toggle off
proof, err := groth16.Prove(ccs, pk, secretWitness)
```
Expand All @@ -88,7 +88,6 @@ Your logs should look something like this if everything went as expected.

You can reference the [Gnark docs](https://github.com/Consensys/gnark?tab=readme-ov-file#gpu-support) for further information.


### Halo2

[Halo2](https://github.com/zkonduit/halo2) fork integrated with ICICLE for GPU acceleration. This means that you can run your existing Halo2 circuits with GPU acceleration just by activating a feature flag.
Expand Down
23 changes: 9 additions & 14 deletions docs/icicle/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ ICICLE Core would typically be compiled into a static library and used in a thir
### ICICLE Rust and Golang bindings

- [ICICLE Rust bindings](https://github.com/ingonyama-zk/icicle/tree/main/wrappers/rust)
- [ICICLE Golang bindings](https://github.com/ingonyama-zk/icicle/tree/main/goicicle)
- [ICICLE Golang bindings](https://github.com/ingonyama-zk/icicle/tree/main/goicicle)

These bindings allow you to easily use ICICLE in a Rust or Golang project. Setting up Golang bindings requires a bit of extra steps compared to the Rust bindings which utilize the `cargo build` tool.


## Running ICICLE

This guide assumes that you have a Linux or Windows machine with a Nvidia GPU installed. If you don't have access to a Nvidia GPU you can access one for free on [Google Colab](https://colab.google/).
Expand All @@ -44,17 +43,15 @@ This guide assumes that you have a Linux or Windows machine with a Nvidia GPU in

#### Optional Prerequisites

- Docker, latest version.
- Docker, latest version.
- [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/index.html)


If you don't wish to install these prerequisites you can follow this tutorial using a [ZK-Container](https://github.com/ingonyama-zk/icicle/blob/main/Dockerfile) (docker container). To learn more about using ZK-Containers [read this](../ZKContainers.md).

### Setting up ICICLE and running tests

The objective of this guide is to make sure you can run the ICICLE Core, Rust and Golang tests. Achieving this will ensure you know how to setup ICICLE and run a ICICLE program. For simplicity, we will be using the ICICLE docker container as our environment, however, you may install the prerequisites on your machine and follow the same commands in your terminal.


#### Setting up our environment

Lets begin by cloning the ICICLE repository:
Expand All @@ -70,7 +67,7 @@ docker build -t icicle-demo .
docker run -it --runtime=nvidia --gpus all --name icicle_container icicle-demo
```

- `-it` runs the container in interactive mode with a terminal.
- `-it` runs the container in interactive mode with a terminal.
- `--gpus all` Allocate all available GPUs to the container. You can also specify which GPUs to use if you don't want to allocate all.
- `--runtime=nvidia` Use the NVIDIA runtime, necessary for GPU support.

Expand Down Expand Up @@ -121,12 +118,11 @@ cmake --build build

The output in `build` folder should include the static libraries for the compiled curve.


:::info
Make sure to only use `-DBUILD_TESTS=ON` for running test as the archive output will only be available when `-DBUILD_TESTS=ON` is not supplied.
:::

To run the test
To run the test

```
cd build
Expand Down Expand Up @@ -177,11 +173,10 @@ ICICLE examples can be found [here](https://github.com/ingonyama-zk/icicle-examp

In each example directory, ZK-container files are located in a subdirectory `.devcontainer`.

* example-name/
* .devcontainer/
* Dockerfile
* devcontainer.json

- example-name/
- .devcontainer/
- Dockerfile
- devcontainer.json

Lets run one of our C++ examples, in this case the [MSM example](https://github.com/ingonyama-zk/icicle-examples/blob/main/c%2B%2B/msm/example.cu).

Expand Down Expand Up @@ -230,7 +225,6 @@ static libraries can be loaded into memory once and used by multiple programs, r

Lets review the Golang bindings since its a pretty verbose example (compared to rust which hides it pretty well) of using static libraries. Golang has a library named `CGO` which can be used to link static libraries. Here's a basic example on how you can use cgo to link these libraries:


```go
/*
#cgo LDFLAGS: -L/path/to/shared/libs -lbn254 -lbls12_381 -lbls12_377 -lbw6_671
Expand Down Expand Up @@ -260,4 +254,5 @@ One of the core ideas behind ICICLE is that developers can gradually accelerate
Therefore we offer adapters for various popular libraries, these adapters allow us to convert points and scalars between different formats defined by various libraries. Here is a list:

Golang adapters:

- [Gnark crypto adapter](https://github.com/ingonyama-zk/iciclegnark)
2 changes: 0 additions & 2 deletions docs/icicle/rust-bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ If you wish to point to a specific ICICLE branch add `branch = "<name_of_branch>

When you build your project ICICLE will be built as part of the build command.


# How do the rust bindings work?

The rust bindings are just rust wrappers for ICICLE Core static libraries which can be compiled. We integrate the compilation of the static libraries into rusts toolchain to make usage seamless and easy. This is achieved by [extending rusts build command](https://github.com/ingonyama-zk/icicle/blob/main/wrappers/rust/icicle-curves/icicle-bn254/build.rs).


```rust
use cmake::Config;
use std::env::var;
Expand Down
23 changes: 10 additions & 13 deletions docs/icicle/supporting-additional-curves.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Supporting additional curves is still a work in progress and is bound to change

:::


We understand the need for ZK developers to use different curves, some common some more exotic. For this reason we designed ICICLE to allow developers to add any curve they desire.

## ICICLE Core
Expand Down Expand Up @@ -45,21 +44,19 @@ In order to support a new curves in the binding libraries you first must support

Create a new folder named `icicle-<curve_name>` under the [rust wrappers folder](https://github.com/ingonyama-zk/icicle/tree/main/wrappers/rust/icicle-curves). Your new directory should look like this.


* icicle-<curve_name>/
* src/
* ntt/
* mod.rs
* msm/
* mod.rs
* curve.rs
* lib.rs
* Cargo.toml
* build.rs
- icicle-<curve_name>/
- src/
- ntt/
- mod.rs
- msm/
- mod.rs
- curve.rs
- lib.rs
- Cargo.toml
- build.rs

Lets look at [`ntt/mod.rs`](https://github.com/ingonyama-zk/icicle/blob/main/wrappers/rust/icicle-curves/icicle-bn254/src/ntt/mod.rs) for example.


```
...
Expand Down
3 changes: 2 additions & 1 deletion docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
slug: /
displayed_sidebar: GettingStartedSidebar
---

# Welcome to Ingonyama's Developer Documentation

Ingonyama is a next-generation semiconductor company, focusing on Zero-Knowledge Proof hardware acceleration. We build accelerators for advanced cryptography, unlocking real-time applications. Our focus is on democratizing access to compute intensive cryptography and making it accessible for developers to build on top of.

Currently our flagship products are:

- **ICICLE**:
[ICICLE](https://github.com/ingonyama-zk/icicle) is a fully featured GPU accelerated cryptography library for building ZK provers. ICICLE allows you to accelerate your ZK existing protocols in a matter of hours or implement your protocol from scratch on GPU.
[ICICLE](https://github.com/ingonyama-zk/icicle) is a fully featured GPU accelerated cryptography library for building ZK provers. ICICLE allows you to accelerate your ZK existing protocols in a matter of hours or implement your protocol from scratch on GPU.

---

Expand Down
18 changes: 18 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"dev": "docusaurus start"
"dev": "docusaurus start",
"format": "prettier --write '**/*.md'"
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.18",
Expand All @@ -40,5 +41,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"prettier": "^3.2.4"
}
}

0 comments on commit 275db6d

Please sign in to comment.