Skip to main content

BackendCachedDot

Trait BackendCachedDot 

Source
pub trait BackendCachedDot: BackendRuntimeCache + TensorDot {
    // Provided method
    fn dot_general_read_into_accum_cached(
        &mut self,
        _cache: &mut Self::RuntimeCache,
        _cache_slot: Option<usize>,
        lhs: TensorRead<'_>,
        rhs: TensorRead<'_>,
        config: &DotGeneralConfig,
        accumulation: DotGeneralAccumulation,
        out: TensorWrite<'_>,
    ) -> Result<()> { ... }
}
Expand description

Backend-owned cached dot-general operations.

§Examples

use tenferro_tensor::BackendCachedDot;

fn accepts_backend_cached_dot<B: BackendCachedDot>(_backend: &mut B) {}

Provided Methods§

Source

fn dot_general_read_into_accum_cached( &mut self, _cache: &mut Self::RuntimeCache, _cache_slot: Option<usize>, lhs: TensorRead<'_>, rhs: TensorRead<'_>, config: &DotGeneralConfig, accumulation: DotGeneralAccumulation, out: TensorWrite<'_>, ) -> Result<()>

Apply cached scaled dot-general accumulation into caller-provided output.

The cache slot identifies backend-local analysis metadata only; output semantics are still fully described by accumulation.

§Examples
use tenferro_tensor::{
    BackendCachedDot, BackendRuntimeCache, DotGeneralAccumulation, DotGeneralConfig,
    TensorRead, TensorWrite,
};

fn cached_dot_add_to<B: BackendCachedDot>(
    backend: &mut B,
    cache: &mut B::RuntimeCache,
    lhs: TensorRead<'_>,
    rhs: TensorRead<'_>,
    config: &DotGeneralConfig,
    out: TensorWrite<'_>,
) -> tenferro_tensor::Result<()>
where
    B: BackendRuntimeCache,
{
    let accumulation = DotGeneralAccumulation::add_to(lhs.dtype())?;
    backend.dot_general_read_into_accum_cached(
        cache,
        Some(0),
        lhs,
        rhs,
        config,
        accumulation,
        out,
    )
}
§Errors

Returns crate::Error::Validation with a typed ValidationError source for invalid shapes, ranks, axes, dtypes, or output metadata. It returns crate::Error::BackendFailure or crate::Error::BackendSource when backend execution or storage access cannot provide the requested result.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§