diff options
author | Jiahao Li <liplus17@163.com> | 2023-07-23 19:00:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-23 14:00:37 +0300 |
commit | 83a00ce69bef9124c0702424a012ea799128b77d (patch) | |
tree | 835c093a8fe5ce1c50305b78e44442ea30c5e1ed /ggml-metal.metal | |
parent | d2a43664f93ba30a84e42713bb69f936cbdacf2a (diff) |
metal : support bcast add & dup & cont op (#2323)
Diffstat (limited to 'ggml-metal.metal')
-rw-r--r-- | ggml-metal.metal | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ggml-metal.metal b/ggml-metal.metal index 5a9a6d8..987376d 100644 --- a/ggml-metal.metal +++ b/ggml-metal.metal @@ -67,6 +67,17 @@ kernel void kernel_add( dst[tpig] = src0[tpig] + src1[tpig]; } +// assumption: src1 is a row +// broadcast src1 into src0 +kernel void kernel_add_row( + device const float * src0, + device const float * src1, + device float * dst, + constant int64_t & ne00, + uint tpig[[thread_position_in_grid]]) { + dst[tpig] = src0[tpig] + src1[tpig % ne00]; +} + kernel void kernel_mul( device const float * src0, device const float * src1, |