pub trait FftBackend: BackendSession {
// Required method
fn execute_fft(
&mut self,
input: &Tensor,
spec: &FftPlanSpec,
cache: FftExecutionCache<'_>,
) -> Result<Tensor>;
// Provided method
fn validate_fft_read_input(
&self,
_op: &'static str,
_input: &TensorRead<'_>,
) -> Result<()> { ... }
}Expand description
Explicit backend capability required by concrete and traced FFT execution.
Implementations must execute on the input’s existing placement. Unsupported dtypes, layouts, placements, or operations return an error; they must never transfer the tensor or select a different backend.
§Examples
Backend surface required by the FFT extension runtime and the built-in concrete FFT dispatch.
This is a backend SPI: third-party backend implementers implement this
trait on their execution sessions to provide FFT capability. The concrete
[TensorFftExt]/[TensorReadFftExt] methods and [FftExecutor] take an
erased &mut dyn BackendSession and dispatch internally to the
built-in CPU/CUDA/WebGPU execution sessions; a session without this
capability returns a typed Error::Unsupported instead of being accepted
as an arbitrary third-party backend (issue #1680 Phase 3).
§Examples
use tenferro_cpu::CpuExecSession;
use tenferro_fft::FftBackend;
fn accepts_fft_backend<B: FftBackend>() {}
accepts_fft_backend::<CpuExecSession<'static>>();A generic tensor backend does not expose the FFT capability at the SPI level:
use tenferro_tensor::{Tensor, TensorBackend};
use tenferro_fft::FftBackend;
fn requires_fft_backend<B: TensorBackend>(backend: &mut B) {
let _: &mut dyn FftBackend = backend;
}Required Methods§
Sourcefn execute_fft(
&mut self,
input: &Tensor,
spec: &FftPlanSpec,
cache: FftExecutionCache<'_>,
) -> Result<Tensor>
fn execute_fft( &mut self, input: &Tensor, spec: &FftPlanSpec, cache: FftExecutionCache<'_>, ) -> Result<Tensor>
Execute one validated FFT request on input’s existing placement.
§Errors
Returns tenferro_tensor::Error::Unsupported for an unsupported
operation, dtype, layout, or placement;
tenferro_tensor::Error::Validation for inconsistent input/spec
metadata or checked shape arithmetic; and a typed backend or runtime
source when plan creation, cache access, or execution fails.
Provided Methods§
Sourcefn validate_fft_read_input(
&self,
_op: &'static str,
_input: &TensorRead<'_>,
) -> Result<()>
fn validate_fft_read_input( &self, _op: &'static str, _input: &TensorRead<'_>, ) -> Result<()>
Validate a borrowed runtime input before the extension read path materializes it into a compact tensor.
Backends that can materialize their own placement may keep the default no-op. CPU overrides this to report device inputs as unsupported FFT placement errors instead of leaking a generic host-materialization error.
§Errors
Returns tenferro_tensor::Error::Unsupported when this backend cannot
consume the borrowed input placement without an explicit transfer.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".