Skip to content

Commit

Permalink
fix(ntt): fix nightly build and pulp errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah el kazdadi committed Feb 21, 2024
1 parent 16ad668 commit 466e358
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ use u256_impl::u256;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use pulp::cast;
use pulp::u64x4;
#[allow(unused_imports)]
use pulp::u64x8;

#[doc(hidden)]
pub mod prime;
Expand Down
2 changes: 2 additions & 0 deletions src/native32.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use aligned_vec::avec;

use pulp::u32x8;
#[allow(unused_imports)]
use pulp::{u32x16, u64x8};

/// Negacyclic NTT plan for multiplying two 32bit polynomials.
#[derive(Clone, Debug)]
Expand Down
6 changes: 4 additions & 2 deletions src/native64.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use aligned_vec::avec;

#[allow(unused_imports)]
use pulp::{b8, u32x16, u64x8};
use pulp::{i32x4, m64x4, u32x4, u32x8, u64x4};

pub(crate) use crate::native32::mul_mod32;
Expand Down Expand Up @@ -438,8 +440,8 @@ fn reconstruct_32bit_01234_avx2(
let sign = simd.cmp_gt_u32x8(v4, half_p4);
let sign: [i32x4; 2] = pulp::cast(sign);
// sign extend so that -1i32 becomes -1i64
let sign0: m64x4 = pulp::cast(simd.convert_i32x4_to_i64x4(sign[0]));
let sign1: m64x4 = pulp::cast(simd.convert_i32x4_to_i64x4(sign[1]));
let sign0: m64x4 = unsafe { core::mem::transmute(simd.convert_i32x4_to_i64x4(sign[0])) };
let sign1: m64x4 = unsafe { core::mem::transmute(simd.convert_i32x4_to_i64x4(sign[1])) };

let v0: [u32x4; 2] = pulp::cast(v0);
let v1: [u32x4; 2] = pulp::cast(v1);
Expand Down
2 changes: 2 additions & 0 deletions src/native_binary32.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use aligned_vec::avec;

use pulp::u32x8;
#[allow(unused_imports)]
use pulp::{u32x16, u64x8};

use crate::native32::mul_mod32;

Expand Down
6 changes: 4 additions & 2 deletions src/native_binary64.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use aligned_vec::avec;

#[allow(unused_imports)]
use pulp::{b8, u32x16, u64x8};
use pulp::{i32x4, m64x4, u32x4, u32x8, u64x4};

pub(crate) use crate::native32::mul_mod32;
Expand Down Expand Up @@ -109,8 +111,8 @@ fn reconstruct_32bit_012_avx2(
let sign = simd.cmp_gt_u32x8(v2, half_p2);
let sign: [i32x4; 2] = pulp::cast(sign);
// sign extend so that -1i32 becomes -1i64
let sign0: m64x4 = pulp::cast(simd.convert_i32x4_to_i64x4(sign[0]));
let sign1: m64x4 = pulp::cast(simd.convert_i32x4_to_i64x4(sign[1]));
let sign0: m64x4 = unsafe { core::mem::transmute(simd.convert_i32x4_to_i64x4(sign[0])) };
let sign1: m64x4 = unsafe { core::mem::transmute(simd.convert_i32x4_to_i64x4(sign[1])) };

let v0: [u32x4; 2] = pulp::cast(v0);
let v1: [u32x4; 2] = pulp::cast(v1);
Expand Down
2 changes: 2 additions & 0 deletions src/prime32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use aligned_vec::{avec, ABox};

#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use pulp::cast;
#[allow(unused_imports)]
use pulp::u32x16;
use pulp::{u32x4, u32x8};

const RECURSION_THRESHOLD: usize = 2048;
Expand Down
2 changes: 2 additions & 0 deletions src/prime32/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use core::iter::zip;
use pulp::u32x8;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use pulp::{as_arrays, as_arrays_mut, cast};
#[allow(unused_imports)]
use pulp::{b16, u32x16};

#[inline(always)]
pub(crate) fn add(p: u32, a: u32, b: u32) -> u32 {
Expand Down
2 changes: 2 additions & 0 deletions src/prime32/less_than_30bit.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#[allow(unused_imports)]
use pulp::u32x16;
use pulp::u32x8;

#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
Expand Down
2 changes: 2 additions & 0 deletions src/prime32/less_than_31bit.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#[allow(unused_imports)]
use pulp::u32x16;
use pulp::u32x8;

#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
Expand Down
2 changes: 2 additions & 0 deletions src/prime32/shoup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use crate::Butterfly;
use core::iter::zip;
use pulp::cast;

#[allow(unused_imports)]
use pulp::u32x16;
use pulp::u32x8;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use pulp::{as_arrays, as_arrays_mut};
Expand Down
2 changes: 2 additions & 0 deletions src/prime64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use aligned_vec::{avec, ABox};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use pulp::cast;
use pulp::u64x4;
#[allow(unused_imports)]
use pulp::u64x8;

const RECURSION_THRESHOLD: usize = 1024;

Expand Down
2 changes: 2 additions & 0 deletions src/prime64/generic_solinas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use core::{fmt::Debug, iter::zip};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use pulp::cast;
use pulp::u64x4;
#[allow(unused_imports)]
use pulp::{b8, u64x8};

pub(crate) trait PrimeModulus: Debug + Copy {
type Div: Debug + Copy;
Expand Down
2 changes: 2 additions & 0 deletions src/prime64/less_than_50bit.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use pulp::u64x8;

#[inline(always)]
pub(crate) fn fwd_butterfly_avx512(
simd: crate::V4IFma,
Expand Down
2 changes: 2 additions & 0 deletions src/prime64/less_than_51bit.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use pulp::u64x8;

#[inline(always)]
pub(crate) fn fwd_butterfly_avx512(
simd: crate::V4IFma,
Expand Down
2 changes: 2 additions & 0 deletions src/prime64/less_than_62bit.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use pulp::u64x4;
#[allow(unused_imports)]
use pulp::u64x8;

#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
#[cfg(feature = "nightly")]
Expand Down
2 changes: 2 additions & 0 deletions src/prime64/less_than_63bit.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use pulp::u64x4;
#[allow(unused_imports)]
use pulp::u64x8;

#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
#[cfg(feature = "nightly")]
Expand Down
2 changes: 2 additions & 0 deletions src/prime64/shoup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use core::iter::zip;
use pulp::cast;

use pulp::u64x4;
#[allow(unused_imports)]
use pulp::u64x8;

#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
#[cfg(feature = "nightly")]
Expand Down

0 comments on commit 466e358

Please sign in to comment.