[perf] Enable multi-thread serial for non-tensor values in MooncakeStore backend#111
Merged
Conversation
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
CLA Signature Pass0oshowero0, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
Contributor
There was a problem hiding this comment.
Pull request overview
Enables nested multi-threading on the MooncakeStore client's non-tensor path by passing num_workers=MAX_SERIAL_WORKER_THREADS to serial_utils.batch_encode_into, and refactors get() to precompute per-category key/shape/dtype/packed_size lists once instead of re-deriving them per batch slice.
Changes:
- Rename
MAX_WORKER_THREADStoMAX_BATCH_WORKER_THREADSand addMAX_SERIAL_WORKER_THREADSfor a second layer of serialization parallelism within each non-tensor batch. - Hoist tensor/non-tensor split (keys, shapes, dtypes, packed_sizes) out of the batch loops in
get()to avoid repeated comprehensions andcastlookups. - Reorder
put()to collect bytes-future results before waiting on tensor futures, and tweak three docstrings to say "receiver buffer".
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
CLA Signature Pass0oshowero0, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
1 similar comment
CLA Signature Pass0oshowero0, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enable two-tier multi-threading for batch operations.
Introduce
MAX_SERIAL_WORKER_THREADS(default: 4) to parallelize intra-batch serialization. Combined withMAX_BATCH_WORKER_THREADS(renamed fromMAX_WORKER_THREADS), this creates nested parallelism: the outer thread pool dispatches batches concurrently, while the inner thread pool accelerates serialization within each individual batch viaserial_utils.batch_encode_into.Streamline
getdispatch by pre-partitioning inputs.Hoist index-based list comprehensions out of the batching loops. Keys, shapes, dtypes, and packed sizes are now pre-partitioned into separate tensor / non-tensor lists ahead of time, allowing direct list slicing during thread-pool dispatch and eliminating redundant per-batch reconstruction.