Skip to main content

Module device_policy

Module device_policy 

Source
Expand description

Backend allowlists, env-driven defaults, and selection introspection.

Structs§

DeviceCandidate
One row of backend introspection for UIs and logs.
DeviceFallbackError
Errors collected when every backend in the chain fails at run time.
DevicePolicy
Which backends a process may use — intersected with compile-time features and runtime availability.

Enums§

DevicePickStrategy
How [GraphDevices::resolve_with_inputs] picks a backend when no hint is set.

Functions§

device_chain_from_env
Ordered fallback chain from RLX_DEVICE_CHAIN (cuda,gpu,cpu).
device_chain_from_env_key
Read PREFIX_DEVICE_CHAIN.
device_from_env
Default device hint from RLX_DEVICE (or PREFIX_DEVICE via device_from_env_key).
device_from_env_key
Read PREFIX_DEVICE env var.
device_report
Explain which backends are viable for graph under policy.
devices_for_with_policy
Backends on this host that can lower graph, filtered by policy.
resolve_device
Resolve the backend to use: explicit hint → env → fastest for graph.
resolve_device_chain
First device in chain that is viable under policy for graph.
run_with_fallback
Try chain in order; return the first successful result from run.