use coeus_core::{ComputeBackend, Layout, Scalar};
use super::super::defaults;
use super::elementwise::ElementwiseOps;
pub trait MatmulOps<T: Scalar>: ComputeBackend {
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>;
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>
where
Self: ElementwiseOps<T>,
{
defaults::matmul::matmul_accumulate(self, a, a_layout, b, b_layout, c, c_layout)
}
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> {
defaults::matmul::batched_matmul(self, a, a_layout, b, b_layout, c, c_layout)
}
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>
where
Self: ElementwiseOps<T>,
{
defaults::matmul::batched_matmul_accumulate(self, a, a_layout, b, b_layout, c, c_layout)
}
}