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§
Sourcefn prepare(
&self,
request: ElementwisePrepareRequest<'_>,
) -> Result<PrepareCapability, PrepareError>
fn prepare( &self, request: ElementwisePrepareRequest<'_>, ) -> Result<PrepareCapability, PrepareError>
Provided Methods§
Sourcefn max_fused_region_inputs(&self) -> Option<usize>
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".