forked from 0xPolygonZero/plonky2
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
2,513 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ members = ["field", "maybe_rayon", "plonky2", "starky", "util", "gen", "u32", "e | |
resolver = "2" | ||
|
||
[workspace.dependencies] | ||
cryptography_cuda = { git = "ssh://[email protected]/okx/cryptography_cuda.git", rev = "2a7c42d29ee72d7c2c2da9378ae816384c43cdec" } | ||
cryptography_cuda = { git = "ssh://[email protected]/okx/cryptography_cuda.git", rev = "547192b2ef42dc7519435059c86f88431b8de999" } | ||
ahash = { version = "0.8.7", default-features = false, features = [ | ||
"compile-time-rng", | ||
] } # NOTE: Be sure to keep this version the same as the dependency in `hashbrown`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
mod allocator; | ||
|
||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; | ||
#[cfg(feature = "cuda")] | ||
use cryptography_cuda::init_cuda_degree_rs; | ||
use plonky2::field::extension::Extendable; | ||
use plonky2::field::goldilocks_field::GoldilocksField; | ||
use plonky2::field::polynomial::PolynomialCoeffs; | ||
use plonky2::fri::oracle::PolynomialBatch; | ||
use plonky2::hash::hash_types::RichField; | ||
use plonky2::plonk::config::{GenericConfig, PoseidonGoldilocksConfig}; | ||
use plonky2::util::timing::TimingTree; | ||
use tynm::type_name; | ||
|
||
pub(crate) fn bench_batch_lde< | ||
F: RichField + Extendable<D>, | ||
C: GenericConfig<D, F = F>, | ||
const D: usize, | ||
>( | ||
c: &mut Criterion, | ||
) { | ||
const RATE_BITS: usize = 3; | ||
|
||
let mut group = c.benchmark_group(&format!("lde<{}>", type_name::<F>())); | ||
|
||
#[cfg(feature = "cuda")] | ||
init_cuda_degree_rs(16); | ||
|
||
for size_log in [13, 14, 15] { | ||
let orig_size = 1 << (size_log - RATE_BITS); | ||
let lde_size = 1 << size_log; | ||
let batch_size = 1 << 4; | ||
|
||
group.bench_with_input(BenchmarkId::from_parameter(lde_size), &lde_size, |b, _| { | ||
let polynomials: Vec<PolynomialCoeffs<F>> = (0..batch_size) | ||
.into_iter() | ||
.map(|_i| PolynomialCoeffs::new(F::rand_vec(orig_size))) | ||
.collect(); | ||
let mut timing = TimingTree::new("lde", log::Level::Error); | ||
b.iter(|| { | ||
PolynomialBatch::<F, C, D>::from_coeffs( | ||
polynomials.clone(), | ||
RATE_BITS, | ||
false, | ||
1, | ||
&mut timing, | ||
None, | ||
) | ||
}); | ||
}); | ||
} | ||
} | ||
|
||
fn criterion_benchmark(c: &mut Criterion) { | ||
bench_batch_lde::<GoldilocksField, PoseidonGoldilocksConfig, 2>(c); | ||
} | ||
|
||
criterion_group!(benches, criterion_benchmark); | ||
criterion_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.