#![warn(clippy::undocumented_unsafe_blocks)]
pub mod aligned;
pub mod avx2_impl;
pub mod half;
pub mod huge_alloc;
pub use huge_alloc::HugePageVec;
pub mod avx512;
#[cfg(test)]
pub mod common_test;
pub mod dispatch;
pub mod kahan;
pub mod ops;
pub mod scalar_ref;
pub mod traits;
pub mod utility;
pub use aligned::Aligned64;
pub use aligned::AlignedVec;
pub use avx2_impl::Avx2Math;
pub use avx512::{Avx512Math, Avx512VnniBf16Math};
pub use dispatch::{InstructionSet, SIMD_MATH, SimdMathConfig, TEST_ISA_OVERRIDE};
pub use dispatch::{decode_isa_override, effective_instruction_set, encode_isa_override};
pub use kahan::{Kahan4F32, KahanF32, kahan_add};
pub use ops::*;
pub use scalar_ref::*;
pub use traits::SimdMath;
pub use utility::*;
#[macro_export]
macro_rules! dispatch_simd {
(@ $target:expr, $m512bf16:ident, $m512:ident, $m256:ident $(, $arg:expr)*) => {
{
use $crate::math::common::InstructionSet;
let __isa = $crate::math::common::effective_instruction_set();
match __isa {
InstructionSet::Avx512VnniBf16 => $target.$m512bf16($($arg),*),
InstructionSet::Avx512 => $target.$m512($($arg),*),
InstructionSet::Avx2 => $target.$m256($($arg),*),
}
}
};
($target:expr, $method:ident $(, $arg:expr)*) => {
{
use $crate::math::common::InstructionSet;
let __isa = $crate::math::common::effective_instruction_set();
match __isa {
InstructionSet::Avx512VnniBf16 => {
$target.$method::<$crate::math::common::Avx512VnniBf16Math>($($arg),*)
}
InstructionSet::Avx512 => {
$target.$method::<$crate::math::common::Avx512Math>($($arg),*)
}
InstructionSet::Avx2 => {
$target.$method::<$crate::math::common::Avx2Math>($($arg),*)
}
}
}
};
($method:ident ($($arg:expr),*)) => {
{
use $crate::math::common::InstructionSet;
use $crate::math::common::traits::SimdMath;
let __isa = $crate::math::common::effective_instruction_set();
#[allow(clippy::macro_metavars_in_unsafe, clippy::allow_attributes)]
unsafe {
match __isa {
InstructionSet::Avx512VnniBf16 => {
$crate::math::common::Avx512VnniBf16Math::$method($($arg),*)
}
InstructionSet::Avx512 => {
$crate::math::common::Avx512Math::$method($($arg),*)
}
InstructionSet::Avx2 => {
$crate::math::common::Avx2Math::$method($($arg),*)
}
}
}
}
};
}
pub use dispatch_simd;