pub enum DispatchDevice {
Flex(FlexDevice),
}Expand description
Represents a device for the Dispatch.
Each variant corresponds to a backend that the Dispatch can dispatch operations to.
§Example
use burn::DispatchDevice;
// One variant covers every cubecl runtime; the device inside says which.
#[cfg(feature = "cuda")]
let cuda_device = DispatchDevice::Cube(cubecl::Device::Cuda(Default::default()));
#[cfg(feature = "flex")]
let flex_device = DispatchDevice::Flex(Default::default());Variants§
Implementations§
Source§impl DispatchDevice
impl DispatchDevice
Sourcepub fn fusion_worker(&self) -> Option<DeviceId>
pub fn fusion_worker(&self) -> Option<DeviceId>
The id of the worker this device’s fusion server runs on, or None when its operations do
not go through one.
This is the runtime device’s own id, not the one this device reports through
Device::to_id, which encodes the dispatch variant into its
type. A DeviceHandle opened with it shares the fusion
server’s queue, so a task submitted there runs between the operations registered before
and after it. An autodiff device answers for the device it wraps. A device group answers
None: each of its members has a fusion server of its own.
Trait Implementations§
Source§impl Clone for DispatchDevice
impl Clone for DispatchDevice
Source§impl Debug for DispatchDevice
impl Debug for DispatchDevice
Source§impl Default for DispatchDevice
impl Default for DispatchDevice
Source§fn default() -> Self
fn default() -> Self
Select an enabled backend in this order: CUDA, Metal, ROCm, Vulkan, WebGPU,
wgpu, CPU, Flex, Remote. BURN_DEVICE overrides this in
std builds. Capture devices must be constructed explicitly.
The metal, vulkan, and webgpu overrides require their matching Cargo features
and pin the graphics API. Explicit Metal selection requires native MSL support.
The wgpu override keeps automatic API and compiler selection with WGSL fallback.
Panics when no execution backend is enabled, or when BURN_DEVICE names an unknown
backend or one whose Cargo feature is not enabled.
Source§impl Device for DispatchDevice
impl Device for DispatchDevice
Source§impl DeviceOps for DispatchDevice
impl DeviceOps for DispatchDevice
impl Eq for DispatchDevice
Source§impl From<FlexDevice> for DispatchDevice
Available on crate feature flex only.
impl From<FlexDevice> for DispatchDevice
flex only.Source§fn from(device: FlexDevice) -> Self
fn from(device: FlexDevice) -> Self
Auto Trait Implementations§
impl Freeze for DispatchDevice
impl RefUnwindSafe for DispatchDevice
impl Send for DispatchDevice
impl Sync for DispatchDevice
impl Unpin for DispatchDevice
impl UnsafeUnpin for DispatchDevice
impl UnwindSafe for DispatchDevice
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> ⓘ
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> ⓘ
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