pub trait Backend<T: crate::ScalarBase> {
const MATERIALIZES_CONJ: bool;
const REQUIRES_UNIT_STRIDE: bool;
fn bgemm_contiguous_into(
c: &mut crate::contiguous::ContiguousOperandMut<T>,
a: &crate::contiguous::ContiguousOperand<T>,
b: &crate::contiguous::ContiguousOperand<T>,
batch_dims: &[usize],
m: usize,
n: usize,
k: usize,
alpha: T,
beta: T,
) -> strided_view::Result<()>;
}
#[cfg(feature = "faer")]
pub struct FaerBackend;
#[cfg(any(feature = "blas", feature = "blas-inject"))]
pub struct BlasBackend;
#[allow(dead_code)]
pub struct NaiveBackend;
impl<T: crate::ScalarBase> Backend<T> for NaiveBackend {
const MATERIALIZES_CONJ: bool = false;
const REQUIRES_UNIT_STRIDE: bool = false;
fn bgemm_contiguous_into(
_c: &mut crate::contiguous::ContiguousOperandMut<T>,
_a: &crate::contiguous::ContiguousOperand<T>,
_b: &crate::contiguous::ContiguousOperand<T>,
_batch_dims: &[usize],
_m: usize,
_n: usize,
_k: usize,
_alpha: T,
_beta: T,
) -> strided_view::Result<()> {
unreachable!("NaiveBackend GEMM is dispatched directly, not through Backend trait")
}
}
#[cfg(all(feature = "faer", not(any(feature = "blas", feature = "blas-inject"))))]
pub type ActiveBackend = FaerBackend;
#[cfg(all(
not(feature = "faer"),
any(
all(feature = "blas", not(feature = "blas-inject")),
all(feature = "blas-inject", not(feature = "blas"))
)
))]
pub type ActiveBackend = BlasBackend;
#[cfg(not(any(feature = "faer", feature = "blas", feature = "blas-inject")))]
pub type ActiveBackend = NaiveBackend;
#[cfg(any(
all(feature = "faer", any(feature = "blas", feature = "blas-inject")),
all(feature = "blas", feature = "blas-inject")
))]
pub type ActiveBackend = NaiveBackend;