Skip to content

felicityin/fri-cuda

Repository files navigation

FRI CUDA

This project implements the FRI low-degree test (LDT) on GPU via CUDA, following the algorithmic framework established in Plonky3.

Currently, only KoalaBear is supported.

Usage

Reference: src/fri/test.rs

const LOG_BLOWUP: usize = 1;
const COLS: usize = 8;
let log_degree = 12;
let rows = 1 << log_degree

let mut rng = ChaCha20Rng::seed_from_u64(0);
let h_matrix = RowMajorMatrix::<F>::rand_nonzero(&mut rng, rows, COLS);
let d_matrix = transport_matrix_to_device(&h_matrix);

let config = FriConfig { log_blowup: LOG_BLOWUP, num_queries: 10, proof_of_work_bits: 8 };
let pcs = GpuTwoAdicFriPcs::new(config);

// ------------------------ commit ------------------------

let domain = pcs.natural_domain_for_degree(h_matrix.height());
let (root, data) = pcs.commit(vec![(domain, d_matrix)]);

// ------------------------ open --------------------------

let mut challenger = Challenger::new(poseidon2_init());
challenger.observe(root);
let zeta: EF = challenger.sample_ext_element();

let (open, proof) =
    pcs.open(vec![(&data, vec![vec![zeta]])], &mut challenger);

Acknowledgements

We studied and built upon the work of other teams in our quest to implement this repository. We would like to thank these teams for sharing their code for open source development:

  • OpenVM Stark Backend: We used OpenVM's open source CUDA kernels, builder and manager as the starting point for our CUDA backend.
  • Risc0: We adapted Risc0's open-source BabyBear Poseidon2 CUDA kernels for our own CUDA kernels.
  • Supranational: We ported and modified sppark's open source BabyBear field arithmetic and BabyBear NTT CUDA kernels for use in our CUDA backend.
  • Scroll: Members of the Scroll team made foundational contributions to the the CUDA backend.

About

FRI low-degree test (LDT) on GPU via CUDA, following Plonky3.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors