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/acc.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 / acc.comp` 37 lines ยท 1145 bytes Raw Blame History 1 #version 450 2 3 #include "types.glsl" 4 #include "generic_binary_head.glsl" 5 6 // false for SET, true for ACC 7 layout(constant_id = 1) const bool ACC = true; 8 9 layout(local_size_x = 512, local_size_y = 1, local_size_z = 1) in; 10 11 void main() { 12 const uint idx = gl_GlobalInvocationID.x; 13 if (idx >= p.ne) { 14 return; 15 } 16 17 const uint offset = p.param3; 18 const uint src1_i = idx - offset; 19 const uint i3 = src1_i / p.nb03; 20 const uint rem2 = src1_i - i3 * p.nb03; 21 const uint i2 = rem2 / p.nb02; 22 const uint rem1 = rem2 - i2 * p.nb02; 23 const uint i1 = rem1 / p.nb01; 24 const uint i0 = rem1 % p.nb01; 25 26 uint i00, i01, i02, i03; 27 28 if (i0 < p.ne10 && i1 < p.ne11 && i2 < p.ne12 && i3 < p.ne13) { 29 if (ACC) { 30 data_d[get_doffset() + idx] = D_TYPE(FLOAT_TYPE(data_a[get_aoffset() + idx]) + FLOAT_TYPE(data_b[get_boffset() + src1_idx(i0, i1, i2, i3)])); 31 } else { 32 data_d[get_doffset() + idx] = D_TYPE(FLOAT_TYPE(data_b[get_boffset() + src1_idx(i0, i1, i2, i3)])); 33 } 34 } else { 35 data_d[get_doffset() + idx] = D_TYPE(FLOAT_TYPE(data_a[get_aoffset() + idx])); 36 } 37 }