Skip to content

feat(inference): add AffinityThreadPool for ML inference - #14

Merged
Lotargo merged 1 commit into
mainfrom
feature-affinity-thread-pool-15026824702598825670
Mar 11, 2026
Merged

Lotargo merged 1 commit into
mainfrom
feature-affinity-thread-pool-15026824702598825670

Conversation

@Lotargo

@Lotargo Lotargo commented Mar 11, 2026

Copy link
Copy Markdown
Owner

Implemented a custom Thread Pool with CPU thread affinity support to guarantee predictable latencies during embedded AI operations (like LLM or embedding model inference).

  • Binds worker threads to specific cores using pthread_setaffinity_np on Linux.
  • Added macOS fallback using Mach thread policies.
  • Uses C++20 std::latch for race-free pool initialization.
  • Replaced std::bind with a modern C++ lambda pack expansion.
  • Added exhaustive tests (Google Test) and microbenchmarks (Google Benchmark).
  • Updated CMakeLists.txt and TODO.md roadmap checklists.

Implemented a custom Thread Pool with CPU thread affinity support
to guarantee predictable latencies during embedded AI operations
(like LLM or embedding model inference).

- Binds worker threads to specific cores using `pthread_setaffinity_np` on Linux.
- Added macOS fallback using Mach thread policies.
- Uses C++20 `std::latch` for race-free pool initialization.
- Replaced `std::bind` with a modern C++ lambda pack expansion.
- Added exhaustive tests (Google Test) and microbenchmarks (Google Benchmark).
- Updated CMakeLists.txt and TODO.md roadmap checklists.
@Lotargo
Lotargo merged commit 6febaaa into main Mar 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant