Overview
This project aims to implement Sumcheck protocol on GPU via CUDA, following the algorithm described from here. This project aims to minimize C++ code and provide easy to use Rust API for launching kernel by leveraging bindgen and cudarc.
Architecture
bindgen: generates Rust struct defined inside CUDA kernels written in C++cudarc: safe abstraction for interop with GPU driver
Structure
.
├── Cargo.lock
├── Cargo.toml
├── build.rs
├── docs
│ └── design.md
└── src
├── cuda
│ ├── includes
│ │ ├── barretenberg
│ │ ├── prime_field.h
│ │ ├── test.cpp
│ │ └── wrapper.h
│ └── kernels
│ ├── multilinear.cu
│ ├── scalar_multiplication.cu
│ └── sumcheck.cu
├── field.rs
└── lib.rs
-
build.rscontains the build script for building the whole project -
src/cuda/includes/barretenberg/contains barretenberg lib (https://github.com/AztecProtocol/barretenberg/tree/master) for field implementation in C++ -
src/cuda/includes/prime_field.hdeclaresFieldBindingstruct in C representing barretenbergfieldstruct. This wrapping is due to the lack of support for C++ language ofbindgencrate -
src/cuda/includes/wrapper.his interface file forbindgento generate Rust struct from C struct -
In
src/cuda/includes/kernel/, multiple kernel functions are defined -
In
field.rs, conversion betweenFieldBindingstruct andhalo2curves' field struct is implemented -
In
lib.rs, expose APIs to test CUDA kernels viaGPUApiWrapperstruct