aboutsummaryrefslogtreecommitdiff
path: root/src/threadpool.h
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-06-20 20:10:56 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-06-21 05:57:19 +0200
commit6b969d25ce136eaf695222bd1a10bff1ecac0220 (patch)
treec23afb50c28b9deaddae5c6526a74ee11cf2d865 /src/threadpool.h
parentd4bdb8dae753462f621507d5fc3582e0e53da35c (diff)
downloadffwd-6b969d25ce136eaf695222bd1a10bff1ecac0220.tar.gz
ffwd-6b969d25ce136eaf695222bd1a10bff1ecac0220.zip
all: split Makefile and reorg library/tools
Diffstat (limited to '')
-rw-r--r--libffwd/threadpool.h (renamed from src/threadpool.h)22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/threadpool.h b/libffwd/threadpool.h
index 1813bb0..1dcc80a 100644
--- a/src/threadpool.h
+++ b/libffwd/threadpool.h
@@ -1,36 +1,28 @@
-#ifndef EMBED_THREADPOOL_H
-#define EMBED_THREADPOOL_H
+#ifndef TP_THREADPOOL_H
+#define TP_THREADPOOL_H
/* Persistent worker pool for the CPU math kernels: a fixed set of threads that
* sleep until parallel_for() hands them a callback, plus the CPU-count helper
* that sizes the pool (cgroup-quota aware). Separated from the math so the
- * kernels depend only on the parallel_for / embed_num_threads interface, not on
+ * kernels depend only on the parallel_for / tp_num_threads interface, not on
* the pool's internals. kernels.h includes this, so kernel callers need no
* extra include. */
-#ifndef EMBED_API
-#if defined(__GNUC__)
-#define EMBED_API __attribute__((visibility("default")))
-#else
-#define EMBED_API
-#endif
-#endif
-
/* Worker callback: (thread index, total threads, user arg). */
typedef void (*parallel_fn_t)(int tid, int n_threads, void *arg);
/* Set the persistent pool size (default 1). Creates/rebuilds the pool; call
* before inference. */
-EMBED_API void embed_set_threads(int n);
+void tp_set_threads(int n);
/* Available CPU cores, capped to a cgroup CPU quota when one is tighter. */
-EMBED_API int embed_get_num_cpus(void);
+int tp_get_num_cpus(void);
/* Current pool size (1 == serial). Kernels gate parallelism on this. */
-int embed_num_threads(void);
+int tp_num_threads(void);
/* Run fn across the pool; the calling thread participates as tid 0. Blocks
* until every worker has finished. */
void parallel_for(parallel_fn_t fn, void *arg);
-#endif /* EMBED_THREADPOOL_H */
+#endif /* TP_THREADPOOL_H */