Skip to content

Commit c09bfc5

Browse files
committed
Basic WebGPU backend instructions
1 parent b8a2207 commit c09bfc5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/build.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,23 @@ ninja
557557

558558
To read documentation for how to build on Android, [click here](./android.md)
559559

560+
## WebGPU [In Progress]
561+
562+
The WebGPU backend relies on [Dawn](https://dawn.googlesource.com/dawn). Follow the instructions [here](https://dawn.googlesource.com/dawn/+/refs/heads/main/docs/quickstart-cmake.md) to install Dawn locally so that llama.cpp can find it using CMake.
563+
564+
In the llama.cpp directory, build with CMake:
565+
566+
```
567+
cmake -B build -DGGML_WEBGPU=ON
568+
cmake --build build --config Release
569+
```
570+
571+
### Browser Support
572+
573+
WebGPU allows cross-platform access to the GPU from supported browsers. We utilize [Emscripten](https://emscripten.org/) to compile ggml's WebGPU backend to WebAssembly. Emscripten does not officially support WebGPU bindings yet, but Dawn currently maintains its own WebGPU bindings called emdawnwebgpu.
574+
575+
Follow the instructions [here](https://dawn.googlesource.com/dawn/+/refs/heads/main/src/emdawnwebgpu/) to download or build the emdawnwebgpu package (Note that it might be safer to build them locally, so that they stay in sync with the version of Dawn you have installed above). When building using CMake, the path to the emdawnwebgpu port file needs to be set with the flag `EMDAWNWEBGPU_DIR`.
576+
560577
## Notes about GPU-accelerated backends
561578

562579
The GPU may still be used to accelerate some parts of the computation even when using the `-ngl 0` option. You can fully disable GPU acceleration by using `--device none`.

0 commit comments

Comments
 (0)