diff --git a/ggml/src/ggml-opencl/kernels/div.cl b/ggml/src/ggml-opencl/kernels/div.cl index 6d9b4ade9f..eb1d2da002 100644 --- a/ggml/src/ggml-opencl/kernels/div.cl +++ b/ggml/src/ggml-opencl/kernels/div.cl @@ -1,5 +1,7 @@ #pragma OPENCL EXTENSION cl_khr_fp16 : enable +#include "div.h" + //------------------------------------------------------------------------------ // div //------------------------------------------------------------------------------ diff --git a/ggml/src/ggml-opencl/kernels/div.h b/ggml/src/ggml-opencl/kernels/div.h new file mode 100644 index 0000000000..75f66a0a2a --- /dev/null +++ b/ggml/src/ggml-opencl/kernels/div.h @@ -0,0 +1,31 @@ + +#ifndef __KERNELS_DIV_H__ +#define __KERNELS_DIV_H__ + +#include "ocl_defs.h" + +kernel void kernel_div(global char * src0, + ulong offset0, + global char * src1, + ulong offset1, + global char * dst, + ulong offsetd, + ulong nb00, + ulong nb01, + ulong nb02, + ulong nb03, + int ne10, + int ne11, + int ne12, + int ne13, + ulong nb10, + ulong nb11, + ulong nb12, + ulong nb13, + int ne0, + ulong nb0, + ulong nb1, + ulong nb2, + ulong nb3); + +#endif // __KERNELS_DIV_H__ diff --git a/ggml/src/ggml-opencl/kernels/embed_kernel.py b/ggml/src/ggml-opencl/kernels/embed_kernel.py index 81d9868a4b..867c0d4961 100644 --- a/ggml/src/ggml-opencl/kernels/embed_kernel.py +++ b/ggml/src/ggml-opencl/kernels/embed_kernel.py @@ -7,12 +7,11 @@ import os logger = logging.getLogger("opencl-embed-kernel") -INCLUDE_PATTERN = re.compile(r'#include\s+"(.*)"') +INCLUDE_PATTERN = re.compile(r'#include\s+"(.*)".*') def parse_file_line(ifile, ofile, base_path: str): for i in ifile: - i = i.rstrip() if m := INCLUDE_PATTERN.match(i): include_file = os.path.join(base_path, m.group(1)) logger.info(f"Embedding file: {include_file}") diff --git a/ggml/src/ggml-opencl/kernels/ocl_defs.h b/ggml/src/ggml-opencl/kernels/ocl_defs.h new file mode 100644 index 0000000000..a0b8feedb1 --- /dev/null +++ b/ggml/src/ggml-opencl/kernels/ocl_defs.h @@ -0,0 +1,16 @@ + +#ifndef __OCL_DEFS_H__ +#define __OCL_DEFS_H__ + +#ifdef __OPENCL_C_VERSION__ +// Device (OpenCL) Definitions +#else +// Host (C++) Definitions +# define kernel +# define global +# define __kernel +# define __global +# define ulong cl_ulong +#endif + +#endif // __OCL_DEFS_H__