ggml-webgpu: compute pass batching and removing profiling overhead#21873
Merged
ggerganov merged 13 commits intoggml-org:masterfrom Apr 16, 2026
Merged
ggml-webgpu: compute pass batching and removing profiling overhead#21873ggerganov merged 13 commits intoggml-org:masterfrom
ggerganov merged 13 commits intoggml-org:masterfrom
Conversation
CISC
approved these changes
Apr 15, 2026
Contributor
Author
|
@ggml-org/maintainers another review please :) |
cnsiva
pushed a commit
to saas-home/llama.cpp
that referenced
this pull request
Apr 17, 2026
…gml-org#21873) * Update register tiling matmul to use f32 accumulation * fix profiling code * Fix register tiling matmul for chrome, i'm blaming dawn * Update batch tuning value for iOS * compile fix * Fix use of new load function * Move to a single query set for GPU profiling * Move to batching compute passes when not profiling * Refactor build_multi * remove iOS throttling now that we're batching compute passes
mengqin
pushed a commit
to mengqin/llama.cpp
that referenced
this pull request
Apr 20, 2026
…gml-org#21873) * Update register tiling matmul to use f32 accumulation * fix profiling code * Fix register tiling matmul for chrome, i'm blaming dawn * Update batch tuning value for iOS * compile fix * Fix use of new load function * Move to a single query set for GPU profiling * Move to batching compute passes when not profiling * Refactor build_multi * remove iOS throttling now that we're batching compute passes
ArberSephirotheca
pushed a commit
to ArberSephirotheca/llama.cpp
that referenced
this pull request
Apr 21, 2026
…gml-org#21873) * Update register tiling matmul to use f32 accumulation * fix profiling code * Fix register tiling matmul for chrome, i'm blaming dawn * Update batch tuning value for iOS * compile fix * Fix use of new load function * Move to a single query set for GPU profiling * Move to batching compute passes when not profiling * Refactor build_multi * remove iOS throttling now that we're batching compute passes
arthw
pushed a commit
to arthw/llama.cpp
that referenced
this pull request
Apr 23, 2026
…gml-org#21873) * Update register tiling matmul to use f32 accumulation * fix profiling code * Fix register tiling matmul for chrome, i'm blaming dawn * Update batch tuning value for iOS * compile fix * Fix use of new load function * Move to a single query set for GPU profiling * Move to batching compute passes when not profiling * Refactor build_multi * remove iOS throttling now that we're batching compute passes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Per https://bugs.webkit.org/show_bug.cgi?id=311598, it seems like lots of individual compute passes can cause issues on some WebGPU implementations. This PR batches multiple operations into the same compute pass, which does seem to be stable and allows for much faster decode speeds on Safari and iOS devices (30-54 t/s for small models and q4-ish quantizations). Performance doesn't change significantly on other devices or browsers, from what I've seen.
Along with this change, I fixed the overhead of WebGPU profiling by creating a single query set which records all timestamps, and is only mapped once at the end of each forward pass of the model. Unfortunately, timestamps only work at the boundaries of compute passes, so when profiling is enabled, we do not batch compute passes. This means that profiling won't work on iOS right now, but I think that's a reasonable trade-off.
Requirements