pub enum Device {
Cpu,
Wgpu(Arc<WgpuContext>),
}Expand description
Where a tensor lives and where its ops execute.
Variants§
Cpu
Reference implementation used for testing and verification.
Wgpu(Arc<WgpuContext>)
Production backend: WebGPU via wgpu (Vulkan/Metal/D3D12/Browser).
Implementations§
Source§impl Device
impl Device
Sourcepub fn wgpu() -> Result<Device>
pub fn wgpu() -> Result<Device>
Create the default WebGPU device (highest-performance adapter).
Sync facade — native only; on wasm use Device::wgpu_async.
Sourcepub async fn wgpu_async() -> Result<Device>
pub async fn wgpu_async() -> Result<Device>
Async device creation — the primary form (roadmap v4, pitfall 14); works on native and wasm32/browser.
Sourcepub fn max_binding_bytes(&self) -> usize
pub fn max_binding_bytes(&self) -> usize
Largest single buffer binding this device supports, in bytes. Large weights (GPT-2’s wte) are row-chunked to stay under this.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Device
impl !UnwindSafe for Device
impl Freeze for Device
impl Send for Device
impl Sync for Device
impl Unpin for Device
impl UnsafeUnpin for Device
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
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> 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