Repository navigation
[Perf][Integration] Reserve Python batch transfer request capacity - #4104
Open
adenzhou1350 wants to merge 1 commit into
Open
adenzhou1350 wants to merge 1 commit into
adenzhou1350 wants to merge 1 commit into
Conversation
Signed-off-by: Xucheng Zhou <aden1350@outlook.com>
adenzhou1350
requested review from
ShangmingCai and
alogfans
as code owners
September 14, 2026 09:19
14 of 31 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.
Description
The classic Python transfer wrapper knows the final request count before it builds synchronous, asynchronous, and CUDA-callback batches. Reserve that exact capacity before the existing
push_backloops.This avoids geometric
std::vectorgrowth and relocation while preserving request count and order, addresses, lengths, opcodes, retry fields, transport hints, submission, completion, error handling, and object lifetime.A local component benchmark using the actual 56-byte
TransferRequesttype measured these construction-only improvements across two alternating runs:These are request-vector construction measurements, not transport or end-to-end results.
Module
mooncake-transfer-engine)mooncake-store)mooncake-conductor)mooncake-reshard)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:
./scripts/code_format.sh --check --changed-lines \ --base 7dee8db1a68c5656ea699acf71617783a13633c7 cmake -S . -B /build -DSKBUILD=ON -DWITH_STORE=OFF \ -DWITH_TE=ON -DBUILD_UNIT_TESTS=ON -DUSE_TCP=ON \ -DUSE_CUDA=OFF -DCMAKE_BUILD_TYPE=Release cmake --build /build --target engine -j3 python3 -m unittest \ mooncake-wheel.tests.transfer_engine_initiator_test.TestVLLMAdaptorTransfer.test_batch_write_read \ mooncake-wheel.tests.transfer_engine_initiator_test.TestVLLMAdaptorTransfer.test_async_batch_write_readThe build and tests ran in a pinned local container with network disabled and no GPU. Both tests passed two TCP rounds with batch size 100. Follow-up on
ba61a790: the completetransfer_engine_py.cpptranslation unit now also compiles with-DUSE_CUDA -DUSE_TCPusing GCC 11.4 and CUDA 13.0.2 headers;nm -Cconfirms thebatchTransferOnCudasymbol is emitted. A further isolated Release build now also successfully links the completeenginePython extension withUSE_CUDA=ONandUSE_TCP=ON(GCC 11.4, Python 3.10, CUDA 13.0.2). The linked module depends onlibcudart.so.13and referencescudaLaunchHostFunc. Build inputs were cached, apart from pinned NumPy 1.26.4 installed only in the temporary container; configure/compilation ran offline. CUDA callback execution and RDMA transport remain untested; this is no new performance result. All six applicable PR-scoped pre-commit hooks and the changed-line clang-format 20.1.8 check pass; five non-applicable hooks were skipped. No source changes or GPU use were needed.Test results:
Checklist
./scripts/code_format.shAI Assistance Disclosure
OpenAI Codex helped identify the allocation pattern, prepare the three-line capacity hint, replay it on the latest upstream
main, and run the focused build, format, duplicate, benchmark, and TCP correctness checks. The human submitter reviewed and approved the final diff and claim boundary.