Skip to main content

ReductionHandle

Trait ReductionHandle 

Source
pub trait ReductionHandle<T: ReductionScalar>: Send + Sync {
    // Required methods
    fn device_ptr(&self) -> u64;
    fn reset(&self) -> Result<()>;
    fn read(&self) -> Result<T>;
    fn read_combined(&self) -> Result<T>;
    fn sync_and_read(&self) -> Result<T>;
    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<()>

Reset buffer to identity value.

Source

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

Read the current reduction result from slot 0.

Source

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

Read and combine all slots into a single result.

Source

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

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§