1
0

ggml-alloc.h 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. #pragma once
  2. #include "ggml.h"
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. struct ggml_backend_buffer;
  7. GGML_API struct ggml_allocr * ggml_allocr_new(void * data, size_t size, size_t alignment);
  8. GGML_API struct ggml_allocr * ggml_allocr_new_measure(size_t alignment);
  9. GGML_API struct ggml_allocr * ggml_allocr_new_from_buffer(struct ggml_backend_buffer * buffer);
  10. // tell the allocator to parse nodes following the order described in the list
  11. // you should call this if your graph are optimized to execute out-of-order
  12. GGML_API void ggml_allocr_set_parse_seq(struct ggml_allocr * alloc, const int * list, int n);
  13. GGML_API void ggml_allocr_free (struct ggml_allocr * alloc);
  14. GGML_API bool ggml_allocr_is_measure (struct ggml_allocr * alloc);
  15. GGML_API void ggml_allocr_reset (struct ggml_allocr * alloc);
  16. GGML_API void ggml_allocr_alloc (struct ggml_allocr * alloc, struct ggml_tensor * tensor);
  17. GGML_API size_t ggml_allocr_alloc_graph(struct ggml_allocr * alloc, struct ggml_cgraph * graph);
  18. GGML_API size_t ggml_allocr_max_size (struct ggml_allocr * alloc);
  19. GGML_API size_t ggml_allocr_alloc_graph_n(
  20. struct ggml_allocr * alloc,
  21. struct ggml_cgraph ** graphs, int n_graphs,
  22. struct ggml_tensor *** inputs, struct ggml_tensor *** outputs);
  23. #ifdef __cplusplus
  24. }
  25. #endif