ggml
[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)
Brought by drakestapleton
ggml / src / ggml-hexagon / htp / work-queue.h
| 1 | #ifndef HTP_WORK_QUEUE_H |
| 2 | #define HTP_WORK_QUEUE_H |
| 3 | |
| 4 | #include <stdbool.h> |
| 5 | #include <stdint.h> |
| 6 | #include <stddef.h> |
| 7 | |
| 8 | typedef void (*work_queue_func_t)(unsigned int n, unsigned int i, void *); |
| 9 | |
| 10 | struct work_queue_s; |
| 11 | typedef struct work_queue_s * work_queue_t; |
| 12 | |
| 13 | #define WORK_QUEUE_MAX_N_THREADS 10 |
| 14 | |
| 15 | size_t work_queue_sizeof(uint32_t n_threads, uint32_t capacity, uint32_t stack_size); |
| 16 | size_t work_queue_alignof(void); |
| 17 | work_queue_t work_queue_init(void * ptr, uint32_t n_threads, uint32_t capacity, uint32_t stack_size); |
| 18 | void work_queue_free(work_queue_t q); |
| 19 | |
| 20 | void work_queue_wakeup(work_queue_t q); |
| 21 | void work_queue_suspend(work_queue_t q); |
| 22 | |
| 23 | bool work_queue_run_async(work_queue_t q, work_queue_func_t func, void * data, unsigned int n); |
| 24 | |
| 25 | static inline bool work_queue_run(work_queue_t q, work_queue_func_t func, void * data, unsigned int n) { |
| 26 | if (n <= 1) { |
| 27 | func(n, 0, data); |
| 28 | return true; |
| 29 | } |
| 30 | return work_queue_run_async(q, func, data, n); |
| 31 | } |
| 32 | |
| 33 | // Legacy compatibility |
| 34 | typedef work_queue_func_t worker_callback_t; |
| 35 | #define worker_pool_run_func work_queue_run |
| 36 | #define worker_pool work_queue |
| 37 | |
| 38 | #endif // #ifndef HTP_WORK_QUEUE_H |