Skip to content

Commit b8c1126

Browse files
authored
ggml webgpu: Fix bug in dispatching large matrix-vector multiplication (ggml-org#19535)
* Fix bug in dispatching large matrix-vector multiplication
1 parent 51ea5d8 commit b8c1126

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

ggml/src/ggml-webgpu/ggml-webgpu.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,8 @@ static webgpu_command ggml_webgpu_mul_mat(webgpu_context & ctx,
11211121
uint32_t batches = dst->ne[2] * dst->ne[3];
11221122
uint32_t output_groups = CEIL_DIV(dst->ne[0], decisions->outputs_per_wg);
11231123
uint32_t total_wg = output_groups * batches;
1124-
wg_x = total_wg % ctx->global_ctx->capabilities.limits.maxComputeWorkgroupsPerDimension;
1124+
// TODO: split large sizes into multiple batches to avoid way over-provisioning workgroups
1125+
wg_x = std::min(total_wg, ctx->global_ctx->capabilities.limits.maxComputeWorkgroupsPerDimension);
11251126
wg_y = CEIL_DIV(total_wg, ctx->global_ctx->capabilities.limits.maxComputeWorkgroupsPerDimension);
11261127
} else if (use_fast) {
11271128
auto decisions = static_cast<ggml_webgpu_mul_mat_shader_decisions *>(pipeline.context.get());

0 commit comments

Comments
 (0)