diff options
author | Georgi Gerganov <ggerganov@gmail.com> | 2023-06-06 20:16:57 +0300 |
---|---|---|
committer | Georgi Gerganov <ggerganov@gmail.com> | 2023-06-06 20:21:56 +0300 |
commit | 44f906e8537fcec965e312d621c80556d6aa9bec (patch) | |
tree | b9b705ed45c4541dda384d2b3fdf92391a16e8a8 /ggml-metal.metal | |
parent | d5b111f53d14972669eb52055f9df2567663ad8b (diff) |
metal : add f16 support
Diffstat (limited to 'ggml-metal.metal')
-rw-r--r-- | ggml-metal.metal | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ggml-metal.metal b/ggml-metal.metal index 4bedc8e..a359beb 100644 --- a/ggml-metal.metal +++ b/ggml-metal.metal @@ -169,6 +169,22 @@ kernel void kernel_diag_mask_inf( } } +kernel void kernel_get_rows_f16( + device const void * src0, + device const int * src1, + device float * dst, + constant int64_t & ne00, + constant uint64_t & nb01, + constant uint64_t & nb1, + uint tpig[[thread_position_in_grid]]) { + const int i = tpig; + const int r = ((device int32_t *) src1)[i]; + + for (int j = 0; j < ne00; j++) { + dst[i*nb1 + j] = ((device half *) ((device char *) src0 + r*nb01))[j]; + } +} + kernel void kernel_get_rows_q4_0( device const void * src0, device const int * src1, |