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/glu_main.glsl # 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 / glu_main.glsl` 35 lines ยท 1417 bytes Raw Blame History 1 void main() { 2 const uint i = gl_GlobalInvocationID.z * 262144 + gl_GlobalInvocationID.y * 512 + gl_GlobalInvocationID.x; 3 4 if (i >= p.N) { 5 return; 6 } 7 8 const uint i23 = fastdiv(i, p.ne2_012mp, p.ne2_012L); 9 const uint i23_offset = i23 * p.ne22*p.ne21*p.ne20; 10 const uint i22 = fastdiv(i - i23_offset, p.ne2_01mp, p.ne2_01L); 11 const uint i22_offset = i22*p.ne21*p.ne20; 12 const uint i21 = fastdiv(i - i23_offset - i22_offset, p.ne2_0mp, p.ne2_0L); 13 const uint i20 = i - i23_offset - i22_offset - i21*p.ne20; 14 15 const uint src_idx_a = get_aoffset() + i23 * p.nb03 + i22 * p.nb02 + i21 * p.nb01 + i20 * p.nb00; 16 const uint src_idx_b = get_boffset() + i23 * p.nb13 + i22 * p.nb12 + i21 * p.nb11 + i20 * p.nb10; 17 const uint dst_idx = get_doffset() + i23 * p.nb23 + i22 * p.nb22 + i21 * p.nb21 + i20 * p.nb20; 18 19 if (p.mode == 0) { 20 // Default 21 const uint offset = (p.ne00 / 2) * p.nb00; 22 const uint idx = src_idx_a; 23 24 data_d[dst_idx] = D_TYPE(op(float(data_a[idx]), float(data_a[idx + offset]))); 25 } else if (p.mode == 1) { 26 // Swapped 27 const uint offset = (p.ne00 / 2) * p.nb00; 28 const uint idx = src_idx_a; 29 30 data_d[dst_idx] = D_TYPE(op(float(data_a[idx + offset]), float(data_a[idx]))); 31 } else { 32 // Split 33 data_d[dst_idx] = D_TYPE(op(float(data_a[src_idx_a]), float(data_b[src_idx_b]))); 34 } 35 }