You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow a downstream scientific Rust application to use tenferro as its main tensor stack while
calling faer or BLAS/LAPACK directly when an operation is not yet available, suitable, or fast
enough through tenferro's operation APIs.
This escape hatch should be documented and continuously verified as a normal downstream workflow,
not inferred from tenferro's internal implementation.
What makes it hard today?
The current tensor API exposes much of the required host-side information:
compact host slices through as_slice() and mutable slice accessors;
shape(), strides(), and offset() for typed views;
host_storage() / host_storage_mut();
explicit column-major compactness checks.
However, there is no end-to-end public example showing that a downstream crate can use only
published tenferro APIs to:
construct a zero-copy faer matrix view from a tenferro tensor;
construct a writable faer view or BLAS output over tenferro-owned host storage;
call the external library with the correct column-major layout and leading dimensions; and
return to tenferro without violating aliasing, placement, or threading assumptions.
The current tenferro-cpu implementation depends on faer or BLAS/LAPACK behind provider feature
flags, but it does not publicly re-export faer, cblas-sys, or lapack. Internal helpers such as CpuBackend::with_linalg_pool and CpuExecutionContext::faer_parallelism are #[doc(hidden)] and
are described as operation-family extension contracts, not stable application-facing interop APIs.
The provider-inject feature registers provider function pointers for tenferro; it is not a general
downstream BLAS call surface.
Consequently, an application can probably assemble direct calls by adding matching dependencies,
but the supported dependency boundary, version policy, execution context, and provider-linking
contract are not demonstrated or guaranteed.
Proposed behavior or API
First, define and document the supported downstream boundary. The implementation may choose one of
these approaches:
tenferro provides an explicitly feature-gated interop re-export module; or
a small optional interop crate provides typed adapters without expanding the core tensor API.
A re-export is not required if direct dependencies are the preferred contract. If correct thread and
resource-domain coordination cannot be achieved through existing public APIs, consider a narrow,
stable external-linalg execution boundary rather than exposing the internal buffer pool wholesale.
The selected contract must be demonstrated by runnable tutorial code and the online guide.
Required examples
faer
Provide a downstream-style example that:
creates a compact column-major host tensor;
borrows its storage without copying;
constructs a faer immutable matrix view and performs a numerical operation;
constructs a mutable view or output when soundly supported;
verifies the numerical result;
checks compactness before using the contiguous path; and
explains the behavior for non-contiguous views and non-host placement.
BLAS/LAPACK
Provide a downstream-style example that:
enables exactly one supported BLAS provider feature;
passes tenferro host storage to a direct BLAS call with column-major layout and correct leading
dimensions;
writes into a tenferro-owned mutable output when soundly supported;
verifies the numerical result; and
documents LP64/ILP64, complex ABI, provider selection, and provider thread-control constraints.
The BLAS example should run with at least one provider in CI, not merely pass cargo check, so that
native symbol linkage is tested.
Relevant area
tenferro-tensor host access and layout metadata
tenferro-cpu provider features and CPU execution policy
faer and BLAS/LAPACK interoperability
tutorial code, rustdoc, and online documentation
Dependency, backend, or AD impact
CPU-only for this issue.
No CUDA, ROCm, WebGPU, Metal, or AD behavior is requested.
Avoid adding a second mandatory linear-algebra dependency to tensor-core crates.
Keep Cargo provider features additive while rejecting incompatible simultaneous native providers.
Direct external calls must not silently oversubscribe tenferro's Rayon domain and the linked
BLAS/LAPACK provider.
What are you trying to do?
Allow a downstream scientific Rust application to use tenferro as its main tensor stack while
calling faer or BLAS/LAPACK directly when an operation is not yet available, suitable, or fast
enough through tenferro's operation APIs.
This escape hatch should be documented and continuously verified as a normal downstream workflow,
not inferred from tenferro's internal implementation.
What makes it hard today?
The current tensor API exposes much of the required host-side information:
as_slice()and mutable slice accessors;shape(),strides(), andoffset()for typed views;host_storage()/host_storage_mut();However, there is no end-to-end public example showing that a downstream crate can use only
published tenferro APIs to:
The current
tenferro-cpuimplementation depends on faer or BLAS/LAPACK behind provider featureflags, but it does not publicly re-export
faer,cblas-sys, orlapack. Internal helpers such asCpuBackend::with_linalg_poolandCpuExecutionContext::faer_parallelismare#[doc(hidden)]andare described as operation-family extension contracts, not stable application-facing interop APIs.
The
provider-injectfeature registers provider function pointers for tenferro; it is not a generaldownstream BLAS call surface.
Consequently, an application can probably assemble direct calls by adding matching dependencies,
but the supported dependency boundary, version policy, execution context, and provider-linking
contract are not demonstrated or guaranteed.
Proposed behavior or API
First, define and document the supported downstream boundary. The implementation may choose one of
these approaches:
faer/cblas-sys/lapackversions;A re-export is not required if direct dependencies are the preferred contract. If correct thread and
resource-domain coordination cannot be achieved through existing public APIs, consider a narrow,
stable external-linalg execution boundary rather than exposing the internal buffer pool wholesale.
The selected contract must be demonstrated by runnable tutorial code and the online guide.
Required examples
faer
Provide a downstream-style example that:
BLAS/LAPACK
Provide a downstream-style example that:
dimensions;
The BLAS example should run with at least one provider in CI, not merely pass
cargo check, so thatnative symbol linkage is tested.
Relevant area
tenferro-tensorhost access and layout metadatatenferro-cpuprovider features and CPU execution policyDependency, backend, or AD impact
BLAS/LAPACK provider.
changes the relevant public borrow APIs.
Non-goals
Acceptance criteria
re-exports, or a dedicated interop adapter crate.
docs/guides/external-linalg-interop.mdcovering layout,ownership, placement, threading, and provider constraints.
APIs.
runnable examples so they cannot drift independently.
resource-domain and thread policy.
Related work
This issue covers tenferro-owned storage consumed by external faer or BLAS/LAPACK operations.
Verification
The documentation lane should execute the downstream fixtures, for example:
Exact command and fixture placement can follow the repository's existing tutorial-code conventions.
Provenance
No external prototype code is attached. Any implementation may be written from scratch under the
repository's existing MIT OR Apache-2.0 terms.