]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
ggml: Add initial WebGPU backend (#14521)
authorReese Levine <redacted>
Wed, 16 Jul 2025 15:18:51 +0000 (08:18 -0700)
committerGitHub <redacted>
Wed, 16 Jul 2025 15:18:51 +0000 (18:18 +0300)
commit21c021745d781edf9c44b4972ef6cbbf53b0ecff
tree59eb88544153b55aebfcb7542c4b3b3363d509a0
parentb0f0ecc3dce806c68609d375a2b3edc430d8db18
ggml: Add initial WebGPU backend (#14521)

* Minimal setup of webgpu backend with dawn. Just prints out the adapter and segfaults

* Initialize webgpu device

* Making progress on setting up the backend

* Finish more boilerplate/utility functions

* Organize file and work on alloc buffer

* Add webgpu_context to prepare for actually running some shaders

* Work on memset and add shader loading

* Work on memset polyfill

* Implement set_tensor as webgpu WriteBuffer, remove host_buffer stubs since webgpu doesn't support it

* Implement get_tensor and buffer_clear

* Finish rest of setup

* Start work on compute graph

* Basic mat mul working

* Work on emscripten build

* Basic WebGPU backend instructions

* Use EMSCRIPTEN flag

* Work on passing ci, implement 4d tensor multiplication

* Pass thread safety test

* Implement permuting for mul_mat and cpy

* minor cleanups

* Address feedback

* Remove division by type size in cpy op

* Fix formatting and add github action workflows for vulkan and metal (m-series) webgpu backends

* Fix name

* Fix macos dawn prefix path
14 files changed:
.github/workflows/build.yml
README.md
ci/run.sh
docs/build.md
ggml/CMakeLists.txt
ggml/include/ggml-webgpu.h [new file with mode: 0644]
ggml/src/CMakeLists.txt
ggml/src/ggml-backend-reg.cpp
ggml/src/ggml-webgpu/CMakeLists.txt [new file with mode: 0644]
ggml/src/ggml-webgpu/ggml-webgpu.cpp [new file with mode: 0644]
ggml/src/ggml-webgpu/wgsl-shaders/cpy.wgsl [new file with mode: 0644]
ggml/src/ggml-webgpu/wgsl-shaders/embed_wgsl.py [new file with mode: 0755]
ggml/src/ggml-webgpu/wgsl-shaders/memset.wgsl [new file with mode: 0644]
ggml/src/ggml-webgpu/wgsl-shaders/mul_mat.wgsl [new file with mode: 0644]