pub trait Runtime:
Sized
+ Send
+ Sync
+ 'static
+ Debug
+ Clone {
type Server: ServerStorage;
type Device: Device;
// Required methods
fn can_read_tensor(shape: &Shape, strides: &Strides) -> bool;
fn target_properties() -> TargetProperties;
fn enumerate_devices(type_id: u16) -> Vec<DeviceId>;
// Provided methods
fn client(device: &Self::Device) -> Client { ... }
fn enumerate_all_devices() -> Vec<DeviceId> { ... }
fn enumerate_devices_like(device_id: DeviceId) -> Vec<DeviceId> { ... }
fn find_device(device_id: DeviceId) -> Result<(), usize> { ... }
fn is_available() -> bool { ... }
}Expand description
Runtime for the CubeCL.
Required Associated Types§
Sourcetype Server: ServerStorage
type Server: ServerStorage
The compute server used to run kernels and perform autotuning.
Required Methods§
Sourcefn can_read_tensor(shape: &Shape, strides: &Strides) -> bool
fn can_read_tensor(shape: &Shape, strides: &Strides) -> bool
Whether a tensor with shape and strides can be read as is. If the result is false, the
tensor should be made contiguous before reading.
Sourcefn target_properties() -> TargetProperties
fn target_properties() -> TargetProperties
Returns the properties of the target hardware architecture.
Sourcefn enumerate_devices(type_id: u16) -> Vec<DeviceId>
fn enumerate_devices(type_id: u16) -> Vec<DeviceId>
Returns all devices available under the provided type id.
Provided Methods§
Sourcefn client(device: &Self::Device) -> Client
fn client(device: &Self::Device) -> Client
Retrieve the compute client from the runtime device, initializing the server on first use.
Sourcefn enumerate_all_devices() -> Vec<DeviceId>
fn enumerate_all_devices() -> Vec<DeviceId>
Returns all devices that can be handled by the runtime.
Sourcefn enumerate_devices_like(device_id: DeviceId) -> Vec<DeviceId>
fn enumerate_devices_like(device_id: DeviceId) -> Vec<DeviceId>
The devices of device_id’s own kind: its peers, and itself where the
machine has it.
enumerate_devices of its type, for a
runtime whose ids carry nothing more. One whose ids do answers from the
list that extra part names — a wgpu device pinned to a graphics API,
from that API’s, the same adapter on another being another device.
Sourcefn find_device(device_id: DeviceId) -> Result<(), usize>
fn find_device(device_id: DeviceId) -> Result<(), usize>
Whether this machine has the device device_id names — and where it
does not, how many of that kind it has instead.
What naming a device is checked against. The runtime’s “you choose” device names no hardware of its own, so it is there as soon as the runtime found anything of its kind.
Sourcefn is_available() -> bool
fn is_available() -> bool
Whether this machine has hardware worth choosing this runtime for.
What picking a default device walks, so the question is not “could this runtime run at all” but “would a caller who did not choose want it”. Enumerating a device is the answer for most runtimes; one that also exposes a software fallback answers no on a machine that has only that, leaving a native CPU runtime to claim it.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".