diff --git a/poc/msm-cuda/benches/msm.rs b/poc/msm-cuda/benches/msm.rs index 2597065..4bf3831 100644 --- a/poc/msm-cuda/benches/msm.rs +++ b/poc/msm-cuda/benches/msm.rs @@ -29,14 +29,11 @@ fn criterion_benchmark(c: &mut Criterion) { let name = format!("2**{}", npoints_npow); group.bench_function(name, |b| { b.iter(|| { - let _ = multi_scalar_mult_arkworks( - &points.as_slice(), - unsafe { - std::mem::transmute::<&[_], &[BigInteger256]>( - scalars.as_slice(), - ) - }, - ); + let _ = multi_scalar_mult_arkworks(&points.as_slice(), unsafe { + std::mem::transmute::<&[_], &[BigInteger256]>( + scalars.as_slice(), + ) + }); }) }); diff --git a/poc/msm-cuda/cuda/pippenger_inf.cu b/poc/msm-cuda/cuda/pippenger_inf.cu index f248f94..38133aa 100644 --- a/poc/msm-cuda/cuda/pippenger_inf.cu +++ b/poc/msm-cuda/cuda/pippenger_inf.cu @@ -30,7 +30,7 @@ RustError::by_value mult_pippenger_inf(point_t* out, const affine_t points[], size_t npoints, const scalar_t scalars[], size_t ffi_affine_sz) { - return mult_pippenger(out, points, npoints, scalars, false, ffi_affine_sz); + return mult_pippenger(out, points, npoints, scalars, npoints, nullptr, false); } #if defined(FEATURE_BLS12_381) || defined(FEATURE_BLS12_377) @@ -43,6 +43,6 @@ RustError::by_value mult_pippenger_fp2_inf(point_fp2_t* out, const affine_fp2_t size_t npoints, const scalar_t scalars[], size_t ffi_affine_sz) { - return mult_pippenger(out, points, npoints, scalars, false, ffi_affine_sz); + return mult_pippenger(out, points, npoints, scalars, npoints, nullptr, false); } #endif diff --git a/poc/msm-cuda/examples/msm.rs b/poc/msm-cuda/examples/msm.rs deleted file mode 100644 index 8b41491..0000000 --- a/poc/msm-cuda/examples/msm.rs +++ /dev/null @@ -1,40 +0,0 @@ -#[cfg(feature = "bls12_377")] -use ark_bls12_377::{G1Affine, G2Affine}; -#[cfg(feature = "bls12_381")] -use ark_bls12_381::{G1Affine, G2Affine}; -#[cfg(feature = "bn254")] -use ark_bn254::G1Affine; -use ark_ff::BigInteger256; - -use std::str::FromStr; - -use msm_cuda::*; - -/// cargo run --release --example msm --features bn254 -fn main() { - let bench_npow = std::env::var("BENCH_NPOW").unwrap_or("16".to_string()); - let npoints_npow = i32::from_str(&bench_npow).unwrap(); - - let (points, mut scalars) = - util::generate_points_scalars::(1usize << npoints_npow); - - let ret = multi_scalar_mult_arkworks( - &points.as_slice(), - unsafe { - std::mem::transmute::<&[_], &[BigInteger256]>(scalars.as_slice()) - }, - &(0..1u32 << npoints_npow).rev().collect::>(), - ); - - scalars.reverse(); - let ret_rev = multi_scalar_mult_arkworks( - &points.as_slice(), - unsafe { - std::mem::transmute::<&[_], &[BigInteger256]>(scalars.as_slice()) - }, - &(0..1u32 << npoints_npow).collect::>(), - ); - - assert_eq!(ret, ret_rev); - println!("success") -}