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_q6_k.comp
| 1 | #version 450 |
| 2 | |
| 3 | #include "dequant_head.glsl" |
| 4 | |
| 5 | layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; |
| 6 | |
| 7 | layout (binding = 0) readonly buffer A {A_TYPE data_a[];}; |
| 8 | layout (binding = 1) writeonly buffer D {D_TYPE data_b[];}; |
| 9 | |
| 10 | void main() { |
| 11 | [[unroll]] for (uint wgy = 0; wgy < 256; wgy++) { |
| 12 | const uint i = gl_WorkGroupID.x * 256 + wgy; |
| 13 | if (i >= p.nel / QUANT_K) { |
| 14 | return; |
| 15 | } |
| 16 | const uint tid = gl_LocalInvocationID.x; |
| 17 | const uint ip = tid / 32; |
| 18 | const uint il = tid - 32 * ip; |
| 19 | const uint is = 8 * ip + il / 16; |
| 20 | |
| 21 | const uint y_idx = i * QUANT_K + 128 * ip + il; |
| 22 | |
| 23 | const uint ql_idx = 64 * ip + il; |
| 24 | const uint8_t qh = data_a[i].qh[32 * ip + il]; |
| 25 | |
| 26 | const FLOAT_TYPE d = FLOAT_TYPE(data_a[i].d); |
| 27 | |
| 28 | data_b[y_idx + 0] = D_TYPE(d * FLOAT_TYPE(data_a[i].scales[is + 0] * (int8_t((data_a[i].ql[ql_idx + 0] & 0xF) | (((qh >> 0) & 3) << 4)) - 32))); |
| 29 | data_b[y_idx + 32] = D_TYPE(d * FLOAT_TYPE(data_a[i].scales[is + 2] * (int8_t((data_a[i].ql[ql_idx + 32] & 0xF) | (((qh >> 2) & 3) << 4)) - 32))); |
| 30 | data_b[y_idx + 64] = D_TYPE(d * FLOAT_TYPE(data_a[i].scales[is + 4] * (int8_t((data_a[i].ql[ql_idx + 0] >> 4) | (((qh >> 4) & 3) << 4)) - 32))); |
| 31 | data_b[y_idx + 96] = D_TYPE(d * FLOAT_TYPE(data_a[i].scales[is + 6] * (int8_t((data_a[i].ql[ql_idx + 32] >> 4) | (((qh >> 6) & 3) << 4)) - 32))); |
| 32 | } |
| 33 | } |