Author: @vmx

This document is about a potential integration of sppark (https://github.com/supranational/sppark) into the Filecoin proof system.

Why we should look into it

Potential problems

Using it as a blackbox

Supranational would prefer if we’d use it as a black box (based on the meeting from 2022-09-15). This means that for multiexp there would be a single entry point into their C++ code base and we would just call into that from our Rust code.

sppark and the multiexp code is more then just the GPU kernel. For the CUDA code path (not OpenCL), it would would replace https://github.com/filecoin-project/ec-gpu and https://github.com/filecoin-project/rust-gpu-tools/.

Perhaps only their CUDA kernel could be used and we re-implement their host code in Rust.

Doesn’t support G2

The current version (as of 2022-09-23) doesn’t support BLS12-381 G2. Hence it cannot be integrated into bellperson.

Non-issues

Benchmarks

Pure GPU multiexp

vmx extended the multiexp test at https://github.com/filecoin-project/ec-gpu/blob/3e5015d64fa03ee480dba8108d251f834b5d3683/gpu-tests/tests/multiexp.rs to include https://crates.io/crates/pasta-msm. For polynomials of sized where sppark is using the GPU, it was around 2.5x faster than the ec-gpu GPU version.

multiexp_sppark.log

Within Halo2

The current circuits run multiple proofs (180) for 32GiB sectors. Each proof takes about the same time. This makes things easier to benchmark with benchy as one can just start proving a few of them and then abort (instead of waiting for several hours).