pub struct DeviceRouter { /* private fields */ }Expand description
Production helper: compile all viable backends up front, run with fallback chain.
Implementations§
Source§impl DeviceRouter
impl DeviceRouter
pub fn new(graph: Graph, policy: DevicePolicy) -> Result<DeviceRouter, String>
pub fn from_env(graph: Graph) -> Result<DeviceRouter, String>
pub fn with_rebench_on_throttle(self, enabled: bool) -> DeviceRouter
pub fn set_rebench_on_throttle(&mut self, enabled: bool)
pub fn runner(&self) -> &GraphDevices
pub fn runner_mut(&mut self) -> &mut GraphDevices
Sourcepub fn run_on(
&mut self,
device: Device,
inputs: &[(&str, &[f32])],
) -> Result<Vec<Vec<f32>>, String>
pub fn run_on( &mut self, device: Device, inputs: &[(&str, &[f32])], ) -> Result<Vec<Vec<f32>>, String>
Run on explicit device.
Sourcepub fn run(
&mut self,
inputs: &[(&str, &[f32])],
hint: Option<Device>,
) -> Result<(Device, Vec<Vec<f32>>), String>
pub fn run( &mut self, inputs: &[(&str, &[f32])], hint: Option<Device>, ) -> Result<(Device, Vec<Vec<f32>>), String>
Resolve hint / env / benchmark policy, then execute.
Sourcepub fn run_chain(
&mut self,
inputs: &[(&str, &[f32])],
hint: Option<Device>,
) -> Result<(Device, Vec<Vec<f32>>), DeviceFallbackError>
pub fn run_chain( &mut self, inputs: &[(&str, &[f32])], hint: Option<Device>, ) -> Result<(Device, Vec<Vec<f32>>), DeviceFallbackError>
Fallback chain (RLX_DEVICE_CHAIN or explicit).
pub fn set_param(&mut self, name: &str, data: &[f32])
pub fn set_param_typed(&mut self, name: &str, data: &[u8], dtype: DType)
pub fn devices(&self) -> Vec<&'static str>
Auto Trait Implementations§
impl !RefUnwindSafe for DeviceRouter
impl !Sync for DeviceRouter
impl !UnwindSafe for DeviceRouter
impl Freeze for DeviceRouter
impl Send for DeviceRouter
impl Unpin for DeviceRouter
impl UnsafeUnpin for DeviceRouter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more