ggml-sycl.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // MIT license
  3. // Copyright (C) 2024 Intel Corporation
  4. // SPDX-License-Identifier: MIT
  5. //
  6. #pragma once
  7. #include "ggml.h"
  8. #include "ggml-backend.h"
  9. #define GGML_SYCL_NAME "SYCL"
  10. #define GGML_SYCL_MAX_DEVICES 48
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. // backend API
  15. GGML_BACKEND_API ggml_backend_t ggml_backend_sycl_init(int device);
  16. GGML_BACKEND_API bool ggml_backend_is_sycl(ggml_backend_t backend);
  17. // devide buffer
  18. GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_sycl_buffer_type(int device);
  19. // split tensor buffer that splits matrices by rows across multiple devices
  20. GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_sycl_split_buffer_type(const float * tensor_split);
  21. // pinned host buffer for use with the CPU backend for faster copies between CPU and GPU
  22. GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_sycl_host_buffer_type(void);
  23. GGML_BACKEND_API void ggml_backend_sycl_print_sycl_devices(void);
  24. GGML_BACKEND_API void ggml_backend_sycl_get_gpu_list(int *id_list, int max_len);
  25. GGML_BACKEND_API void ggml_backend_sycl_get_device_description(int device,
  26. char *description,
  27. size_t description_size);
  28. GGML_BACKEND_API int ggml_backend_sycl_get_device_count();
  29. GGML_BACKEND_API void ggml_backend_sycl_get_device_memory(int device, size_t *free, size_t *total);
  30. // SYCL doesn't support registering host memory, keep here for reference
  31. // GGML_BACKEND_API bool ggml_backend_sycl_register_host_buffer(void * buffer, size_t size);
  32. // GGML_BACKEND_API void ggml_backend_sycl_unregister_host_buffer(void * buffer);
  33. GGML_BACKEND_API ggml_backend_reg_t ggml_backend_sycl_reg(void);
  34. #ifdef __cplusplus
  35. }
  36. #endif