use custos::prelude::*;
/// `AddBuf` will be implemented for all compute devices.
/// Because of `S: Shape`, this trait can be implemented for [`Stack`], which uses fixed size stack allocated arrays.
/// Adding a `D: Device = Self` makes it possible to invoke operations with a `CPU` on, for example, `OpenCL` `Buffer`s (if the device uses unified memory), and `Stack` `Buffer`s.
pub trait AddBuf: Sized + Device {
/// This operation perfoms element-wise addition.
fn add(&self, lhs: &Buffer, rhs: &Buffer) -> Buffer;
// ... you can add more operations if you want to do that.
}
// Host CPU implementation
#[cfg(feature = "cpu")]
impl AddBuf for CPU
where
T: Copy + std::ops::Add