Skip to content

[Bugfix][TENT] Submit merged staging requests only once - #4797

Merged
alogfans merged 1 commit into
kvcache-ai:mainfrom
lhzds:codex/fix-merged-staging
Oct 27, 2026
Merged

alogfans merged 1 commit into
kvcache-ai:mainfrom
lhzds:codex/fix-merged-staging

Conversation

@lhzds

@lhzds lhzds commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

When contiguous requests are merged on the staging path, each original request submits the same merged range. Record the staged owner in the existing merged_task_id_map so the remaining requests share its completion and failure status. Batch polling then counts the merged length once.

Suggested Merge Priority

  • P2 — Normal

Module

  • Transfer Engine (mooncake-transfer-engine)

Type of Change

  • Bug fix

How Has This Been Tested?

CPU-only Linux build (USE_TENT=ON, USE_CUDA=OFF, USE_MLU=OFF, BUILD_UNIT_TESTS=ON), based on 37642c5a.

cmake --build build-cpu --target tent_engine_failover_e2e_test \
  request_merge_test tent_runtime_queue_dispatch_test tent_progress_worker_test -j4
ctest --test-dir build-cpu --output-on-failure --timeout 120 \
  -R '^(tent_engine_failover_e2e_test|request_merge_test|tent_runtime_queue_dispatch_test|tent_progress_worker_test)$'
build-cpu/mooncake-transfer-engine/tent/tests/tent_engine_failover_e2e_test \
  --gtest_filter=EngineFailoverE2E.MergedStagingRequestsShareOneSubmission \
  --gtest_repeat=20
  • All four suites pass: 100 tests, no skips.
  • The new regression fails without the production fix: four requests totaling 4 KiB produce four cross-stage submissions totaling 16 KiB. With the fix, they produce one 4 KiB submission, and each public request reports its original length.
  • READ/WRITE, success/failure and runtime queue off/on pass, including pending status and polling aliases before the owner. Repeated 20 times: 160 configurations pass.
  • The regression advertises host memory as a peer MLU buffer and uses fake data transports with loopback staging RPCs. No accelerator hardware is required.

Checklist

  • Code self-review completed
  • Changed-line formatting with ./scripts/code_format.sh and scoped pre-commit pass
  • Regression coverage added
  • Human submitter has reviewed every changed line

AI Assistance Disclosure

  • AI tools were used

OpenAI Codex assisted with implementation, tests, validation and this description.

@alogfans alogfans left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alogfans
alogfans merged commit 8bfd298 into kvcache-ai:main Oct 27, 2026
32 checks passed
wzy-782 added a commit to wzy-782/Mooncake that referenced this pull request Oct 29, 2026
Conflicts with upstream main, resolved:
- transfer_engine_impl.cpp, planTransport (getTransportType before
  kvcache-ai#4378): upstream added the XPU dma-buf RDMA (kvcache-ai#4378) and same-host XPU
  IPC (kvcache-ai#4379) routes. A request with a TPU side always stages and never
  takes either route; XPU and MLU requests behave as upstream.
- transfer_engine_impl.cpp, findStagingPolicy: #2's combined TPU/XPU/MLU
  staging block replaces the old TPU case, with upstream's note on the
  XPU dma-buf bypass. XPU memory is no longer called never
  NIC-addressable.
- transfer_engine_impl.cpp, submitTransfer: upstream's progress lock
  (kvcache-ai#4720) around #2's prepareSubmit call with the staged route.
- tent/tests/CMakeLists.txt: #1's TPU adapter tests, then #2's engine,
  staged-route and host-initiator tests.

Known failure: EngineFailoverE2E.MergedStagingRequestsShareOneSubmission
(kvcache-ai#4797). The test marks the peer buffer as MLU only in the test thread's
segment cache, which is thread-local. #2 re-plans a staged request's hop
on the ProxyManager thread, whose cache shows host memory, so the hop
gets no route.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants