Skip to main content

ElementwiseRuntime

Trait ElementwiseRuntime 

Source
pub trait ElementwiseRuntime:
    Debug
    + Send
    + Sync
    + 'static {
    // Required method
    fn prepare(
        &self,
        request: ElementwisePrepareRequest<'_>,
    ) -> Result<PrepareCapability, PrepareError>;

    // Provided method
    fn max_fused_region_inputs(&self) -> Option<usize> { ... }
}
Expand description

Direct runtime provider for elementwise core operations.

Required Methods§

Source

fn prepare( &self, request: ElementwisePrepareRequest<'_>, ) -> Result<PrepareCapability, PrepareError>

Prepare one elementwise operation.

§Errors

Returns PrepareError when provider preparation fails.

Provided Methods§

Source

fn max_fused_region_inputs(&self) -> Option<usize>

Largest number of distinct external inputs one fused elementwise region may read on this engine, or None when the engine has no such limit.

The prepared planner does not plan a region above this limit, so the region runs instruction by instruction without a fusion attempt that the backend would decline anyway. The default is None.

§Examples
use tenferro_cpu::CpuBackend;
use tenferro_runtime::ElementwiseRuntime;

// The CPU engine's fused kernel reads at most four region inputs.
let cpu = CpuBackend::new();
assert_eq!(cpu.max_fused_region_inputs(), Some(4));

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§