ggml-kompute.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include "ggml.h"
  3. #include "ggml-backend.h"
  4. #include <stdbool.h>
  5. #include <stddef.h>
  6. #include <stdint.h>
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. struct ggml_vk_device {
  11. int index;
  12. int type; // same as VkPhysicalDeviceType
  13. size_t heapSize;
  14. const char * name;
  15. const char * vendor;
  16. int subgroupSize;
  17. uint64_t bufferAlignment;
  18. uint64_t maxAlloc;
  19. };
  20. struct ggml_vk_device * ggml_vk_available_devices(size_t memoryRequired, size_t * count);
  21. bool ggml_vk_get_device(struct ggml_vk_device * device, size_t memoryRequired, const char * name);
  22. bool ggml_vk_has_vulkan(void);
  23. bool ggml_vk_has_device(void);
  24. struct ggml_vk_device ggml_vk_current_device(void);
  25. //
  26. // backend API
  27. //
  28. // forward declaration
  29. typedef struct ggml_backend * ggml_backend_t;
  30. GGML_API ggml_backend_t ggml_backend_kompute_init(int device);
  31. GGML_API bool ggml_backend_is_kompute(ggml_backend_t backend);
  32. GGML_API ggml_backend_buffer_type_t ggml_backend_kompute_buffer_type(int device);
  33. #ifdef __cplusplus
  34. }
  35. #endif