]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
ggml-webgpu: JIT compile binary operators and handle binding overlaps (#19310)
authorAbhijit Ramesh <redacted>
Fri, 6 Feb 2026 18:33:30 +0000 (10:33 -0800)
committerGitHub <redacted>
Fri, 6 Feb 2026 18:33:30 +0000 (10:33 -0800)
commit7fbd36c50c1a439a485486729faf20b47a0e6d8c
treeac1736813ca6445cf90cf33dcb7083568e50f2c9
parent537eadb1b9e664aa23bf19f7215c1876fc8e5fb9
ggml-webgpu: JIT compile binary operators and handle binding overlaps (#19310)

* ggml webgpu: port binary operators to use pre-wgsl

* Add binary.wgsl: unified shader with conditionals for all 4 ops

* Add gen_binary_shaders.cpp: build tool for using pre_wgsl preprocessor

* Remove bin_op.tmpl.wgsl and binary.wgsl (Python template)

* Update CMake to generate binary operator shaders at build time

* ggml-webgpu: migrate binary ops to JIT compilation with overlap handling

* port binary operators from AOT to pre-wgsl JIT compilation

* add src1=dst overlap handling for binary ops

* use compile-time workgroup size defines instead of runtime overrides

* ggml-webgpu: complete overlap handling for binary ops

* add support for inplace & overlap case in binding setup

* restructure conditional logic to handle all overlap cases

* ensure all buffer bindings are correctly assigned for edge cases

* ggml-webgpu: remove unused binary overlap cases

Remove src0==src1 binary overlap case that never occurs in practice.

* keep INPLACE (src0==dst), OVERLAP (src1==dst), DEFAULT

* remove unused src0==src1 and all-same variant

* refactor wgsl to eliminate duplication
ggml/src/ggml-webgpu/ggml-webgpu-shader-lib.hpp
ggml/src/ggml-webgpu/ggml-webgpu.cpp
ggml/src/ggml-webgpu/wgsl-shaders/bin_op.tmpl.wgsl [deleted file]
ggml/src/ggml-webgpu/wgsl-shaders/binary.wgsl [new file with mode: 0644]
ggml/src/ggml-webgpu/wgsl-shaders/binary_head.tmpl [deleted file]