jeffbolznv commited on
Commit
8f5eeb8
·
1 Parent(s): 26a670b

vulkan: fix group_norm (llama/10496)

Browse files

Fix bad calculation of the end of the range. Add a backend test that
covers the bad case (taken from stable diffusion).

Fixes https://github.com/leejet/stable-diffusion.cpp/issues/439.

ggml/src/ggml-vulkan/ggml-vulkan.cpp CHANGED
@@ -7157,7 +7157,7 @@ static void ggml_vk_check_results_0(ggml_tensor * tensor) {
7157
  const int32_t max_period = tensor->op_params[1];
7158
  tensor_clone = ggml_timestep_embedding(ggml_ctx, src0_clone, dim, max_period);
7159
  } else if (tensor->op == GGML_OP_POOL_2D) {
7160
- enum ggml_op_pool op = static_cast<ggml_op_pool>(dst->op_params[0]);
7161
  const int32_t k0 = tensor->op_params[1];
7162
  const int32_t k1 = tensor->op_params[2];
7163
  const int32_t s0 = tensor->op_params[3];
 
7157
  const int32_t max_period = tensor->op_params[1];
7158
  tensor_clone = ggml_timestep_embedding(ggml_ctx, src0_clone, dim, max_period);
7159
  } else if (tensor->op == GGML_OP_POOL_2D) {
7160
+ enum ggml_op_pool op = static_cast<ggml_op_pool>(tensor->op_params[0]);
7161
  const int32_t k0 = tensor->op_params[1];
7162
  const int32_t k1 = tensor->op_params[2];
7163
  const int32_t s0 = tensor->op_params[3];
ggml/src/ggml-vulkan/vulkan-shaders/group_norm.comp CHANGED
@@ -19,7 +19,7 @@ void main() {
19
 
20
  const uint tid = gl_LocalInvocationID.x;
21
  const uint start = gl_WorkGroupID.x * group_size + tid;
22
- const uint end = start + group_size;
23
 
24
  tmp[tid] = 0.0f;
25
 
 
19
 
20
  const uint tid = gl_LocalInvocationID.x;
21
  const uint start = gl_WorkGroupID.x * group_size + tid;
22
+ const uint end = (gl_WorkGroupID.x + 1) * group_size;
23
 
24
  tmp[tid] = 0.0f;
25