本页还没有译文
本页 13 段还没译成Español,下面显示的是英文原文。WebGPU
还没翻译译自英文(developers.cloudflare.com)本页 13 段都还没译
Caution
The WebGPU API is only available in local development. You cannot deploy Durable Objects to Cloudflare that rely on the WebGPU API. See Workers AI for information on running machine learning models on the GPUs in Cloudflare's global network.
The WebGPU API allows you to use the GPU directly from JavaScript.
The WebGPU API is only accessible from within Durable Objects. You cannot use the WebGPU API from within Workers.
To use the WebGPU API in local development, enable the experimental and webgpu compatibility flags in the Wrangler configuration file of your Durable Object.
compatibility_flags = ["experimental", "webgpu"]
The following subset of the WebGPU API is available from within Durable Objects:
The following subset of the WebGPU API is not yet supported:
| API | Supported? | Notes |
|---|---|---|
GPU.getPreferredCanvasFormat | ||
GPURenderBundle | ||
GPURenderBundleEncoder | ||
GPURenderPassEncoder | ||
GPURenderPipeline | ||
GPUShaderModule | ||
GPUTexture | ||
GPUTextureView | ||
GPUExternalTexture |
Examples
- workers-wonnx — Image classification, running on a GPU via the WebGPU API, using the wonnx model inference runtime.