Repository navigation
[Performance][Wheel] Avoid PIL RGB pixel copies - #3413
Draft
zxpdemonio wants to merge 2 commits into
Draft
zxpdemonio wants to merge 2 commits into
zxpdemonio wants to merge 2 commits into
Conversation
Signed-off-by: Cruz Zhao <CruzZhao@linux.alibaba.com>
9 of 22 tasks
This branch has not been deployed
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.
Motivation
The structured-object PIL codec introduced by #3412 uses
Image.tobytes()for RGB pixels. That creates a full packed-RGB allocation before Mooncake copies the payload into BufferPool staging. GET then reconstructs another full pixel buffer. For rollout dictionaries containing many decoded images, those CPU copies dominate transfer latency.This PR is stacked on #3412 and contains only the follow-up performance change. It should be rebased onto
mainafter #3412 merges.Description
tobytes()allocation.Image.fromarrow, keeping the BufferPool lease alive until the last decoded image is released.Three implementations were measured with the same wheel, master, client, Kodak24 RGB inputs, 64 MiB chunks, one warmup, and seven cross-node RDMA trials. Values are median PUT+GET latency; lower is better.
tobytes()The fused packed path reduces wire bytes but still requires a full reconstruction copy on GET. Direct RGBX sends 33% more pixel bytes, yet wins at every measured size because it removes the expensive copies on both sides. It also remained fastest for 1, 8, and 24-image payloads, so the implementation does not add a size threshold.
The final reviewed wheel was rebuilt and retested independently:
Module
mooncake-transfer-engine)mooncake-store)mooncake-ep)mooncake-pg)mooncake-integration)mooncake-p2p-store)mooncake-wheel)mooncake-common)mooncake-rl)Type of Change
How Has This Been Tested?
Test commands:
Test results:
The skipped unit tests require a working CUDA/Torch runtime, which is unavailable in the test environment.
ruffandruff-formatwere intentionally not run; all other applicable pre-commit hooks passed.Checklist
./scripts/code_format.shAI Assistance Disclosure
Codex was used to compare codec designs, review lifetime and fallback paths, run the validation matrix, and prepare this PR description. The submitted implementation and results were manually reviewed.