pub struct WebGpuBackend { /* private fields */ }Expand description
CubeCL WebGPU tensor backend.
§Examples
use tenferro_gpu::webgpu::WebGpuBackend;
let _ctor: fn(usize) -> tenferro_tensor::Result<WebGpuBackend> = WebGpuBackend::new;The backend is not an operation route: the operations live on
[WebGpuExecSession], so the owner does not implement the operation traits.
fn requires_elementwise<B: tenferro_tensor::TensorElementwise>() {}
requires_elementwise::<tenferro_gpu::webgpu::WebGpuBackend>();Implementations§
Source§impl WebGpuBackend
impl WebGpuBackend
Sourcepub fn new(device_ordinal: usize) -> Result<Self>
pub fn new(device_ordinal: usize) -> Result<Self>
Initialize a WebGPU backend for a discrete GPU ordinal.
§Examples
use tenferro_gpu::webgpu::WebGpuBackend;
let _ctor: fn(usize) -> tenferro_tensor::Result<WebGpuBackend> = WebGpuBackend::new;§Errors
Returns crate::Error::RuntimeState when no adapter/device is
available, or crate::Error::BackendSource when CubeCL initialization
fails.
Sourcepub fn new_default() -> Result<Self>
pub fn new_default() -> Result<Self>
Initialize a WebGPU backend using CubeCL’s default adapter selection.
§Examples
use tenferro_gpu::webgpu::WebGpuBackend;
let _ctor: fn() -> tenferro_tensor::Result<WebGpuBackend> = WebGpuBackend::new_default;§Errors
Returns crate::Error::RuntimeState when default adapter selection
is unavailable, or crate::Error::BackendSource when initialization
fails.
Sourcepub fn from_runtime(runtime: WebGpuRuntime) -> Self
pub fn from_runtime(runtime: WebGpuRuntime) -> Self
Build a WebGPU backend from an initialized runtime.
§Examples
use tenferro_gpu::{webgpu::WebGpuBackend, webgpu::WebGpuRuntime};
let _from_runtime: fn(WebGpuRuntime) -> WebGpuBackend = WebGpuBackend::from_runtime;Sourcepub fn runtime(&self) -> &WebGpuRuntime
pub fn runtime(&self) -> &WebGpuRuntime
Return this backend’s WebGPU runtime.
§Examples
use tenferro_gpu::{webgpu::WebGpuBackend, webgpu::WebGpuRuntime};
let _runtime: fn(&WebGpuBackend) -> &WebGpuRuntime = WebGpuBackend::runtime;Sourcepub fn runtime_identity(&self) -> WebGpuRuntimeIdentity
pub fn runtime_identity(&self) -> WebGpuRuntimeIdentity
Return the opaque identity of this exact executable backend instance.
Clones of a backend return the same identity. Independently initialized backends return different identities even when they target the same WebGPU device ordinal. This also covers Apple-backed WebGPU runtimes.
§Examples
use tenferro_gpu::webgpu::WebGpuBackend;
let _identity = WebGpuBackend::runtime_identity;Sourcepub fn synchronize(&self) -> Result<()>
pub fn synchronize(&self) -> Result<()>
Block until queued WebGPU work completes.
§Examples
use tenferro_gpu::webgpu::WebGpuBackend;
let _sync: fn(&WebGpuBackend) -> tenferro_tensor::Result<()> = WebGpuBackend::synchronize;§Errors
Returns crate::Error::BackendSource when queue flush or
synchronization fails, or crate::Error::RuntimeState when the
runtime has lost its device state.
Trait Implementations§
impl BackendRuntimeCache for WebGpuBackend
Source§impl BackendSessionHost for WebGpuBackend
impl BackendSessionHost for WebGpuBackend
Source§fn with_backend_session<R: Send>(
&mut self,
f: impl FnOnce(&mut dyn BackendSession) -> R + Send,
) -> Result<R, SessionEntryError>
fn with_backend_session<R: Send>( &mut self, f: impl FnOnce(&mut dyn BackendSession) -> R + Send, ) -> Result<R, SessionEntryError>
f inside it. Read moreSource§impl Clone for WebGpuBackend
impl Clone for WebGpuBackend
Source§fn clone(&self) -> WebGpuBackend
fn clone(&self) -> WebGpuBackend
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WebGpuBackend
impl Debug for WebGpuBackend
Source§impl DotGeneralPreparation for WebGpuBackend
impl DotGeneralPreparation for WebGpuBackend
Source§fn prepare(
&self,
request: DotGeneralPrepareRequest<'_>,
) -> Result<PrepareCapability, PrepareError>
fn prepare( &self, request: DotGeneralPrepareRequest<'_>, ) -> Result<PrepareCapability, PrepareError>
impl TensorBackend for WebGpuBackend
Source§impl TensorDeviceTransfer for WebGpuBackend
impl TensorDeviceTransfer for WebGpuBackend
Source§fn download_to_host(&mut self, tensor: TensorRead<'_>) -> Result<Tensor>
fn download_to_host(&mut self, tensor: TensorRead<'_>) -> Result<Tensor>
Source§fn upload_host_tensor(&mut self, tensor: TensorRead<'_>) -> Result<Tensor>
fn upload_host_tensor(&mut self, tensor: TensorRead<'_>) -> Result<Tensor>
Auto Trait Implementations§
impl !RefUnwindSafe for WebGpuBackend
impl !UnwindSafe for WebGpuBackend
impl Freeze for WebGpuBackend
impl Send for WebGpuBackend
impl Sync for WebGpuBackend
impl Unpin for WebGpuBackend
impl UnsafeUnpin for WebGpuBackend
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
§impl<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T, U> Imply<T> for U
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