Skip to content

Commit

Permalink
remove ntt code for ec curves
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Feb 21, 2024
1 parent b074983 commit 1df51de
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 120 deletions.
40 changes: 0 additions & 40 deletions math/src/gpu/icicle/bls12_377.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,46 +84,6 @@ pub fn bls12_377_g1_msm(
Ok(res)
}

/*
fn bls12_377_g1_ntt(
scalars: &[BLS12377FieldElement],
config: Option<ntt::NTTConfig<curve::ScalarField>>,
order: u64,
inverse_fft: bool,
) -> Result<Vec<BLS12377FieldElement>, IcicleError> {
let size = scalars.len();
let mut cfg = config.unwrap_or(ntt::NTTConfig::default());
let dir = if inverse_fft {
ntt::NTTDir::kInverse
} else {
ntt::NTTDir::kForward
};
let scalars = HostOrDeviceSlice::Host(
scalars
.iter()
.map(|scalar| scalar.to_icicle_scalar())
.collect::<Vec<_>>(),
);
let mut ntt_results = HostOrDeviceSlice::cuda_malloc(size).unwrap();
let stream = CudaStream::create().unwrap();
cfg.ctx.stream = &stream;
cfg.is_async = true;
let root_of_unity = BLS12377PrimeField::get_primitive_root_of_unity(order).unwrap().to_icicle_scalar();
curve::ScalarCfg::initialize_domain(root_of_unity, &cfg.ctx).unwrap();
ntt::ntt(&scalars, dir, &cfg, &mut ntt_results).unwrap();
stream.synchronize().unwrap();
let mut ntt_host_results = vec![curve::ScalarField::zero(); size];
ntt_results.copy_to_host(&mut ntt_host_results[..]).unwrap();
stream.destroy().unwrap();
let res = ntt_host_results
.as_slice()
.iter()
.map(|scalar| BLS12377FieldElement::from_icicle_scalar(&scalar).unwrap())
.collect::<Vec<_>>();
Ok(res)
}
*/

#[cfg(test)]
mod test {
use super::*;
Expand Down
40 changes: 0 additions & 40 deletions math/src/gpu/icicle/bls12_381.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,46 +83,6 @@ pub fn bls12_381_g1_msm(
Ok(res)
}

/*
fn bls12_381_g1_ntt(
scalars: &[BLS12381FieldElement],
config: Option<ntt::NTTConfig<curve::ScalarField>>,
order: u64,
inverse_fft: bool,
) -> Result<Vec<BLS12381FieldElement>, IcicleError> {
let size = scalars.len();
let mut cfg = config.unwrap_or(ntt::NTTConfig::default());
let dir = if inverse_fft {
ntt::NTTDir::kInverse
} else {
ntt::NTTDir::kForward
};
let scalars = HostOrDeviceSlice::Host(
scalars
.iter()
.map(|scalar| scalar.to_icicle_scalar())
.collect::<Vec<_>>(),
);
let mut ntt_results = HostOrDeviceSlice::cuda_malloc(size).unwrap();
let stream = CudaStream::create().unwrap();
cfg.ctx.stream = &stream;
cfg.is_async = true;
let root_of_unity = BLS12381PrimeField::get_primitive_root_of_unity(order).unwrap().to_icicle_scalar();
curve::ScalarCfg::initialize_domain(root_of_unity, &cfg.ctx).unwrap();
ntt::ntt(&scalars, dir, &cfg, &mut ntt_results).unwrap();
stream.synchronize().unwrap();
let mut ntt_host_results = vec![curve::ScalarField::zero(); size];
ntt_results.copy_to_host(&mut ntt_host_results[..]).unwrap();
stream.destroy().unwrap();
let res = ntt_host_results
.as_slice()
.iter()
.map(|scalar| BLS12381FieldElement::from_icicle_scalar(&scalar).unwrap())
.collect::<Vec<_>>();
Ok(res)
}
*/

#[cfg(test)]
mod test {
use super::*;
Expand Down
40 changes: 0 additions & 40 deletions math/src/gpu/icicle/bn254.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,46 +83,6 @@ pub fn bn254_g1_msm(
Ok(res)
}

/*
fn bn254_g1_ntt(
scalars: &[BN254FieldElement],
config: Option<ntt::NTTConfig<curve::ScalarField>>,
order: u64,
inverse_fft: bool,
) -> Result<Vec<BN254FieldElement>, IcicleError> {
let size = scalars.len();
let mut cfg = config.unwrap_or(ntt::NTTConfig::default());
let dir = if inverse_fft {
ntt::NTTDir::kInverse
} else {
ntt::NTTDir::kForward
};
let scalars = HostOrDeviceSlice::Host(
scalars
.iter()
.map(|scalar| scalar.to_icicle_scalar())
.collect::<Vec<_>>(),
);
let mut ntt_results = HostOrDeviceSlice::cuda_malloc(size).unwrap();
let stream = CudaStream::create().unwrap();
cfg.ctx.stream = &stream;
cfg.is_async = true;
let root_of_unity = BN254PrimeField::get_primitive_root_of_unity(order).unwrap().to_icicle_scalar();
curve::ScalarCfg::initialize_domain(root_of_unity, &cfg.ctx).unwrap();
ntt::ntt(&scalars, dir, &cfg, &mut ntt_results).unwrap();
stream.synchronize().unwrap();
let mut ntt_host_results = vec![curve::ScalarField::zero(); size];
ntt_results.copy_to_host(&mut ntt_host_results[..]).unwrap();
stream.destroy().unwrap();
let res = ntt_host_results
.as_slice()
.iter()
.map(|scalar| BN254FieldElement::from_icicle_scalar(&scalar).unwrap())
.collect::<Vec<_>>();
Ok(res)
}
*/

#[cfg(test)]
mod test {
use super::*;
Expand Down

0 comments on commit 1df51de

Please sign in to comment.