Skip to main content

DeviceService

Trait DeviceService 

Source
pub trait DeviceService: Send + 'static {
    // Required methods
    fn init(device_id: DeviceId) -> Self;
    fn utilities(&self) -> Arc<dyn Any + Sync + Send> ;

    // Provided method
    fn stage() -> DeviceServiceStage { ... }
}
Expand description

Represent a service that runs on a device.

Required Methods§

Source

fn init(device_id: DeviceId) -> Self

Initializes the service. It is only called once per device.

Source

fn utilities(&self) -> Arc<dyn Any + Sync + Send>

Get the service utilities.

Provided Methods§

Source

fn stage() -> DeviceServiceStage

Which pipeline stage this service runs on.

Services on DeviceServiceStage::Upstream produce work ahead of time (e.g. autodiff graph construction, kernel fusion) that is consumed by DeviceServiceStage::Downstream services, which stream kernels to the device.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§