ReductionHandle

Trait ReductionHandle 

Source
pub trait ReductionHandle<T>: Send + Sync
where T: ReductionScalar,
{ // Required methods fn device_ptr(&self) -> u64; fn reset(&self) -> Result<(), RingKernelError>; fn read(&self) -> Result<T, RingKernelError>; fn read_combined(&self) -> Result<T, RingKernelError>; fn sync_and_read(&self) -> Result<T, RingKernelError>; fn op(&self) -> ReductionOp; fn num_slots(&self) -> usize; }
Expand description

Handle to a reduction buffer for streaming operations.

This trait abstracts over backend-specific reduction buffer implementations, allowing the same code to work with CUDA, WebGPU, or CPU backends.

Required Methods§

Source

fn device_ptr(&self) -> u64

Get device pointer for kernel parameter passing.

Source

fn reset(&self) -> Result<(), RingKernelError>

Reset buffer to identity value.

Source

fn read(&self) -> Result<T, RingKernelError>

Read the current reduction result from slot 0.

Source

fn read_combined(&self) -> Result<T, RingKernelError>

Read and combine all slots into a single result.

Source

fn sync_and_read(&self) -> Result<T, RingKernelError>

Synchronize device and read result.

Ensures all GPU operations complete before reading.

Source

fn op(&self) -> ReductionOp

Get the reduction operation type.

Source

fn num_slots(&self) -> usize

Get number of slots.

Implementors§