Skip to content

ggml-webgpu: fix workgroup dispatching for several ops#23750

Merged
reeselevine merged 1 commit into
ggml-org:masterfrom
yomaytk:fix-cpy
May 27, 2026
Merged

ggml-webgpu: fix workgroup dispatching for several ops#23750
reeselevine merged 1 commit into
ggml-org:masterfrom
yomaytk:fix-cpy

Conversation

@yomaytk
Copy link
Copy Markdown
Contributor

@yomaytk yomaytk commented May 27, 2026

Overview

This PR fixes how workgroups are dispatched for several ops.

  • cpy: Dispatching workgroups on a single dimension can be insufficient for the specified tensor size, so I changed it to use two dimensions. This fixes the bug described in the additional information section.
  • mul_mat_id_gather: A single dimension is sufficient for dispatching workgroups.
  • argsort, conv2d, im2col, upscale: Use compute_2d_workgroups to avoid dispatching extra workgroups.

I confirmed that test-backend-ops test for these ops passes.

Additional information

test-backend-ops perf -b WebGPU -o CPY failed with the following error at CPY(type_src=f32,type_dst=f32,ne_src=[786432,256,1,1],permute_src=[1,0,2,3],permute_dst=[0,0,0,0],_src_transpose=0).

ggml-webgpu.cpp:3832: ggml_webgpu: Device error! Reason: 2, Message: Dispatch workgroup count X (196608) exceeds max compute workgroups per dimension (65535).

This suggests that we need to dispatch more workgroups for cpy, although I'm not sure which models requires this.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES - I used AI for reviewing this change.

@yomaytk yomaytk requested a review from a team as a code owner May 27, 2026 01:31
@github-actions github-actions Bot added ggml changes relating to the ggml tensor library for machine learning WebGPU labels May 27, 2026
Copy link
Copy Markdown
Contributor

@reeselevine reeselevine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI failure was fixed in #23733

@reeselevine reeselevine merged commit c40006a into ggml-org:master May 27, 2026
35 of 36 checks passed
gabe-l-hart added a commit to gabe-l-hart/llama.cpp that referenced this pull request May 27, 2026
* origin/master:
hexagon: add support for Q4_1 in MUL_MAT and MUL_MAT_ID (ggml-org#23647)
ggml-webgpu: Fix how to dispatch WG to some ops (ggml-org#23750)
vulkan: Switch MUL_MAT_VEC to 4 K per iteration for F16/32 (ggml-org#22887)
vulkan: use GL_NV_cooperative_matrix_decode_vector for faster matmul (ggml-org#23541)
vulkan: add REPEAT op support for f16 to f16. (ggml-org#23298)
ci : move ARM jobs to self-hosted + disable kleidiai mac release (ggml-org#23780)
vendor : update cpp-httplib to 0.46.0 (ggml-org#23650)
pyproject : add conversion folder and update dependencies (ggml-org#23746)
CUDA: restrict PDL to CTK >= 12.3 due to MSVC issues (ggml-org#23742)
ci : bump cuda release to 13.3 (ggml-org#23749)
common : fix env names to all have LLAMA_ARG_ prefix (ggml-org#23778)
ci : fix windows ccaches (ggml-org#23777)
ci : remove wasm test (ggml-org#23733)
vulkan: avoid preferring transfer queue on AMD UMA devices (ggml-org#22455)
ci : add ccache to server builds + fix undefined sanitizer build (ggml-org#23763)
docs : fix duplicated "the" in granitevision and model-conversion docs (ggml-org#23767)
convert: add MiniCPM5 tokenizer support (ggml-org#23384)
server : fix the log message when using SSL (ggml-org#23393)
@yomaytk yomaytk deleted the fix-cpy branch May 27, 2026 22:52
adrianhoehne pushed a commit to adrianhoehne/llama.cpp that referenced this pull request May 28, 2026
fewtarius pushed a commit to fewtarius/llama.cpp that referenced this pull request May 30, 2026
turbo-tan pushed a commit to turbo-tan/llama.cpp-tq3 that referenced this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning WebGPU

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants