use crate::dtype::TypeCommon;
pub trait VecTrait<T: Copy> {
const SIZE: usize;
type Base: TypeCommon;
fn mul_add(self, a: Self, b: Self) -> Self;
fn copy_from_slice(&mut self, slice: &[T]);
fn as_ptr(&self) -> *const T {
self as *const _ as *const T
}
fn as_mut_ptr(&mut self) -> *mut T {
self as *mut _ as *mut T
}
fn as_mut_ptr_uncheck(&self) -> *mut T {
unsafe { std::mem::transmute(self.as_ptr()) }
}
fn extract(&self, idx: usize) -> T {
assert!(idx < Self::SIZE);
unsafe { *self.as_ptr().add(idx) }
}
fn sum(&self) -> T;
#[inline(always)]
fn write_unaligned(&mut self, vec: T::Vec)
where
T: TypeCommon,
{
let ptr = self.as_mut_ptr() as *mut T::Vec;
unsafe { ptr.write_unaligned(vec) }
}
#[inline(always)]
fn read_unaligned(&self) -> T::Vec
where
T: TypeCommon,
{
let ptr = self.as_ptr() as *const T::Vec;
unsafe { ptr.read_unaligned() }
}
fn splat(val: T) -> Self;
unsafe fn from_ptr(ptr: *const T) -> Self;
#[cfg(target_feature = "neon")]
fn mul_add_lane<const LANE: i32>(self, a: Self, b: Self) -> Self;
}
pub trait SimdSelect<T> {
fn select(&self, true_val: T, false_val: T) -> T;
}
pub trait SimdCompare {
type SimdMask;
fn simd_eq(self, other: Self) -> Self::SimdMask;
fn simd_ne(self, other: Self) -> Self::SimdMask;
fn simd_lt(self, other: Self) -> Self::SimdMask;
fn simd_le(self, other: Self) -> Self::SimdMask;
fn simd_gt(self, other: Self) -> Self::SimdMask;
fn simd_ge(self, other: Self) -> Self::SimdMask;
}
pub(crate) trait SimdMath<T>: Copy {
fn sin(self) -> Self {
unreachable!()
}
fn cos(self) -> Self {
unreachable!()
}
fn sincos(self) -> (Self, Self) {
unreachable!()
}
fn tan(self) -> Self {
unreachable!()
}
fn asin(self) -> Self {
unreachable!()
}
fn acos(self) -> Self {
unreachable!()
}
fn atan(self) -> Self {
unreachable!()
}
fn atan2(self, _: Self) -> Self {
unreachable!()
}
fn sinh(self) -> Self {
unreachable!()
}
fn cosh(self) -> Self {
unreachable!()
}
fn tanh(self) -> Self {
unreachable!()
}
fn asinh(self) -> Self {
unreachable!()
}
fn acosh(self) -> Self {
unreachable!()
}
fn atanh(self) -> Self {
unreachable!()
}
fn abs(self) -> Self {
unreachable!()
}
fn floor(self) -> Self {
unreachable!()
}
fn ceil(self) -> Self {
unreachable!()
}
fn neg(self) -> Self {
unreachable!()
}
fn round(self) -> Self {
unreachable!()
}
fn signum(self) -> Self {
unreachable!()
}
fn copysign(self, _: Self) -> Self {
unreachable!()
}
fn sqrt(self) -> Self {
unreachable!()
}
fn leaky_relu(self, _: Self) -> Self {
unreachable!()
}
fn relu(self) -> Self {
unreachable!()
}
fn relu6(self) -> Self {
unreachable!()
}
fn pow(self, _: Self) -> Self {
unreachable!()
}
fn exp(self) -> Self {
unreachable!()
}
fn exp2(self) -> Self {
unreachable!()
}
fn exp10(self) -> Self {
unreachable!()
}
fn expm1(self) -> Self {
unreachable!()
}
fn log10(self) -> Self {
unreachable!()
}
fn log2(self) -> Self {
unreachable!()
}
fn log1p(self) -> Self {
unreachable!()
}
fn hypot(self, _: Self) -> Self {
unreachable!()
}
fn trunc(self) -> Self {
unreachable!()
}
fn erf(self) -> Self {
unreachable!()
}
fn cbrt(self) -> Self {
unreachable!()
}
fn ln(self) -> Self {
unreachable!()
}
fn min(self, _: Self) -> Self {
unreachable!()
}
fn max(self, _: Self) -> Self {
unreachable!()
}
fn recip(self) -> Self {
unreachable!()
}
fn sigmoid(self) -> Self {
unreachable!()
}
fn gelu(self) -> Self {
unreachable!()
}
fn softplus(self) -> Self {
unreachable!()
}
fn softsign(self) -> Self {
unreachable!()
}
fn mish(self) -> Self {
unreachable!()
}
fn celu(self, _: Self) -> Self {
unreachable!()
}
fn selu(self, _: Self, _: Self) -> Self {
unreachable!()
}
fn elu(self, _: Self) -> Self {
unreachable!()
}
fn hard_sigmoid(self) -> Self {
unreachable!()
}
fn hard_swish(self) -> Self {
unreachable!()
}
}