[perf] Enable multi-thread serial for non-tensor values in MooncakeStore backend#111
Conversation
Signed-off-by: 0oshowero0 <[email protected]>
CLA Signature Pass0oshowero0, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
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 <[email protected]>
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. 👍 |
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.