Trait SharedAccumulator

Source
pub trait SharedAccumulator<In: Numeric>:
    CubeType
    + Send
    + Sync
    + 'static {
    type Item: CubeType;

    // Required methods
    fn allocate(length: u32, line_size: u32) -> Self;
    fn read(accumulator: &Self, index: u32) -> Self::Item;
    fn write(accumulator: &mut Self, index: u32, item: Self::Item);
    fn __expand_allocate(
        context: &mut CubeContext,
        length: u32,
        line_size: u32,
    ) -> <Self as CubeType>::ExpandType;
    fn __expand_read(
        context: &mut CubeContext,
        accumulator: <Self as CubeType>::ExpandType,
        index: <u32 as CubeType>::ExpandType,
    ) -> <Self::Item as CubeType>::ExpandType;
    fn __expand_write(
        context: &mut CubeContext,
        accumulator: <Self as CubeType>::ExpandType,
        index: <u32 as CubeType>::ExpandType,
        item: <Self::Item as CubeType>::ExpandType,
    ) -> <() as CubeType>::ExpandType;
}
Expand description

A simple trait that abstract over a single or multiple shared memory.

Required Associated Types§

Required Methods§

Source

fn allocate(length: u32, line_size: u32) -> Self

Source

fn read(accumulator: &Self, index: u32) -> Self::Item

Source

fn write(accumulator: &mut Self, index: u32, item: Self::Item)

Source

fn __expand_allocate( context: &mut CubeContext, length: u32, line_size: u32, ) -> <Self as CubeType>::ExpandType

Source

fn __expand_read( context: &mut CubeContext, accumulator: <Self as CubeType>::ExpandType, index: <u32 as CubeType>::ExpandType, ) -> <Self::Item as CubeType>::ExpandType

Source

fn __expand_write( context: &mut CubeContext, accumulator: <Self as CubeType>::ExpandType, index: <u32 as CubeType>::ExpandType, item: <Self::Item as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<In: Numeric> SharedAccumulator<In> for SharedMemory<Line<In>>

Source§

type Item = Line<In>

Source§

fn allocate(length: u32, line_size: u32) -> Self

Source§

fn read(accumulator: &Self, index: u32) -> Self::Item

Source§

fn write(accumulator: &mut Self, index: u32, item: Self::Item)

Source§

fn __expand_allocate( context: &mut CubeContext, length: u32, line_size: u32, ) -> <Self as CubeType>::ExpandType

Source§

fn __expand_read( context: &mut CubeContext, accumulator: <Self as CubeType>::ExpandType, index: <u32 as CubeType>::ExpandType, ) -> <Self::Item as CubeType>::ExpandType

Source§

fn __expand_write( context: &mut CubeContext, accumulator: <Self as CubeType>::ExpandType, index: <u32 as CubeType>::ExpandType, item: <Self::Item as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType

Implementors§