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 / dequant_tq1_0.comp
| 1 | #version 450 |
| 2 | |
| 3 | #include "dequant_head.glsl" |
| 4 | |
| 5 | layout (local_size_x = 256, local_size_y = 1, local_size_z = 1) in; |
| 6 | |
| 7 | layout (binding = 0) readonly buffer A {block_tq1_0 data_a[];}; |
| 8 | layout (binding = 1) writeonly buffer D {D_TYPE data_b[];}; |
| 9 | |
| 10 | void main() { |
| 11 | const uint i = gl_GlobalInvocationID.x * 4; |
| 12 | |
| 13 | if (i >= p.nel) { |
| 14 | return; |
| 15 | } |
| 16 | |
| 17 | const uint ib = i / QUANT_K_TQ1_0; |
| 18 | const float d = float(data_a[ib].d); |
| 19 | |
| 20 | [[unroll]] for (uint j = 0; j < 4 && (i + j) < p.nel; ++j) { |
| 21 | const uint e = (i + j) % QUANT_K_TQ1_0; |
| 22 | const uint bidx = tq1_0_byte_of(e); |
| 23 | const uint qbyte = uint(bidx < 48u ? data_a[ib].qs[bidx] |
| 24 | : data_a[ib].qh[bidx - 48u]); |
| 25 | const uint xi = tq1_0_trit(qbyte, tq1_0_digit_of(e)); |
| 26 | data_b[i + j] = D_TYPE(d * (float(xi) - 1.0f)); |
| 27 | } |
| 28 | } |