pub enum WgpuDeviceKind {
DiscreteGpu(usize),
IntegratedGpu(usize),
VirtualGpu(usize),
Cpu,
DefaultDevice,
Existing(u32),
Other(usize),
}Expand description
Which of a machine’s wgpu devices, leaving the graphics API aside.
Variants§
DiscreteGpu(usize)
Discrete GPU with the given index. The index is the index of the discrete GPU in the list of all discrete GPUs found on the system.
IntegratedGpu(usize)
Integrated GPU with the given index. The index is the index of the integrated GPU in the list of all integrated GPUs found on the system.
VirtualGpu(usize)
Virtual GPU with the given index. The index is the index of the virtual GPU in the list of all virtual GPUs found on the system.
Cpu
CPU — a software rasterizer such as lavapipe, llvmpipe or WARP.
DefaultDevice
The best available device found with the current graphics API.
This will prioritize GPUs wgpu recognizes as “high power”. Additionally, you can override this using
the CUBECL_WGPU_DEFAULT_DEVICE environment variable. This variable is spelled as if i was a WgpuDevice,
so for example CUBECL_WGPU_DEFAULT_DEVICE=IntegratedGpu(1) or CUBECL_WGPU_DEFAULT_DEVICE=Cpu
Existing(u32)
Use an externally created, existing, wgpu setup. This is helpful when using CubeCL in conjunction
with some existing wgpu setup (eg. egui or bevy), as resources can be transferred in & out of CubeCL.
The graphics API came up with the setup, so pinning one on top of this means nothing and is not encoded.
§Notes
This can be initialized with init_device in the wgpu runtime.
Other(usize)
An adapter wgpu recognizes but does not classify — what it reports as
DeviceType::Other, which OpenGL drivers often do. Indexed among
its own kind like the rest.
Implementations§
Source§impl WgpuDeviceKind
impl WgpuDeviceKind
Sourcepub const MAX_INDEX: usize
pub const MAX_INDEX: usize
The largest index that survives a round trip through a DeviceId.
The graphics API rides in the top three bits of the index, leaving thirteen — far more adapters of one kind than a machine has. A larger index is kept at this one rather than wrapped: wrapped, it lands on a device that exists; kept here, it names one no machine has, and naming it is refused.
Trait Implementations§
Source§impl Clone for WgpuDeviceKind
impl Clone for WgpuDeviceKind
Source§impl Debug for WgpuDeviceKind
impl Debug for WgpuDeviceKind
Source§impl Default for WgpuDeviceKind
impl Default for WgpuDeviceKind
impl Eq for WgpuDeviceKind
Source§impl From<WgpuDeviceKind> for WgpuDevice
impl From<WgpuDeviceKind> for WgpuDevice
Source§fn from(kind: WgpuDeviceKind) -> Self
fn from(kind: WgpuDeviceKind) -> Self
Source§impl Hash for WgpuDeviceKind
impl Hash for WgpuDeviceKind
Source§impl PartialEq for WgpuDeviceKind
impl PartialEq for WgpuDeviceKind
impl StructuralPartialEq for WgpuDeviceKind
Auto Trait Implementations§
impl Freeze for WgpuDeviceKind
impl RefUnwindSafe for WgpuDeviceKind
impl Send for WgpuDeviceKind
impl Sync for WgpuDeviceKind
impl Unpin for WgpuDeviceKind
impl UnsafeUnpin for WgpuDeviceKind
impl UnwindSafe for WgpuDeviceKind
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
Source§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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