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-webgpu/wgsl-shaders/quant_inner_loops.tmpl # 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-webgpu / wgsl-shaders / quant_inner_loops.tmpl` 21 lines ยท 780 bytes Raw Blame History 1 #ifdef U32_DEQUANT_HELPERS 2 fn dequant_q4_0_packed_to_shmem(q_packed: u32, d: f16, dst_idx: u32) { 3 let scale = QUANT_OUT_TYPE(d); 4 for (var k = 0u; k < 4u; k++) { 5 let q_byte = get_byte(q_packed, k); 6 let q_hi = (QUANT_OUT_TYPE((q_byte >> 4) & 0xFu) - QUANT_OUT_TYPE(8.0)) * scale; 7 let q_lo = (QUANT_OUT_TYPE(q_byte & 0xFu) - QUANT_OUT_TYPE(8.0)) * scale; 8 QUANT_SHMEM[dst_idx + k] = q_lo; 9 QUANT_SHMEM[dst_idx + k + 16u] = q_hi; 10 } 11 } 12 13 fn dequant_q8_0_packed_to_shmem(q_packed: u32, d: f16, dst_idx: u32) { 14 let scale = QUANT_OUT_TYPE(d); 15 for (var k = 0u; k < 4u; k++) { 16 let q_byte = get_byte_i32(q_packed, k); 17 let q_val = QUANT_OUT_TYPE(q_byte) * scale; 18 QUANT_SHMEM[dst_idx + k] = q_val; 19 } 20 } 21 #endif