Skip to content

Commit

Permalink
Chore: generalize the REPL field and enable BN256 (#1017)
Browse files Browse the repository at this point in the history
* Remove the hardcoded Pallas field from the REPL
* Enable the use of BN256/Grumpkin cycle
  • Loading branch information
arthurpaulino authored Jan 4, 2024
1 parent 71db5fb commit bc13609
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 138 deletions.
4 changes: 2 additions & 2 deletions src/cli/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ impl std::fmt::Display for Backend {

impl Backend {
fn compatible_fields(&self) -> Vec<LanguageField> {
use LanguageField::{Pallas, Vesta};
use LanguageField::{Pallas, BN256};
match self {
Self::Nova => vec![Pallas, Vesta],
Self::Nova => vec![BN256, Pallas],
}
}

Expand Down
11 changes: 5 additions & 6 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod zstore;
use anyhow::{bail, Context, Result};
use camino::Utf8PathBuf;
use clap::{Args, Parser, Subcommand};
use halo2curves::bn256;
use pasta_curves::pallas;

use std::{
Expand Down Expand Up @@ -353,10 +354,9 @@ impl ReplCli {
validate_non_zero("rc", rc)?;
backend.validate_field(field)?;
match field {
LanguageField::BN256 => repl!(rc, limit, bn256::Fr, backend.clone()),
LanguageField::Pallas => repl!(rc, limit, pallas::Scalar, backend.clone()),
LanguageField::Vesta => todo!(),
LanguageField::BN256 => todo!(),
LanguageField::Grumpkin => todo!(),
LanguageField::Grumpkin | LanguageField::Vesta => unreachable!(),
}
}
}
Expand Down Expand Up @@ -407,10 +407,9 @@ impl LoadCli {
validate_non_zero("rc", rc)?;
backend.validate_field(field)?;
match field {
LanguageField::BN256 => load!(rc, limit, bn256::Fr, backend.clone()),
LanguageField::Pallas => load!(rc, limit, pallas::Scalar, backend.clone()),
LanguageField::Vesta => todo!(),
LanguageField::BN256 => todo!(),
LanguageField::Grumpkin => todo!(),
LanguageField::Grumpkin | LanguageField::Vesta => unreachable!(),
}
}
}
Expand Down
Loading

1 comment on commit bc13609

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmarks

Table of Contents

Overview

This benchmark report shows the Fibonacci GPU benchmark.
NVIDIA L4
Intel(R) Xeon(R) CPU @ 2.20GHz
125.78 GB RAM
Workflow run: https://github.com/lurk-lab/lurk-rs/actions/runs/7414153280

Benchmark Results

LEM Fibonacci Prove - rc = 100

fib-ref=71db5fbb3fcadaffd1bacb0ea16e9c4a12a2fc0e fib-ref=bc136099c58c1402510b949b29768d604642405b
num-100 2.37 s (✅ 1.00x) 2.36 s (✅ 1.00x faster)
num-200 4.64 s (✅ 1.00x) 4.64 s (✅ 1.00x faster)

LEM Fibonacci Prove - rc = 600

fib-ref=71db5fbb3fcadaffd1bacb0ea16e9c4a12a2fc0e fib-ref=bc136099c58c1402510b949b29768d604642405b
num-100 1.99 s (✅ 1.00x) 1.99 s (✅ 1.00x slower)
num-200 4.50 s (✅ 1.00x) 4.50 s (✅ 1.00x faster)

Made with criterion-table

Please sign in to comment.