Skip to content

Commit

Permalink
passing fib
Browse files Browse the repository at this point in the history
  • Loading branch information
VitaliiH authored and VitaliiH committed Jan 30, 2025
1 parent 2a5cd0f commit a4afa10
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions crates/prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ tracing.workspace = true
rayon = { version = "1.10.0", optional = true }
serde = { version = "1.0", features = ["derive"] }

icicle-cuda-runtime = { git = "https://github.com/ingonyama-zk/icicle.git", optional = true, rev="9511396f0685a004ada6f52791b898ccdc092a43"}
icicle-core = { git = "https://github.com/ingonyama-zk/icicle.git", optional = true, rev="9511396f0685a004ada6f52791b898ccdc092a43"}
icicle-m31 = { git = "https://github.com/ingonyama-zk/icicle.git", optional = true, rev="9511396f0685a004ada6f52791b898ccdc092a43"}
icicle-hash = { git = "https://github.com/ingonyama-zk/icicle.git", optional = true, rev="9511396f0685a004ada6f52791b898ccdc092a43"}
icicle-cuda-runtime = { git = "https://github.com/ingonyama-zk/icicle.git", optional = true, rev="5f0eaf226c1432277421a6095fd758b03fc20510"}
icicle-core = { git = "https://github.com/ingonyama-zk/icicle.git", optional = true, rev="5f0eaf226c1432277421a6095fd758b03fc20510"}
icicle-m31 = { git = "https://github.com/ingonyama-zk/icicle.git", optional = true, rev="5f0eaf226c1432277421a6095fd758b03fc20510"}
icicle-hash = { git = "https://github.com/ingonyama-zk/icicle.git", optional = true, rev="5f0eaf226c1432277421a6095fd758b03fc20510"}

nvtx = { version = "*", optional = true }

Expand Down
2 changes: 2 additions & 0 deletions crates/prover/src/core/backend/icicle/accumulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ mod tests {
#[cfg(feature = "icicle")]
#[test]
fn test_accumulate() {
use crate::core::fields::m31::BaseField;

let a_h = vec![SecureField::zero(); 8];
let mut column = SecureColumnByCoords::from_iter(a_h.clone());
let mut cpu_column = SecureColumnByCoords::from_iter(a_h);
Expand Down
6 changes: 4 additions & 2 deletions crates/prover/src/core/backend/icicle/circle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ impl PolyOps for IcicleBackend {
}

fn extend(poly: &CirclePoly<Self>, log_size: u32) -> CirclePoly<Self> {
todo!()
// unsafe { transmute(CpuBackend::extend(transmute(poly), log_size)) }
assert!(log_size >= poly.log_size());
let count_zeros_to_extend = 1 << (log_size-1) - poly.coeffs.len() as u32;
let coeffs = DeviceVec::cuda_malloc_extend_with_zeros(&poly.coeffs.data, count_zeros_to_extend).unwrap();
CirclePoly::new(DeviceColumn {data: coeffs})
}

fn evaluate(
Expand Down
2 changes: 1 addition & 1 deletion crates/prover/src/core/poly/circle/poly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl<B: PolyOps> CirclePoly<B> {
///
/// Panics if the number of coefficients isn't a power of two.
pub fn new(coeffs: Col<B, BaseField>) -> Self {
assert!(coeffs.len().is_power_of_two());
assert!(coeffs.len().is_power_of_two(), "coefficients length must be power of 2, got: {}", coeffs.len());
let log_size = coeffs.len().ilog2();
Self { log_size, coeffs }
}
Expand Down
12 changes: 10 additions & 2 deletions crates/prover/src/examples/wide_fibonacci/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ mod tests {
#[test]
#[cfg(feature = "icicle")]
fn test_wide_fib_prove_with_blake_icicle() {
use icicle_cuda_runtime::memory::HostSlice;

use crate::core::backend::icicle::column::DeviceColumn;
use crate::core::backend::icicle::IcicleBackend;
// use crate::core::backend::CpuBackend;
use crate::core::fields::m31::M31;
Expand Down Expand Up @@ -286,13 +289,18 @@ mod tests {
tree_builder.extend_evals([]);
tree_builder.commit(prover_channel);
nvtx::range_pop!();

use icicle_cuda_runtime::memory::DeviceVec;
// Trace.
nvtx::range_push!("Generate trace");
type IcicleCircleEvaluation = CircleEvaluation<TheBackend, M31, BitReversedOrder>;
let trace: Vec<CircleEvaluation<TheBackend, M31, BitReversedOrder>> =
generate_test_trace(log_n_instances)
.iter()
.map(|c| unsafe { std::mem::transmute(c.to_cpu()) })
.map(|c| {
let mut values = DeviceVec::cuda_malloc(c.values.len()).unwrap();
values.copy_from_host(HostSlice::from_slice(&c.values.to_cpu())).unwrap();
IcicleCircleEvaluation::new(c.domain, DeviceColumn { data: values })
})
.collect_vec();

let mut tree_builder = commitment_scheme.tree_builder();
Expand Down

0 comments on commit a4afa10

Please sign in to comment.