ggml
[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)
Brought by drakestapleton
ggml / src / ggml-vulkan / vulkan-shaders / diag.comp
| 1 | #version 450 |
| 2 | |
| 3 | #include "types.glsl" |
| 4 | #include "generic_unary_head.glsl" |
| 5 | |
| 6 | layout(local_size_x = 512, local_size_y = 1, local_size_z = 1) in; |
| 7 | |
| 8 | void main() { |
| 9 | const uint idx = get_idx(); |
| 10 | |
| 11 | if (idx >= p.ne) { |
| 12 | return; |
| 13 | } |
| 14 | |
| 15 | const uint i13 = fastdiv(idx, p.ne1_012mp, fastdiv_L(p.ne1_Ls, 0)); |
| 16 | const uint i13_offset = i13 * p.ne12*p.ne11*p.ne10; |
| 17 | const uint i12 = fastdiv(idx - i13_offset, p.ne1_01mp, fastdiv_L(p.ne1_Ls, 1)); |
| 18 | const uint i12_offset = i12*p.ne11*p.ne10; |
| 19 | const uint i11 = fastdiv(idx - i13_offset - i12_offset, p.ne1_0mp, fastdiv_L(p.ne1_Ls, 2)); |
| 20 | const uint i10 = idx - i13_offset - i12_offset - i11*p.ne10; |
| 21 | |
| 22 | if (i10 == i11) { |
| 23 | const float val = float(data_a[get_aoffset() + i13*p.nb03 + i12*p.nb02 + 0*p.nb01 + i10*p.nb00]); |
| 24 | data_d[get_doffset() + dst_idx(idx)] = D_TYPE(val); |
| 25 | } else { |
| 26 | data_d[get_doffset() + dst_idx(idx)] = D_TYPE(0); |
| 27 | } |
| 28 | } |