use super::backend::BackendUnavailable;
use super::coverage::{Coverage, Dispatch, Fidelity};
use super::formula::{Formula, Precision};
use super::manifest::Manifest;
#[cfg(feature = "simd")]
#[allow(unsafe_code)]
mod kernels;
#[cfg(feature = "simd")]
pub(super) use kernels::{gemm_f32, gemm_f64};
pub(super) struct Simd;
impl Manifest for Simd {
const DISPATCH: Dispatch = Dispatch::Offered;
fn coverage(formula: Formula) -> Coverage {
match formula {
Formula::Gemm => Coverage::Serves {
fidelity: Fidelity::Envelope,
precisions: Precision::ALL,
},
Formula::Map
| Formula::WindowProduct
| Formula::ReduceWindow
| Formula::BatchNormTraining
| Formula::BatchNormInference => Coverage::Absent,
}
}
fn compiled() -> bool {
cfg!(feature = "simd")
}
fn status() -> Result<(), BackendUnavailable> {
if !cfg!(feature = "simd") {
return Err(BackendUnavailable::NotCompiled);
}
Ok(())
}
}