pub trait RunnerChannel:
Clone
+ Send
+ Sync
+ 'static
+ Sized {
type Device: DeviceOps;
type Bridge: MultiBackendBridge<Device = Self::Device>;
type Client: RunnerClient<Device = Self::Device>;
type FloatElem: Element;
type IntElem: Element;
type BoolElem: Element;
// Required methods
fn name(device: &Self::Device) -> String;
fn init_client(device: &Self::Device) -> Self::Client;
fn get_tensor_handle(
tensor: &TensorIr,
client: &Self::Client,
) -> TensorHandle<Self::Bridge>;
fn register_tensor(
client: &Self::Client,
handle: TensorHandle<Self::Bridge>,
shape: Vec<usize>,
dtype: DType,
) -> RouterTensor<Self::Client>;
// Provided method
fn change_client_backend(
tensor: RouterTensor<Self::Client>,
device: &Self::Device,
) -> RouterTensor<Self::Client> { ... }
}
Expand description
Defines the connection channel and operations for a setup with multiple backend runner clients.
Required Associated Types§
Sourcetype Bridge: MultiBackendBridge<Device = Self::Device>
type Bridge: MultiBackendBridge<Device = Self::Device>
A bridge that can transfer tensors between multiple backends.
Sourcetype Client: RunnerClient<Device = Self::Device>
type Client: RunnerClient<Device = Self::Device>
Client type.
Required Methods§
Sourcefn init_client(device: &Self::Device) -> Self::Client
fn init_client(device: &Self::Device) -> Self::Client
Initialize a new client for the given device.
Sourcefn get_tensor_handle(
tensor: &TensorIr,
client: &Self::Client,
) -> TensorHandle<Self::Bridge>
fn get_tensor_handle( tensor: &TensorIr, client: &Self::Client, ) -> TensorHandle<Self::Bridge>
Get the tensor handle corresponding to the tensor representation.
Sourcefn register_tensor(
client: &Self::Client,
handle: TensorHandle<Self::Bridge>,
shape: Vec<usize>,
dtype: DType,
) -> RouterTensor<Self::Client>
fn register_tensor( client: &Self::Client, handle: TensorHandle<Self::Bridge>, shape: Vec<usize>, dtype: DType, ) -> RouterTensor<Self::Client>
Create a tensor with the given handle and shape.
Provided Methods§
Sourcefn change_client_backend(
tensor: RouterTensor<Self::Client>,
device: &Self::Device,
) -> RouterTensor<Self::Client>
fn change_client_backend( tensor: RouterTensor<Self::Client>, device: &Self::Device, ) -> RouterTensor<Self::Client>
Change the tensor to a different client backend.
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.