From 91b1461030c1a3763560977728b47659aaf0c481 Mon Sep 17 00:00:00 2001 From: jianyuzh Date: Wed, 24 Jan 2024 09:41:25 +0800 Subject: [PATCH] mv internal function to .cpp file --- ggml-sycl.cpp | 24 ++++++++++++++++++++++++ ggml-sycl.h | 37 ------------------------------------- 2 files changed, 24 insertions(+), 37 deletions(-) diff --git a/ggml-sycl.cpp b/ggml-sycl.cpp index 0f2edf27f..6f9261a5e 100644 --- a/ggml-sycl.cpp +++ b/ggml-sycl.cpp @@ -98,6 +98,30 @@ typedef float dfloat; // dequantize float typedef sycl::float2 dfloat2; #endif //GGML_SYCL_F16 +bool ggml_sycl_loaded(void); +void * ggml_sycl_host_malloc(size_t size); +void ggml_sycl_host_free(void * ptr); +bool ggml_sycl_can_mul_mat(const struct ggml_tensor * src0, const struct ggml_tensor * src1, struct ggml_tensor * dst); +void ggml_sycl_set_tensor_split(const float * tensor_split); +void ggml_sycl_transform_tensor(void * data, struct ggml_tensor * tensor); +void ggml_sycl_free_data(struct ggml_tensor * tensor); +void ggml_sycl_assign_buffers(struct ggml_tensor * tensor); +void ggml_sycl_assign_buffers_no_scratch(struct ggml_tensor * tensor); +void ggml_sycl_assign_buffers_force_inplace(struct ggml_tensor * tensor); +void ggml_sycl_assign_buffers_no_alloc(struct ggml_tensor * tensor); +void ggml_sycl_assign_scratch_offset(struct ggml_tensor * tensor, size_t offset); +void ggml_sycl_copy_to_device(struct ggml_tensor * tensor); +void ggml_sycl_set_main_device(int main_device); +void ggml_sycl_set_mul_mat_q(bool mul_mat_q); +void ggml_sycl_set_scratch_size(size_t scratch_size); +void ggml_sycl_free_scratch(void); +int ggml_sycl_get_device_count(void); +void ggml_sycl_get_device_description(int device, char * description, size_t description_size); +bool ggml_backend_is_sycl(ggml_backend_t backend); +int ggml_backend_sycl_get_device(ggml_backend_t backend); +int get_main_device(); +void print_ggml_tensor(const char*name, struct ggml_tensor *src); +void log_tensor_with_cnt(const char* name, struct ggml_tensor * src, int stop_cnt); static __dpct_inline__ int get_int_from_int8(const int8_t *x8, const int &i32) { const uint16_t * x16 = (const uint16_t *) (x8 + sizeof(int) * i32); // assume at least 2 byte alignment diff --git a/ggml-sycl.h b/ggml-sycl.h index f86703456..1ad1b3737 100644 --- a/ggml-sycl.h +++ b/ggml-sycl.h @@ -11,52 +11,15 @@ extern "C" { #define GGML_SYCL_NAME "SYCL" GGML_API void ggml_init_sycl(void); - -GGML_API bool ggml_sycl_loaded(void); - -GGML_API void * ggml_sycl_host_malloc(size_t size); -GGML_API void ggml_sycl_host_free(void * ptr); - -GGML_API bool ggml_sycl_can_mul_mat(const struct ggml_tensor * src0, const struct ggml_tensor * src1, struct ggml_tensor * dst); -GGML_API void ggml_sycl_set_tensor_split(const float * tensor_split); -GGML_API void ggml_sycl_transform_tensor(void * data, struct ggml_tensor * tensor); -GGML_API void ggml_sycl_free_data(struct ggml_tensor * tensor); - -GGML_API void ggml_sycl_assign_buffers(struct ggml_tensor * tensor); -GGML_API void ggml_sycl_assign_buffers_no_scratch(struct ggml_tensor * tensor); -GGML_API void ggml_sycl_assign_buffers_force_inplace(struct ggml_tensor * tensor); - -GGML_API void ggml_sycl_assign_buffers_no_alloc(struct ggml_tensor * tensor); -GGML_API void ggml_sycl_assign_scratch_offset(struct ggml_tensor * tensor, size_t offset); -GGML_API void ggml_sycl_copy_to_device(struct ggml_tensor * tensor); - -GGML_API void ggml_sycl_set_main_device(int main_device); -GGML_API void ggml_sycl_set_mul_mat_q(bool mul_mat_q); -GGML_API void ggml_sycl_set_scratch_size(size_t scratch_size); -GGML_API void ggml_sycl_free_scratch(void); GGML_API bool ggml_sycl_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * tensor); - -GGML_API int ggml_sycl_get_device_count(void); -GGML_API void ggml_sycl_get_device_description(int device, char * description, size_t description_size); - GGML_API ggml_backend_t ggml_backend_sycl_init(int device); - -GGML_API bool ggml_backend_is_sycl(ggml_backend_t backend); -GGML_API int ggml_backend_sycl_get_device(ggml_backend_t backend); - GGML_API ggml_backend_buffer_type_t ggml_backend_sycl_buffer_type(int device); - GGML_API ggml_backend_buffer_type_t ggml_backend_sycl_host_buffer_type(void); -int get_main_device(); -void print_ggml_tensor(const char*name, struct ggml_tensor *src); -void log_tensor_with_cnt(const char* name, struct ggml_tensor * src, int stop_cnt); - #ifdef __cplusplus } #endif - /* Following definition copied from DPCT head files, which are used by ggml-sycl.cpp */