-
Notifications
You must be signed in to change notification settings - Fork 79
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
1 parent
f59f722
commit 5486f28
Showing
7 changed files
with
535 additions
and
5 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
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,32 @@ | ||
use criterion::{criterion_group, criterion_main, Criterion, Throughput}; | ||
use stwo_prover::core::backend::simd::SimdBackend; | ||
use stwo_prover::core::channel::{Blake2sChannel, Channel}; | ||
use stwo_prover::core::fields::m31::BaseField; | ||
use stwo_prover::core::fields::IntoSlice; | ||
use stwo_prover::core::prover::prove; | ||
use stwo_prover::core::vcs::blake2_hash::Blake2sHasher; | ||
use stwo_prover::core::vcs::hasher::Hasher; | ||
use stwo_prover::examples::poseidon::{gen_trace, PoseidonAir, PoseidonComponent}; | ||
|
||
pub fn simd_poseidon(c: &mut Criterion) { | ||
const LOG_N_ROWS: u32 = 15; | ||
let mut group = c.benchmark_group("poseidon2"); | ||
group.throughput(Throughput::Elements(1u64 << (LOG_N_ROWS + 3))); | ||
group.bench_function(format!("poseidon2 2^{} instances", LOG_N_ROWS + 3), |b| { | ||
b.iter(|| { | ||
let component = PoseidonComponent { | ||
log_n_instances: LOG_N_ROWS, | ||
}; | ||
let trace = gen_trace(component.log_column_size()); | ||
let channel = &mut Blake2sChannel::new(Blake2sHasher::hash(BaseField::into_slice(&[]))); | ||
let air = PoseidonAir { component }; | ||
prove::<SimdBackend>(&air, channel, trace).unwrap() | ||
}); | ||
}); | ||
} | ||
|
||
criterion_group!( | ||
name = bit_rev; | ||
config = Criterion::default().sample_size(10); | ||
targets = simd_poseidon); | ||
criterion_main!(bit_rev); |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod fibonacci; | ||
pub mod poseidon; | ||
pub mod wide_fibonacci; |
Oops, something went wrong.