Skip to main content

Crate tenferro_runtime

Crate tenferro_runtime 

Source
Expand description

Traced graph runtime and extension dispatch infrastructure for tenferro.

This crate owns graph construction, lowering to execution IR, graph execution, and backend-parametric extension runtime dispatch. Standard operations are lowered through the runtime’s internal operation vocabulary; tensor storage and backend kernels live in tenferro-tensor.

Use this crate directly when you want concrete tensor helpers or reusable traced graph execution without opting into autodiff. Start with TypedTensor when the scalar type is fixed in Rust, Tensor when dtype is selected at runtime, and TracedTensor plus GraphCompiler and GraphExecutor when the same expression should be compiled once and run repeatedly. Operation-family crates such as tenferro-einsum, tenferro-linalg, and tenferro-fft register extension runtimes with GraphExecutor when compiled execution reaches those operations.

User-facing guides live at https://tensor4all.org/tenferro-rs/guides/choosing-an-api.html and https://tensor4all.org/tenferro-rs/guides/execution-models.html.

§Examples

use tenferro_runtime::{GraphCompiler, GraphExecutor, TracedTensor};
use tenferro_cpu::CpuBackend;

let x = TracedTensor::from_vec_col_major(vec![2], vec![1.0_f64, 2.0]).unwrap();
let y = (&x + &x).unwrap();
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&y).unwrap();
let out = GraphExecutor::new(CpuBackend::default()).run(&program).unwrap();
assert_eq!(out.as_slice::<f64>().unwrap(), &[2.0, 4.0]);

Re-exports§

pub use error::ContextId;
pub use error::Error;
pub use error::Result;
pub use extension_cache::ExtensionCacheKey;
pub use extension_cache::ExtensionCacheLimits;
pub use extension_cache::ExtensionCacheSelector;
pub use extension_cache::ExtensionCacheStore;
pub use extension_runtime::ExtensionExecutionContext;
pub use extension_runtime::ExtensionExecutor;
pub use extension_runtime::ExtensionRegistry;
pub use extension_runtime::ExtensionRuntime;
pub use extension_runtime::ExtensionRuntimeRegistryError;
pub use graph::GraphCompiler;
pub use graph::GraphCompilerCacheStats;
pub use graph::GraphExecutor;
pub use graph::GraphExecutorCacheStats;
pub use graph::GraphInstructionView;
pub use graph::GraphOpView;
pub use graph::GraphProgram;
pub use graph::GraphProgramInput;
pub use graph::GraphProgramLoweringShapeError;
pub use graph::GraphProgramLoweringView;
pub use traced::TracedTensor;

Modules§

error
Error types for the tenferro runtime crate.
extension
Public surface for out-of-tree extension primitives.
extension_cache
Generic runtime caches for extension executors.
extension_runtime
Backend-parametric runtime dispatch for extension ops.
graph
Graph compilation APIs.
sym_dim
traced

Structs§

CacheStats
Entry and retained-byte accounting for one cache.
CompilerOptions
DotGeneralConfig
DotGeneral dimension configuration.
GatherConfig
StableHLO gather dimension configuration.
OptimizerConfig
PadConfig
StableHLO pad configuration.
ScatterConfig
StableHLO scatter dimension configuration.
SliceConfig
Slice configuration.
SymDim
A symbolic tensor dimension expression used to build shape-agnostic graphs.
TypedTensor
Runtime typed tensor storage with compile-time scalar type and rank metadata.
TypedTensorView
Read-only borrowed view of typed tensor storage with arbitrary strides.

Enums§

CompareDir
Comparison direction.
DType
Runtime scalar dtype tag.
Tensor
Dynamic tensor enum over the supported scalar types.
TensorRead
Read-only tensor input accepted by synchronous eager kernels.
TensorValue
Owned tensor value that can be compact or a lazy view.
TensorView
Dynamic read-only borrowed tensor view.

Traits§

TensorBackend
Standard runtime backend over dynamic Tensor values.
TensorOpsExt
Backend-explicit concrete tensor operations.
TensorScalar
Sealed trait for scalar types that can be stored in a Tensor.
TypedTensorMaskOpsExt
Backend-explicit bool-mask operations for typed tensors.
TypedTensorOpsExt
Backend-explicit operations for dynamic-rank typed tensors.