Add async save path, pinned-pool coalescing, and Python bindings for KVortexEngine#1
Add async save path, pinned-pool coalescing, and Python bindings for KVortexEngine#1fantasy520 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f566ba1e2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| std::multimap<size_t, size_t> free_blocks_; | ||
|
|
||
| // Free blocks by offset (for coalescing) | ||
| std::map<size_t, size_t> free_blocks_by_offset_; |
There was a problem hiding this comment.
Move coalescing index when moving PinnedHostPool
The new free_blocks_by_offset_ map is now required for deallocate coalescing, but the existing move constructor/assignment in src/memory/pool.cpp still only transfer free_blocks_ and allocated_blocks_. Because moves are public on PinnedHostPool, moving a pool leaves this offset index out of sync/empty in the destination object, so adjacent free regions stop coalescing and long-running workloads can hit avoidable fragmentation and out-of-memory errors after a move.
Useful? React with 👍 / 👎.
Motivation
pybind11.save_blocks_async/wait.PinnedHostPoolfree-list handling by supporting coalescing to avoid fragmentation regressions.Description
bindings.cppto exposeKVortexConfig,CacheStats,KVortexEngine, andBlockHasher, including helpers to convertBlockIDto/frompy::bytesand mapKVortexErrortostd::runtime_errorexceptions, and provided alias attributesConfigandStatsfor backwards compatibility.KVortexEngine(include/kvortex/api/kvortex.hppandsrc/api/kvortex.cpp) withAsyncSaveTask, an async worker thread (async_worker_loop), queuing (async_queue_), result tracking (async_results_),save_blocks_asyncthat copies payloads into task buffers, and a blockingwaitthat returns errors from background work; the worker is started increateand joined onshutdown.KVortexEngineby deleting the move ctor/assignment to avoid thread/ownership issues introduced by the background worker thread.PinnedHostPoolimprovements ininclude/kvortex/memory/pool.hppandsrc/memory/pool.cpp: maintainfree_blocks_by_offset_to allow coalescing, added helper methodsinsert_free_block/remove_free_block, and perform coalescing ondeallocate; updated allocation/deallocation logic to use the helpers.<cstring>,<mutex>,<thread>,<condition_variable>) where needed.Testing
tests/test_memory.cpp(includingPinnedHostPool.CoalescingRegression) andtests/test_integration.cpp(includingIntegration.SaveBlocksAsyncWait), and all tests passed.waitin the added integration test.Codex Task