pub struct NativeBackend { /* private fields */ }Expand description
Native backend using faer for GEMM and, with the hptt feature, HPTT for
transpose (a naive kernel otherwise).
This is the sole owner of faer and hptt-rs dependencies in the workspace.
Other crates access these capabilities through the ComputeBackend trait.
Holds a PerformanceManager that drives the par_for_* dispatch
decisions for each op based on a hardware-aware threshold table.
Implementations§
Source§impl NativeBackend
impl NativeBackend
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a NativeBackend with thresholds auto-detected from the
current machine via ThresholdTable::detect().
Sourcepub fn with_perf(perf: PerformanceManager) -> Self
pub fn with_perf(perf: PerformanceManager) -> Self
Construct a NativeBackend with a user-supplied PerformanceManager.
Use this to override the auto-detected threshold table, e.g. to pin the laptop profile on a workstation for reproducible benchmarks.
Sourcepub fn perf(&self) -> &PerformanceManager
pub fn perf(&self) -> &PerformanceManager
Borrow the PerformanceManager driving this backend’s dispatch.
Get a shared singleton instance.
All tensors using the default backend share this single Arc, avoiding per-tensor allocation.
Trait Implementations§
Source§impl Clone for NativeBackend
impl Clone for NativeBackend
Source§fn clone(&self) -> NativeBackend
fn clone(&self) -> NativeBackend
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ComputeBackend for NativeBackend
impl ComputeBackend for NativeBackend
Source§fn gemm<T: Scalar>(
&self,
desc: GemmDescriptor<'_, T>,
) -> Result<(), BackendError>
fn gemm<T: Scalar>( &self, desc: GemmDescriptor<'_, T>, ) -> Result<(), BackendError>
GEMM: C = alpha * A * B + beta * C
Dispatches to faer for f64/f32/Complex<f64>/Complex<f32>.
Source§fn transpose<T: Scalar>(
&self,
desc: TransposeDescriptor<'_, T>,
) -> Result<(), BackendError>
fn transpose<T: Scalar>( &self, desc: TransposeDescriptor<'_, T>, ) -> Result<(), BackendError>
Transpose tensor axes according to permutation.
Uses HPTT for f64/f32/Complex when the hptt feature is enabled,
otherwise a naive output-driven kernel.
Source§fn svd<T: Scalar>(&self, desc: SvdDescriptor<'_, T>) -> Result<(), BackendError>
fn svd<T: Scalar>(&self, desc: SvdDescriptor<'_, T>) -> Result<(), BackendError>
Thin SVD via faer: A = U * diag(S) * Vt
Dispatches to faer for f64/f32/Complex<f64>/Complex<f32>.
For complex types, Vt stores V^H (conjugate transpose).
faer’s SVD is column-major only; descriptors with any other
order are rejected with BackendError::InvalidArgument.
Source§fn qr<T: Scalar>(&self, desc: QrDescriptor<'_, T>) -> Result<(), BackendError>
fn qr<T: Scalar>(&self, desc: QrDescriptor<'_, T>) -> Result<(), BackendError>
Thin QR via faer: A = Q * R
Dispatches to faer for f64/f32/Complex<f64>/Complex<f32>.
faer’s QR is column-major only; descriptors with any other
order are rejected with BackendError::InvalidArgument.
Source§fn lq<T: Scalar>(&self, desc: LqDescriptor<'_, T>) -> Result<(), BackendError>
fn lq<T: Scalar>(&self, desc: LqDescriptor<'_, T>) -> Result<(), BackendError>
Thin LQ via faer: A = L * Q
Internally computes QR of A^H (adjoint), then takes conjugate transposes.
Dispatches to faer for f64/f32/Complex<f64>/Complex<f32>.
faer’s QR (and hence this LQ) is column-major only; descriptors
with any other order are rejected with BackendError::InvalidArgument.
Source§fn eigh<T: Scalar>(
&self,
desc: EighDescriptor<'_, T>,
) -> Result<(), BackendError>
fn eigh<T: Scalar>( &self, desc: EighDescriptor<'_, T>, ) -> Result<(), BackendError>
Self-adjoint eigenvalue decomposition via faer
Dispatches to faer for f64/f32/Complex<f64>/Complex<f32>.
faer’s eigendecomposition is column-major only; descriptors with
any other order are rejected with BackendError::InvalidArgument.
Source§fn eig<T: Scalar>(&self, desc: EigDescriptor<'_, T>) -> Result<(), BackendError>
fn eig<T: Scalar>(&self, desc: EigDescriptor<'_, T>) -> Result<(), BackendError>
General eigenvalue decomposition via faer
Dispatches to faer for f64/f32/Complex<f64>/Complex<f32>.
faer’s eigendecomposition is column-major only; descriptors with
any other order are rejected with BackendError::InvalidArgument.
Source§fn solve<T: Scalar>(
&self,
desc: SolveDescriptor<'_, T>,
) -> Result<(), BackendError>
fn solve<T: Scalar>( &self, desc: SolveDescriptor<'_, T>, ) -> Result<(), BackendError>
Linear solve via faer LU decomposition with partial pivoting
Dispatches to faer for f64/f32/Complex<f64>/Complex<f32>.
faer’s LU is column-major only; descriptors with any other
order are rejected with BackendError::InvalidArgument.
Source§fn device_type(&self) -> DeviceType
fn device_type(&self) -> DeviceType
Source§fn preferred_order(&self) -> MemoryOrder
fn preferred_order(&self) -> MemoryOrder
Source§fn par_for_svd(&self, m: usize, n: usize) -> ExecPolicy
fn par_for_svd(&self, m: usize, n: usize) -> ExecPolicy
Source§fn par_for_qr(&self, m: usize, n: usize) -> ExecPolicy
fn par_for_qr(&self, m: usize, n: usize) -> ExecPolicy
Source§fn par_for_lq(&self, m: usize, n: usize) -> ExecPolicy
fn par_for_lq(&self, m: usize, n: usize) -> ExecPolicy
Source§fn par_for_eigh(&self, n: usize) -> ExecPolicy
fn par_for_eigh(&self, n: usize) -> ExecPolicy
Source§fn par_for_eig(&self, n: usize) -> ExecPolicy
fn par_for_eig(&self, n: usize) -> ExecPolicy
Source§fn par_for_gemm(&self, m: usize, n: usize, k: usize) -> ExecPolicy
fn par_for_gemm(&self, m: usize, n: usize, k: usize) -> ExecPolicy
Source§fn par_for_solve(&self, n: usize, _nrhs: usize) -> ExecPolicy
fn par_for_solve(&self, n: usize, _nrhs: usize) -> ExecPolicy
Source§fn par_for_transpose(&self, shape: &[usize]) -> ExecPolicy
fn par_for_transpose(&self, shape: &[usize]) -> ExecPolicy
Source§fn is_available(&self) -> bool
fn is_available(&self) -> bool
Source§impl Debug for NativeBackend
impl Debug for NativeBackend
Auto Trait Implementations§
impl Freeze for NativeBackend
impl RefUnwindSafe for NativeBackend
impl Send for NativeBackend
impl Sync for NativeBackend
impl Unpin for NativeBackend
impl UnsafeUnpin for NativeBackend
impl UnwindSafe for NativeBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more