Trait FusionClient

Source
pub trait FusionClient<R>:
    Send
    + Sync
    + Clone
    + Sized
where R: FusionRuntime<FusionClient = Self>,
{
Show 17 methods // Required methods fn new(device: FusionDevice<R>) -> Self; fn register<O>( &self, streams: OperationStreams, repr: OperationIr, operation: O, ) where O: Operation<R> + 'static; fn drain(&self); fn device(&self) -> &FusionDevice<R>; fn tensor_uninitialized( &self, shape: Vec<usize>, dtype: DType, ) -> FusionTensor<R>; fn register_tensor( &self, handle: FusionHandle<R>, shape: Vec<usize>, stream: StreamId, dtype: DType, ) -> FusionTensor<R>; fn read_tensor_float<B>( self, tensor: TensorIr, stream: StreamId, ) -> impl Future<Output = TensorData> + Send where B: FusionBackend<FusionRuntime = R>; fn read_tensor_int<B>( self, tensor: TensorIr, stream: StreamId, ) -> impl Future<Output = TensorData> + Send where B: FusionBackend<FusionRuntime = R>; fn read_tensor_bool<B>( self, tensor: TensorIr, stream: StreamId, ) -> impl Future<Output = TensorData> + Send where B: FusionBackend<FusionRuntime = R>; fn read_tensor_quantized<B>( self, tensor: TensorIr, streams: StreamId, ) -> impl Future<Output = TensorData> + Send where B: FusionBackend<FusionRuntime = R>; fn resolve_tensor_float<B>( &self, tensor: FusionTensor<R>, ) -> B::FloatTensorPrimitive where B: FusionBackend<FusionRuntime = R>; fn resolve_tensor_int<B>( &self, tensor: FusionTensor<R>, ) -> B::IntTensorPrimitive where B: FusionBackend<FusionRuntime = R>; fn resolve_tensor_bool<B>( &self, tensor: FusionTensor<R>, ) -> B::BoolTensorPrimitive where B: FusionBackend<FusionRuntime = R>; fn change_client_float<B>( &self, tensor: TensorIr, client: Self, stream: StreamId, ) -> FusionTensor<R> where B: FusionBackend<FusionRuntime = R>; fn change_client_int<B>( &self, tensor: TensorIr, client: Self, stream: StreamId, ) -> FusionTensor<R> where B: FusionBackend<FusionRuntime = R>; fn change_client_bool<B>( &self, tensor: TensorIr, client: Self, stream: StreamId, ) -> FusionTensor<R> where B: FusionBackend<FusionRuntime = R>; fn change_client_quantized<B>( &self, tensor: TensorIr, client: Self, stream: StreamId, ) -> FusionTensor<R> where B: FusionBackend<FusionRuntime = R>;
}
Expand description

Define how to interact with the fusion server.

Required Methods§

Source

fn new(device: FusionDevice<R>) -> Self

Create a new client for the given device.

Source

fn register<O>( &self, streams: OperationStreams, repr: OperationIr, operation: O, )
where O: Operation<R> + 'static,

Source

fn drain(&self)

Register all lazy computation.

Source

fn device(&self) -> &FusionDevice<R>

Get the current device used by all operations handled by this client.

Source

fn tensor_uninitialized( &self, shape: Vec<usize>, dtype: DType, ) -> FusionTensor<R>

Create a new fusion tensor, but with no resources allocated to it.

Source

fn register_tensor( &self, handle: FusionHandle<R>, shape: Vec<usize>, stream: StreamId, dtype: DType, ) -> FusionTensor<R>

Create a tensor with the given handle and shape.

Source

fn read_tensor_float<B>( self, tensor: TensorIr, stream: StreamId, ) -> impl Future<Output = TensorData> + Send
where B: FusionBackend<FusionRuntime = R>,

Read the values contained by a float tensor.

Source

fn read_tensor_int<B>( self, tensor: TensorIr, stream: StreamId, ) -> impl Future<Output = TensorData> + Send
where B: FusionBackend<FusionRuntime = R>,

Read the values contained by an int tensor.

Source

fn read_tensor_bool<B>( self, tensor: TensorIr, stream: StreamId, ) -> impl Future<Output = TensorData> + Send
where B: FusionBackend<FusionRuntime = R>,

Read the values contained by a bool tensor.

Source

fn read_tensor_quantized<B>( self, tensor: TensorIr, streams: StreamId, ) -> impl Future<Output = TensorData> + Send
where B: FusionBackend<FusionRuntime = R>,

Read the values contained by a quantized tensor.

Source

fn resolve_tensor_float<B>( &self, tensor: FusionTensor<R>, ) -> B::FloatTensorPrimitive
where B: FusionBackend<FusionRuntime = R>,

Resolve the given float tensor to a primitive tensor.

Source

fn resolve_tensor_int<B>( &self, tensor: FusionTensor<R>, ) -> B::IntTensorPrimitive
where B: FusionBackend<FusionRuntime = R>,

Resolve the given int tensor to a primitive tensor.

Source

fn resolve_tensor_bool<B>( &self, tensor: FusionTensor<R>, ) -> B::BoolTensorPrimitive
where B: FusionBackend<FusionRuntime = R>,

Resolve the given bool tensor to a primitive tensor.

Source

fn change_client_float<B>( &self, tensor: TensorIr, client: Self, stream: StreamId, ) -> FusionTensor<R>
where B: FusionBackend<FusionRuntime = R>,

Change the client of the given float tensor.

Source

fn change_client_int<B>( &self, tensor: TensorIr, client: Self, stream: StreamId, ) -> FusionTensor<R>
where B: FusionBackend<FusionRuntime = R>,

Change the client of the given int tensor.

Source

fn change_client_bool<B>( &self, tensor: TensorIr, client: Self, stream: StreamId, ) -> FusionTensor<R>
where B: FusionBackend<FusionRuntime = R>,

Change the client of the given bool tensor.

Source

fn change_client_quantized<B>( &self, tensor: TensorIr, client: Self, stream: StreamId, ) -> FusionTensor<R>
where B: FusionBackend<FusionRuntime = R>,

Change the client of the given quantized tensor.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<R> FusionClient<R> for MutexFusionClient<R>
where R: FusionRuntime<FusionClient = Self> + 'static,