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§
Sourcefn 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<()>
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,
)
}