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/diag.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 / diag.cl` 27 lines ยท 834 bytes Raw Blame History 1 kernel void kernel_diag_f32( 2 global const char * src0, 3 ulong offset0, 4 global char * dst, 5 ulong offsetd, 6 ulong nb01, 7 ulong nb02, 8 ulong nb03, 9 int ne0, 10 ulong nb0, 11 ulong nb2, 12 ulong nb3 13 ) { 14 src0 = src0 + offset0; 15 dst = dst + offsetd; 16 17 int i3 = get_group_id(2); 18 int i2 = get_group_id(1); 19 int i1 = get_group_id(0); 20 21 global const float * src0_ptr = (global const float *)(src0 + i2*nb02 + i3*nb03); 22 global float * dst_ptr = (global float *)(dst + i1*nb01 + i2*nb2 + i3*nb3); 23 24 for (int i0 = get_local_id(0); i0 < ne0; i0 += get_local_size(0)) { 25 dst_ptr[i0] = i0 == i1 ? src0_ptr[i0] : 0.0f; 26 } 27 }