interplane.Get Omega
Read in your language

ggml

[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)

Brought by drakestapleton

branch master Branches Tags History

ggml / src / ggml-vulkan / vulkan-shaders / count_equal.comp

31 lines · 796 bytes Raw Blame History
1#version 450
2
3#extension GL_EXT_control_flow_attributes : enable
4
5#include "types.glsl"
6#include "generic_head.glsl"
7
8layout(local_size_x_id = 0, local_size_y = 1, local_size_z = 1) in;
9
10layout (binding = 0) readonly buffer X {A_TYPE data_a[];};
11layout (binding = 1) readonly buffer Y {B_TYPE data_b[];};
12layout (binding = 2) buffer D {D_TYPE data_d[];};
13
14const uint CHUNK_SIZE = 512;
15
16void main() {
17 const uint base = gl_WorkGroupID.x * CHUNK_SIZE;
18 const uint col = gl_LocalInvocationID.x;
19
20 uint count = 0;
21 [[unroll]]
22 for (uint i = 0; i < CHUNK_SIZE; i += gl_WorkGroupSize.x) {
23 const uint idx = base + i + col;
24 if (idx >= p.KX) {
25 break;
26 }
27 count += uint(data_a[idx] == data_b[idx]);
28 }
29
30 atomicAdd(data_d[0], D_TYPE(count));
31}