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/tri.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 / tri.comp` 42 lines ยท 1359 bytes Raw Blame History 1 #version 450 2 3 #include "types.glsl" 4 #include "generic_unary_head.glsl" 5 6 #define GGML_TRI_TYPE_UPPER_DIAG 0 7 #define GGML_TRI_TYPE_UPPER 1 8 #define GGML_TRI_TYPE_LOWER_DIAG 2 9 #define GGML_TRI_TYPE_LOWER 3 10 11 layout(local_size_x = 512, local_size_y = 1, local_size_z = 1) in; 12 13 void main() { 14 const uint idx = get_idx(); 15 16 if (idx >= p.ne) { 17 return; 18 } 19 20 const uint i03 = fastdiv(idx, p.ne0_012mp, fastdiv_L(p.ne0_Ls, 0)); 21 const uint i03_offset = i03 * p.ne02*p.ne01*p.ne00; 22 const uint i02 = fastdiv(idx - i03_offset, p.ne0_01mp, fastdiv_L(p.ne0_Ls, 1)); 23 const uint i02_offset = i02*p.ne01*p.ne00; 24 const uint i01 = fastdiv(idx - i03_offset - i02_offset, p.ne0_0mp, fastdiv_L(p.ne0_Ls, 2)); 25 const uint i00 = idx - i03_offset - i02_offset - i01*p.ne00; 26 27 int param = floatBitsToInt(p.param1); 28 bool pass = false; 29 switch (param) { 30 case GGML_TRI_TYPE_UPPER_DIAG: pass = i00 >= i01; break; 31 case GGML_TRI_TYPE_UPPER: pass = i00 > i01; break; 32 case GGML_TRI_TYPE_LOWER_DIAG: pass = i00 <= i01; break; 33 case GGML_TRI_TYPE_LOWER: pass = i00 < i01; break; 34 } 35 36 if (pass) { 37 const float val = float(data_a[get_aoffset() + src0_idx(idx)]); 38 data_d[get_doffset() + dst_idx(idx)] = D_TYPE(val); 39 } else { 40 data_d[get_doffset() + dst_idx(idx)] = D_TYPE(0); 41 } 42 }