1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#![cfg_attr(feature = "nightly", feature(stdsimd), feature(avx512_target_feature))]

pub mod cache;

pub mod gemm;
pub mod gemv;
pub mod gevv;

pub mod microkernel;
pub mod pack_operands;
pub mod simd;

#[derive(Copy, Clone, Debug)]
pub enum Parallelism {
    None,
    Rayon(usize),
}

pub struct Ptr<T>(pub *mut T);

impl<T> Clone for Ptr<T> {
    fn clone(&self) -> Self {
        *self
    }
}
impl<T> Copy for Ptr<T> {}

unsafe impl<T> Send for Ptr<T> {}
unsafe impl<T> Sync for Ptr<T> {}

impl<T> Ptr<T> {
    #[inline(always)]
    pub fn wrapping_offset(self, offset: isize) -> Self {
        Ptr::<T>(self.0.wrapping_offset(offset))
    }
    #[inline(always)]
    pub fn wrapping_add(self, offset: usize) -> Self {
        Ptr::<T>(self.0.wrapping_add(offset))
    }
}

#[cfg(not(feature = "std"))]
#[macro_export]
macro_rules! feature_detected {
    ($tt: tt) => {
        cfg!(feature = $tt)
    };
}

#[cfg(all(feature = "std", any(target_arch = "x86", target_arch = "x86_64")))]
#[macro_export]
macro_rules! feature_detected {
    ($tt: tt) => {
        ::std::arch::is_x86_feature_detected!($tt)
    };
}
#[cfg(all(feature = "std", target_arch = "aarch64"))]
#[macro_export]
macro_rules! feature_detected {
    ($tt: tt) => {
        ::std::arch::is_aarch64_feature_detected!($tt)
    };
}