WebGPU API ↗ 允许您直接从 JavaScript 使用 GPU。
WebGPU API 仅可从 Durable Objects 内访问。您无法从 Workers 内使用 WebGPU API。
要在本地开发中使用 WebGPU API,请在 Durable Object 的 Wrangler 配置文件 中启用 experimental 和 webgpu 兼容性标志。
compatibility_flags = ["experimental", "webgpu"]以下 WebGPU API 子集可从 Durable Objects 内使用:
以下 WebGPU API 子集尚不支持:
- workers-wonnx ↗ — 通过 WebGPU API 在 GPU 上运行图像分类,使用 wonnx ↗ 模型推理运行时。