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-opencl/kernels/moe_reorder_b.cl # 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-opencl / kernels / moe_reorder_b.cl` 32 lines ยท 872 bytes Raw Blame History 1 #pragma OPENCL EXTENSION cl_khr_fp16 : enable 2 3 #define QK4_0 32 4 5 kernel void kernel_moe_reorder_b( 6 global float4 * src, 7 global uint * router, 8 global float4 * dst, 9 global int * total_tiles, 10 uint K, 11 ushort map_ratio, 12 uint tile_size 13 ) { 14 uint k_4 = get_global_id(0); 15 uint post_router_idx = get_global_id(1); 16 17 if ((k_4 >= (K / 4)) || (post_router_idx >= total_tiles[0] * tile_size)) { 18 return; 19 } 20 21 uint router_idx = router[post_router_idx]; 22 23 // Padded slots need not be written at all. The MoE GEMMs accumulate per output 24 // column and scatter only the real columns, so whatever sits in a padded slot 25 // never reaches dst 26 if (router_idx == 0xFFFFFFFF) { 27 return; 28 } 29 30 ushort activation_idx = router_idx / map_ratio; 31 dst[post_router_idx * K / 4 + k_4] = src[activation_idx * K / 4 + k_4]; 32 }