Skip to main content

ExtensionRuntime

Trait ExtensionRuntime 

Source
pub trait ExtensionRuntime<B: TensorBackend + 'static>:
    Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn family_id(&self) -> &'static str;
    fn execute(
        &self,
        op: &dyn ExtensionOp,
        inputs: &[&Tensor],
        ctx: &mut ExtensionExecutionContext<'_, B>,
    ) -> Result<Vec<Tensor>>;
    fn execute_reads(
        &self,
        op: &dyn ExtensionOp,
        inputs: &[TensorRead<'_>],
        ctx: &mut ExtensionExecutionContext<'_, B>,
    ) -> Result<Vec<Tensor>>;
}
Expand description

A backend-specific runtime executor for one extension family.

Required Methods§

Source

fn family_id(&self) -> &'static str

Extension family handled by this executor.

Source

fn execute( &self, op: &dyn ExtensionOp, inputs: &[&Tensor], ctx: &mut ExtensionExecutionContext<'_, B>, ) -> Result<Vec<Tensor>>

Execute the extension op with backend and cache state supplied by core.

Source

fn execute_reads( &self, op: &dyn ExtensionOp, inputs: &[TensorRead<'_>], ctx: &mut ExtensionExecutionContext<'_, B>, ) -> Result<Vec<Tensor>>

Execute the extension op on borrowed tensor reads.

Implementations that need compact tensors must materialize inputs here explicitly. Keeping this method required prevents implicit read-path fallbacks from hiding backend or view handling bugs.

Implementors§