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§
Sourcefn device_ptr(&self) -> u64
fn device_ptr(&self) -> u64
Get device pointer for kernel parameter passing.
Sourcefn read_combined(&self) -> Result<T>
fn read_combined(&self) -> Result<T>
Read and combine all slots into a single result.
Sourcefn sync_and_read(&self) -> Result<T>
fn sync_and_read(&self) -> Result<T>
Synchronize device and read result.
Ensures all GPU operations complete before reading.
Sourcefn op(&self) -> ReductionOp
fn op(&self) -> ReductionOp
Get the reduction operation type.