interplane.Get Omega
Read in your language

ggml

[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)

Brought by drakestapleton

branch master Branches Tags History

ggml / src / ggml-hexagon / htp / work-queue.h

38 lines · 1182 bytes Raw Blame History
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
8typedef void (*work_queue_func_t)(unsigned int n, unsigned int i, void *);
9
10struct work_queue_s;
11typedef struct work_queue_s * work_queue_t;
12
13#define WORK_QUEUE_MAX_N_THREADS 10
14
15size_t work_queue_sizeof(uint32_t n_threads, uint32_t capacity, uint32_t stack_size);
16size_t work_queue_alignof(void);
17work_queue_t work_queue_init(void * ptr, uint32_t n_threads, uint32_t capacity, uint32_t stack_size);
18void work_queue_free(work_queue_t q);
19
20void work_queue_wakeup(work_queue_t q);
21void work_queue_suspend(work_queue_t q);
22
23bool work_queue_run_async(work_queue_t q, work_queue_func_t func, void * data, unsigned int n);
24
25static 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
34typedef 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