Skip to main content

Crate burn_wgpu

Crate burn_wgpu 

Source
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 the tracing crate.

Re-exports§

pub use wgpu;

Modules§

graphics

Structs§

CubeBackend
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.
CubeTensor
The basic tensor primitive struct.
RuntimeOptions
The values that control how a WGPU Runtime will perform its calculations.
WgpuDevice
The device struct when using the wgpu backend.
WgpuResource
The memory resource that can be allocated for wgpu.
WgpuRuntime
Runtime that uses the wgpu crate.
WgpuSetup
A complete setup used to run wgpu.
WgpuStorage
Buffer storage for wgpu.
flex32
A floating point type with relaxed precision, minimum f16, max f32.

Enums§

AutoCompiler
Compiler that dispatches to the most appropriate shader language backend for the active wgpu backend.
MemoryConfiguration
High level configuration of memory management.
WgpuBackend
The graphics API a WgpuDevice comes up on, which also settles the shader compiler it is fed: SPIR-V on Vulkan, MSL on Metal, WGSL elsewhere.
WgpuInitError
A recoverable failure while acquiring or registering a wgpu runtime.

Traits§

BoolElement
The element type for booleans for the jit backend.
FloatElement
The float element type for the jit backend.
IntElement
The int element type for the jit backend.

Functions§

init_device
Create a WgpuDevice on an existing WgpuSetup. Useful when you want to share a device between CubeCL and 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 use init_setup_async instead.
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_setupNon-target_family=wasm
Fallible synchronous initialization. Use try_init_setup_async on 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.