Commit 01d577473 for llama.cpp
commit 01d577473735b0c34839bf3b15cceaf50323366a
Author: Masashi Yoshimura <yoshimura.masashi.frbs@gmail.com>
Date: Wed Dec 2 20:11:27 2026 +0900
webgpu: skip the expert slots with id -1 in mul_mat_scale (fix CI) (#33515)
diff --git a/ggml/src/ggml-webgpu/ggml-webgpu.cpp b/ggml/src/ggml-webgpu/ggml-webgpu.cpp
index 47eec2c11..f9ec34473 100644
--- a/ggml/src/ggml-webgpu/ggml-webgpu.cpp
+++ b/ggml/src/ggml-webgpu/ggml-webgpu.cpp
@@ -2229,19 +2229,19 @@ static webgpu_encoded_op ggml_webgpu_mul_mat_scale(webgpu_context & ctx, ggml_te
ggml_webgpu_shader_lib_context shader_lib_ctx = {};
shader_lib_ctx.max_wg_size = ctx->global_ctx->capabilities.limits.maxComputeInvocationsPerWorkgroup;
- webgpu_pipeline pipeline = ctx->shader_lib->get_mul_mat_scale_pipeline(shader_lib_ctx, per_expert);
+ webgpu_pipeline pipeline = ctx->shader_lib->get_mul_mat_scale_pipeline(shader_lib_ctx, ids != nullptr);
const size_t s_ts = ggml_type_size(scale->type);
const uint32_t n_rows = (uint32_t) (dst->ne[1] * dst->ne[2] * dst->ne[3]);
std::vector<uint32_t> params = {
(uint32_t) (ggml_webgpu_tensor_misalignment(ctx, scale) / s_ts),
- per_expert ? (uint32_t) (ggml_webgpu_tensor_misalignment(ctx, ids) / ggml_type_size(ids->type)) : 0,
+ ids ? (uint32_t) (ggml_webgpu_tensor_misalignment(ctx, ids) / ggml_type_size(ids->type)) : 0,
(uint32_t) (ggml_webgpu_tensor_misalignment(ctx, dst) / ggml_type_size(dst->type)),
per_channel ? (uint32_t) (scale->nb[0] / s_ts) : 0,
per_expert ? (uint32_t) ((per_channel_expert ? scale->nb[1] : scale->nb[0]) / s_ts) : 0,
- per_expert ? (uint32_t) (ids->nb[0] / ggml_type_size(ids->type)) : 0,
- per_expert ? (uint32_t) (ids->nb[1] / ggml_type_size(ids->type)) : 0,
+ ids ? (uint32_t) (ids->nb[0] / ggml_type_size(ids->type)) : 0,
+ ids ? (uint32_t) (ids->nb[1] / ggml_type_size(ids->type)) : 0,
(uint32_t) (dst->nb[1] / ggml_type_size(dst->type)),
(uint32_t) (dst->nb[2] / ggml_type_size(dst->type)),
(uint32_t) (dst->nb[3] / ggml_type_size(dst->type)),
@@ -2253,7 +2253,7 @@ static webgpu_encoded_op ggml_webgpu_mul_mat_scale(webgpu_context & ctx, ggml_te
std::vector<wgpu::BindGroupEntry> entries;
entries.push_back(ggml_webgpu_make_tensor_bind_group_entry(ctx, 0, scale));
- if (per_expert) {
+ if (ids) {
entries.push_back(ggml_webgpu_make_tensor_bind_group_entry(ctx, 1, ids));
}
entries.push_back(ggml_webgpu_make_tensor_bind_group_entry(ctx, entries.size(), dst));