Skip to content

tenferro v0.12.0

Latest

Choose a tag to compare

@shinaoka shinaoka released this 19 Nov 01:01
· 63 commits to main since this release
d48982d

tenferro v0.12.0

main carried the 0.11.0 version string for the 107 commits after cef3746f,
the commit the published 0.11.0 crates were built from, while the public surface
under it changed into the one call grammar of #2552. v0.12.0 renumbers that tree
and collects what those commits change. The version moves one minor because no
compatibility promise exists yet; a Rust caller should still read it as a
breaking release.

Read docs/getting-started/api-migration.md
first. It carries the per-operation migration table, and
docs/spec/generated/api-ops.md is the
generated registry of every operation, its options type, its _into modes and
its declared omissions.

Breaking changes

One call grammar per operation family

Every family (core, linalg, einsum, FFT) now has one spelling per layer, built on
a per-family registry (#2552,
merged as #2580; the eager
EagerSession surface is
#2603):

recv.op(operands…, exec)                     // concrete, default options
recv.op_with(operands…, &opts, exec)         // concrete, explicit XxxOptions
recv.op_into(operands…, [&opts,] exec, dest) // concrete, only where declared
session.op(&x, operands…)                    // eager: the session is the receiver
traced.op_with(operands…, &opts)             // traced: no exec

The engine is always the last concrete argument, and a concrete receiver is any
AsView value (Tensor, TensorRead, TypedTensor<T>, TypedTensorView<T> or
a reference to one), so typed inputs return typed results from the same method.

What is gone, and where the replacement is:

  • The per-receiver linalg, einsum, tensordot, FFT and session-ops extension
    traits (TensorLinalgExt, TensorReadLinalgExt, TypedTensorLinalgExt,
    TracedTensorLinalgExt, TraceContextLinalgExt, EagerSessionLinalgExt,
    EagerTensorLinalgExt, the einsum and tensordot extensions, the six FFT
    extensions, and TensorSessionOpsExt / TypedTensorSessionOpsExt /
    TypedTensorMaskSessionOpsExt). CoreOps (tenferro-runtime), LinalgOps,
    TracedLinalgOps, EagerLinalgOps, EinsumOps, TensordotOps,
    TracedEinsumOps, TracedTensordotOps, EagerEinsumOps, FftOps,
    TracedFftOps and EagerFftOps replace them.
  • Every *_read spelling (svd_read, einsum_read_into, fft_read, …): pass
    the TensorRead to the plain method.
  • svd_full, *_with_options, pinv_with_rtol, solve_read_into,
    dot_general_with_conj, positional triangular_solve/norm arguments,
    einsum_notation/einsum_subscripts, the positional FftExecutor entries and
    the six free *_with_exec linalg functions. Each has a named replacement in
    the migration table.
  • An operation has an XxxOptions type and an _with form only when it has
    semantic options; add, solve, lstsq, householder_qr, lu,
    full_piv_lu, full_piv_lu_solve, eig, eigvals, slogdet, det, inv
    and tensordot have none, so their _into forms take no options either
    (#2580).

Backend and provider hooks (Engine::{svd_read,…}, TensorDot,
LinalgBackend, FftBackend) are provider contracts and are unchanged.

Results are structs, and _into writes into a Dest

Svd { u, s, vh }, Qr { q, r }, Lu { p, l, u, parity },
FullPivLu { p, l, u, q, parity }, Eig { values, vectors },
Eigh { values, vectors } and Slogdet { sign, log_abs_det } replace the tuples
and the TypedSvd/TypedLu/TypedFullPivLu/TypedEig aliases; fields keep the
former tuple order, so a caller that took the result apart positionally names
those fields now.

_into writes into tenferro_tensor::Dest (Dest::overwrite,
Dest::accumulate, Dest::scaled(out, alpha, beta)) and exists only where the
registry declares it: add_into, solve_into, einsum_into and
ConcreteEinsumPlan::execute_into. An undeclared mode is Unsupported before
any write.

Axes are isize, and lanes replace the *_with_exec entries

Public axis arguments (CoreOps, TracedTensor, EagerSession, linalg norm,
FFT options, TensorDotAxes::Axes) are isize, and a negative axis counts from
the end; AxisVec, normalize_axis and normalize_axes are public and
AxisOutOfBounds.axis is isize. IR-shaped configurations and
broadcast_in_dim keep usize.

CpuEngine::with_lanes(&shares, &mut pools, |i, lane| ..) splits the engine's
thread budget into lanes, each with a caller-owned BufferPool (re-exported at
the tenferro-cpu root), and replaces the six *_with_exec entries: inside a
lane the ordinary grammar runs (view.svd(lane)). Only svd, svdvals, qr,
eigh, eigvalsh and eigvals run in a lane; every other operation returns
Unsupported.

The vendor BLAS/LAPACK CPU providers are gone

Every build now links one faer-backed tlinalg/cpueinsum/tcontract stack
(#2608, merged as
#2609). The features
native, blas, blas-openblas, blas-mkl, blas-accelerate,
provider-inject, provider-src, cpueinsum-blas and tlinalg-blas no longer
exist on tenferro-cpu, tenferro-linalg, tenferro-runtime, tenferro-ad,
tenferro-einsum, tenferro-fft, tenferro-gpu, tenferro-xla or
docs/tutorial-code; there is no back-compat alias, so a stale dependency line
fails with "feature does not exist". tenferro-cpu and tenferro-runtime no
longer declare a default feature, because default was the provider
selector, and tenferro-runtime declares no features at all.

Migration: delete the feature name and the default-features = false that went
with it. cblas-sys, cblas-inject, blas-src, lapack, lapack-src and
lapack-inject are no longer workspace dependencies, so openblas-src,
openblas-build, intel-mkl-src and accelerate-src leave Cargo.lock.

Smaller removals

  • TensorBackendCapability::require_capability is gone; the descriptor is a
    declaration, not a gate, and every backend already refuses a pair it cannot
    serve in its own dispatch
    (#2477, merged as
    #2619). Read a
    declaration with capability() / capability_entry() and let the engine
    refuse execution.
  • Eight unused internal pub items are gone
    (#2546):
    ShapeGuardContext loses refresh_global_metadata,
    with_extension_ad_dispatcher, set_transpose_primal_outputs,
    transpose_primal_outputs, transpose_primal_outputs_were_used,
    take_deferred_shape_error and extend_metadata, and CudaEngine loses
    runtime_mut.

Dependency moves

dependency 0.11.0 0.12.0
cpueinsum-blas, tlinalg-blas 0.12.0 / 0.5.1 removed
cblas-sys, cblas-inject, blas-src, lapack, lapack-src, lapack-inject present removed
t4a-cuda-runtime =0.1.0 (rev a1fd7ae) =0.1.1 (rev 147af9e)

tlinalg 0.11.0, cpueinsum 0.12.0, tcontract-exec 0.12.0, the strided-*
0.12.0 line, threadteam 0.5.1, t4a-faer 0.33.0 and t4a-cuda-kernels 0.1.2
are unchanged. scripts/check-single-versions.sh is the check that keeps one
identity per crate in the resolved graph.

New

tenferro-mpi and tenferro-hdf5

Two optional adapters moved from ext/ into the root workspace
(#2621), with empty
default features so the root lanes need neither MPI nor HDF5.

  • tenferro-mpi moves one host tensor between two ranks over MPI
    point-to-point messages — send, recv and recv_into for TypedTensor and
    the dtype-erased Tensor
    (#2617). It borrows the
    caller's communicator and never initializes or finalizes MPI. A Gpu tensor
    does not implement Transport, so a device transfer is a compile error.
    Opt in with system (needs MPI headers and libclang) or runtime (loads MPI
    at run time); the two are mutually exclusive.
  • tenferro-hdf5 stores host tensors in HDF5 datasets through caller-supplied
    handles, with a versioned schema and no hidden transfer or conversion
    (#2611, merged as
    #2615). Opt in with
    hdf5.

Two engine hooks

  • CpuEngine::dispatch_costs returns the threadteam::DispatchCosts the
    engine's tokens use, so a caller can decide with num_threads and
    width_for_by / pays_at whether an operation would fork before taking a
    token (#2590).
  • CpuEngine::with_guard is with_exec at width one minus the placement token:
    the same refusal of a broken engine, the same unwind handling and the same
    workspace retention bound, but no worker is reserved
    (#2591).
  • EighOptions::batch_policy says how many cuSOLVER launches a batch may cost.
    EighBatchPolicy::RequireBatched turns the silent per-matrix fallback into a
    typed Unsupported error naming the missing symbol and the fallback it
    declined; the default keeps 0.11.0's routing unchanged
    (#2622).

Fixes

  • A one-input stack / concatenate compiles. StdTensorOp::Concatenate read
    the output dtype from inputs 0 and 1, so one input failed in shape inference
    and inputs past the second were ignored; the dtype now folds over every input
    (#2599, merged as
    #2600).
  • EinsumOptimize::False contracts left to right again, instead of building
    pair intermediates the notation never mentions. On "ij,jk,kl,lm,m->i"
    (d=256, f64, serial engine) step 3 was a 256³ outer product, 128 MiB of
    intermediate and 186.9 ms, against 3.33 ms for the documented order.
  • A traced tensordot axis of isize::MIN panicked in overflow-checked
    builds instead of reporting AxisOutOfBounds, because normalize_axis
    computed rank + axis before the bound check. The explicit-axis path now
    uses the shared tenferro_tensor::normalize_axis
    (#2605, merged as
    #2606).
  • Eager lstsq refuses a rank-deficient A instead of returning a solution
    (#2583, merged as
    #2584).
  • norm documents its ord = 0 NaN contract on the public surface
    (#2626, merged as
    #2627).
  • CpuEngine's cache controls cover its extension cache store:
    runtime_cache_stats adds the store's entries and retained bytes,
    clear_runtime_caches clears it, and take_extension_caches moves the store
    out instead of allocating an empty one
    (#2587, merged as
    #2588).

Results that can differ in the final bit

  • CUDA softplus is one fused launch on F32/F64
    (#2530). It computes the
    composite's arithmetic through the same device helpers and picks the same
    operand the composite's compare-and-select picks, so a non-NaN input gives the
    composite's bits; a NaN input stays NaN, possibly with a different sign or
    payload.
  • The EinsumOptimize::False fix above changes the summation order, so results
    can differ in the last bits from 0.11.0 while matching the same order written
    as an explicit EinsumOptimize::Path.

Known limitations

  • A lane runs six factorizations and returns Unsupported for everything else;
    every operation outside with_lanes keeps the ordinary grammar.
  • tenferro-hdf5 stays publish = false until hdf5-rt is on crates.io, so it
    is a workspace crate, not a crates.io package, in this release.
  • tenferro-mpi is publishable but has never been published; its first
    publication needs the release owner's per-package approval.

Full comparison: tenferro-tensor-v0.11.0...main
— the 0.11.0 crates were published from cef3746f under per-crate
tenferro-*-v0.11.0 tags; a v0.12.0 tag narrows this to the release commit.