Documentation
¶
Rendered for windows/amd64
Overview ¶
Package webgpu provides the WebGPU backend for GPU-accelerated tensor operations.
WebGPU is a cross-platform graphics and compute API that works on:
- Windows (via Dawn/D3D12)
- macOS (via Dawn/Metal)
- Linux (via Dawn/Vulkan)
- Web browsers (via wasm)
Example:
import (
"github.com/born-ml/born/autodiff"
"github.com/born-ml/born/backend/webgpu"
"github.com/born-ml/born/tensor"
)
func main() {
gpu, err := webgpu.New()
if err != nil {
log.Fatal(err)
}
defer gpu.Release()
backend := autodiff.New(gpu)
x := tensor.Randn[float32](tensor.Shape{1024, 1024}, backend)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAvailable ¶
func IsAvailable() bool
IsAvailable checks if WebGPU is available on the current system.
This function attempts to initialize a WebGPU adapter to verify that a compatible GPU and drivers are present. It's useful for graceful fallback to CPU backend when GPU is not available.
Example:
if webgpu.IsAvailable() {
gpu, _ := webgpu.New()
backend = autodiff.New(gpu)
} else {
backend = autodiff.New(cpu.New())
}
Types ¶
type Backend ¶
type Backend = internalwebgpu.Backend
Backend represents the WebGPU backend implementation for GPU-accelerated tensor operations.
Click to show internal directories.
Click to hide internal directories.