Skip to main content

FusionBackend

Trait FusionBackend 

pub trait FusionBackend: BackendIr<Handle = <Self::FusionRuntime as FusionRuntime>::FusionHandle, Device = <Self::FusionRuntime as FusionRuntime>::FusionDevice> {
    type FusionRuntime: FusionRuntime;
    type FullPrecisionBackend: FusionBackend<FusionRuntime = Self::FusionRuntime>;

    // Required method
    fn cast_float(
        tensor: Self::FloatTensorPrimitive,
        dtype: DType,
    ) -> Self::Handle;

    // Provided method
    fn memory_persistent(_device: &Self::Device, _enabled: bool) { ... }
}
Expand description

Trait that allows an existing backend to specify graph optimizations using operation fuser.

Collective operations on the remote/router interpreter path are driven through the DistributedOps supertrait of Backend, which every fusion backend satisfies unconditionally.

Required Associated Types§

type FusionRuntime: FusionRuntime

The runtime used for this backend.

type FullPrecisionBackend: FusionBackend<FusionRuntime = Self::FusionRuntime>

Pointer to the full precision fusion backend.

Required Methods§

fn cast_float(tensor: Self::FloatTensorPrimitive, dtype: DType) -> Self::Handle

Cast a float tensor and returns the resulting handle.

Provided Methods§

fn memory_persistent(_device: &Self::Device, _enabled: bool)

Set the standing persistent-allocation mode of the device stream that executes fused operations.

Fusion’s memory_persistent_allocations cannot bracket the inner allocations with a closure: fused operations are recorded on the calling thread but execute later, on the fusion execution thread and its own device stream. The execution thread arms/disarms this standing mode instead (see the Backend impl). Defaults to a no-op for backends without allocation modes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§