use super::super::matmul;
use super::super::CpuBackend;
use crate::backend_ops::traits::MatmulOps;
use coeus_core::{CpuAddressableStorageMut, Layout, Scalar};
unsafe impl<T: Scalar + leto_ops::Scalar, B: CpuBackend> MatmulOps<T> for B
where
B::DeviceBuffer<T>: CpuAddressableStorageMut<T>,
{
#[inline]
fn matmul(
&self,
a: &Self::DeviceBuffer<T>,
a_layout: &Layout,
b: &Self::DeviceBuffer<T>,
b_layout: &Layout,
c: &mut Self::DeviceBuffer<T>,
c_layout: &Layout,
) -> Result<(), Self::Error> {
matmul::matmul(self, a, a_layout, b, b_layout, c, c_layout)
}
#[inline]
fn batched_matmul(
&self,
a: &Self::DeviceBuffer<T>,
a_layout: &Layout,
b: &Self::DeviceBuffer<T>,
b_layout: &Layout,
c: &mut Self::DeviceBuffer<T>,
c_layout: &Layout,
) -> Result<(), Self::Error> {
matmul::batched_matmul(self, a, a_layout, b, b_layout, c, c_layout)
}
#[inline]
fn matmul_accumulate(
&self,
a: &Self::DeviceBuffer<T>,
a_layout: &Layout,
b: &Self::DeviceBuffer<T>,
b_layout: &Layout,
c: &mut Self::DeviceBuffer<T>,
c_layout: &Layout,
) -> Result<(), Self::Error> {
matmul::matmul_accumulate(self, a, a_layout, b, b_layout, c, c_layout)
}
#[inline]
fn batched_matmul_accumulate(
&self,
a: &Self::DeviceBuffer<T>,
a_layout: &Layout,
b: &Self::DeviceBuffer<T>,
b_layout: &Layout,
c: &mut Self::DeviceBuffer<T>,
c_layout: &Layout,
) -> Result<(), Self::Error> {
matmul::batched_matmul_accumulate(self, a, a_layout, b, b_layout, c, c_layout)
}
}