Expand description
The wgpu runtime for Burn’s CubeCL backend: Vulkan, Metal, DirectX 12, OpenGL and WebGPU through one API.
Applications enable Burn’s wgpu feature and create a device with Device::wgpu(..), which
picks a graphics API for the platform, or configure it first with Device::wgpu_options().
The vulkan, metal and webgpu features add devices pinned to that API. Applications do not
need this crate directly.
This crate also re-exports the wgpu runtime types (WgpuDevice, WgpuSetup,
MemoryConfiguration, …) for sharing an existing wgpu device with Burn, and, with the
template feature, the API for launching hand-written WGSL kernels.
§Feature flags
std(default): standard library support.fusion(default): kernel fusion.autotune(default): benchmark kernel variants at runtime and keep the fastest.vulkan,metal,webgpu: devices pinned to that graphics API, using its native shader compiler where available.template: launch hand-written kernels.exclusive-memory-only: never share a memory page between allocations (always the case on wasm).tracing: instrument operations with thetracingcrate.
Re-exports§
pub use wgpu;
Modules§
Structs§
- Cube
Backend - Tensor backend that compiles just-in-time for whichever runtime its device names.
- CubeDim
- The number of units across all 3 axis totalling to the number of working units in a cube.
- Cube
Tensor - The basic tensor primitive struct.
- Runtime
Options - The values that control how a WGPU Runtime will perform its calculations.
- Wgpu
Device - The device struct when using the
wgpubackend. - Wgpu
Resource - The memory resource that can be allocated for wgpu.
- Wgpu
Runtime - Runtime that uses the wgpu crate.
- Wgpu
Setup - A complete setup used to run wgpu.
- Wgpu
Storage - Buffer storage for wgpu.
- flex32
- A floating point type with relaxed precision, minimum
f16, maxf32.
Enums§
- Auto
Compiler - Compiler that dispatches to the most appropriate shader language backend for the active
wgpubackend. - Memory
Configuration - High level configuration of memory management.
- Wgpu
Backend - The graphics API a
WgpuDevicecomes up on, which also settles the shader compiler it is fed: SPIR-V on Vulkan, MSL on Metal, WGSL elsewhere. - Wgpu
Init Error - A recoverable failure while acquiring or registering a wgpu runtime.
Traits§
- Bool
Element - The element type for booleans for the jit backend.
- Float
Element - The float element type for the jit backend.
- IntElement
- The int element type for the jit backend.
Functions§
- init_
device - Create a
WgpuDeviceon an existingWgpuSetup. Useful when you want to share a device betweenCubeCLand other wgpu-dependent libraries. - init_
device_ with_ api - Import a setup with an explicitly selected graphics API.
- init_
setup - Like
init_setup_async, but synchronous. On wasm, it is necessary to useinit_setup_asyncinstead. - init_
setup_ async - Initialize a client on the given device with the given options. This function is useful to configure the runtime options or to pick a different graphics API.
- try_
init_ device - Register an existing setup without changing its enabled GPU capabilities.
- try_
init_ device_ with_ api - Register an existing setup with an explicitly selected graphics API.
- try_
init_ setup Non- target_family=wasm - Fallible synchronous initialization. Use
try_init_setup_asyncon wasm. - try_
init_ setup_ async - Initialize the selected runtime, returning acquisition or registration failures.
Type Aliases§
- Wgpu
- Tensor backend that uses the wgpu crate for executing GPU compute shaders.