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§
- Cache
Stats - Entry and retained-byte accounting for one cache.
- Compiler
Options - DotGeneral
Config - DotGeneral dimension configuration.
- Gather
Config - StableHLO gather dimension configuration.
- Optimizer
Config - PadConfig
- StableHLO pad configuration.
- Scatter
Config - StableHLO scatter dimension configuration.
- Slice
Config - Slice configuration.
- SymDim
- A symbolic tensor dimension expression used to build shape-agnostic graphs.
- Typed
Tensor - Runtime typed tensor storage with compile-time scalar type and rank metadata.
- Typed
Tensor View - Read-only borrowed view of typed tensor storage with arbitrary strides.
Enums§
- Compare
Dir - Comparison direction.
- DType
- Runtime scalar dtype tag.
- Tensor
- Dynamic tensor enum over the supported scalar types.
- Tensor
Read - Read-only tensor input accepted by synchronous eager kernels.
- Tensor
Value - Owned tensor value that can be compact or a lazy view.
- Tensor
View - Dynamic read-only borrowed tensor view.
Traits§
- Tensor
Backend - Standard runtime backend over dynamic
Tensorvalues. - Tensor
OpsExt - Backend-explicit concrete tensor operations.
- Tensor
Scalar - Sealed trait for scalar types that can be stored in a
Tensor. - Typed
Tensor Mask OpsExt - Backend-explicit bool-mask operations for typed tensors.
- Typed
Tensor OpsExt - Backend-explicit operations for dynamic-rank typed tensors.