ggml-kompute.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #define GGML_KOMPUTE_MAX_DEVICES 16
  11. struct ggml_vk_device {
  12. int index;
  13. int type; // same as VkPhysicalDeviceType
  14. size_t heapSize;
  15. const char * name;
  16. const char * vendor;
  17. int subgroupSize;
  18. uint64_t bufferAlignment;
  19. uint64_t maxAlloc;
  20. };
  21. struct ggml_vk_device * ggml_vk_available_devices(size_t memoryRequired, size_t * count);
  22. bool ggml_vk_get_device(struct ggml_vk_device * device, size_t memoryRequired, const char * name);
  23. bool ggml_vk_has_vulkan(void);
  24. bool ggml_vk_has_device(void);
  25. struct ggml_vk_device ggml_vk_current_device(void);
  26. //
  27. // backend API
  28. //
  29. // forward declaration
  30. typedef struct ggml_backend * ggml_backend_t;
  31. GGML_BACKEND_API ggml_backend_t ggml_backend_kompute_init(int device);
  32. GGML_BACKEND_API bool ggml_backend_is_kompute(ggml_backend_t backend);
  33. GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_kompute_buffer_type(int device);
  34. GGML_BACKEND_API ggml_backend_reg_t ggml_backend_kompute_reg(void);
  35. #ifdef __cplusplus
  36. }
  37. #endif