pub struct VectorAdd;Expand description
Elementwise vector addition. Zero-sized: it carries no state, it just names
the operation so the ComputeOp impl and its two kernels hang off a type.
Trait Implementations§
Source§impl ComputeOp for VectorAdd
impl ComputeOp for VectorAdd
Source§type Input<'a> = VectorAddInput<'a>
type Input<'a> = VectorAddInput<'a>
The operation’s input, borrowed. A GAT (
Input<'a>) so the input can
hold borrows (&[f32]) without forcing them to be 'static — the whole
reason a plain associated type wouldn’t do here. Both paths take it by
shared reference, so the cascade can hand the SAME input to the GPU path
and then, on failure, to the CPU path.Source§fn compute_gpu(
&self,
ctx: &GpuContext,
input: &Self::Input<'_>,
) -> Result<Self::Output, GpuOpError>
fn compute_gpu( &self, ctx: &GpuContext, input: &Self::Input<'_>, ) -> Result<Self::Output, GpuOpError>
Run on the GPU. Fallible: returns
Err if the GPU path could not
complete for ANY reason (shader/pipeline error, buffer map failure,
device lost). A returned Err is the cascade’s signal to fall back to
CPU — it must never be a panic.Source§fn compute_cpu(&self, input: &Self::Input<'_>) -> Self::Output
fn compute_cpu(&self, input: &Self::Input<'_>) -> Self::Output
Run on the CPU in pure Rust. Infallible and always correct — this is the
floor the cascade lands on, so it must be a real implementation.
Auto Trait Implementations§
impl Freeze for VectorAdd
impl RefUnwindSafe for VectorAdd
impl Send for VectorAdd
impl Sync for VectorAdd
impl Unpin for VectorAdd
impl UnsafeUnpin for VectorAdd
impl UnwindSafe for VectorAdd
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more