pub struct WgpuContext {
pub instance: Instance,
pub adapter: Adapter,
pub device: Arc<Device>,
pub queue: Arc<Queue>,
pub pool: Arc<BufferPool>,
}Expand description
A GPU device, its queue and a buffer pool shared by tensors.
Fields§
§instance: InstanceThe wgpu instance the adapter came from.
adapter: AdapterThe physical GPU.
device: Arc<Device>Logical device; requested with the adapter’s full limits.
queue: Arc<Queue>Queue that every kernel dispatch is submitted to.
pool: Arc<BufferPool>Pool that UnifiedTensor::empty draws from.
Implementations§
Source§impl WgpuContext
impl WgpuContext
Sourcepub async fn new_with_options(
power_preference: PowerPreference,
force_fallback_adapter: bool,
) -> Self
pub async fn new_with_options( power_preference: PowerPreference, force_fallback_adapter: bool, ) -> Self
Opens an adapter with the given power preference, optionally forcing the software fallback adapter.
§Panics
Panics if no adapter or device is available.
Sourcepub fn adapter_info(&self) -> String
pub fn adapter_info(&self) -> String
Adapter name and backend, e.g. "Apple M2 (Metal)".
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for WgpuContext
impl !UnwindSafe for WgpuContext
impl Freeze for WgpuContext
impl Send for WgpuContext
impl Sync for WgpuContext
impl Unpin for WgpuContext
impl UnsafeUnpin for WgpuContext
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