Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/ggml/blob/master/src/ggml-vulkan/vulkan-shaders/count_equal.comp # ggml [Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers 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 8 layout(local_size_x_id = 0, local_size_y = 1, local_size_z = 1) in; 9 10 layout (binding = 0) readonly buffer X {A_TYPE data_a[];}; 11 layout (binding = 1) readonly buffer Y {B_TYPE data_b[];}; 12 layout (binding = 2) buffer D {D_TYPE data_d[];}; 13 14 const uint CHUNK_SIZE = 512; 15 16 void 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 }