Repository navigation
[TENT] Add an opt-in pinned staging pool to the io_uring transport - #5012
Merged
Merged
Conversation
zxue2
requested review from
00fish0,
alogfans,
chestnut-Q,
doujiang24,
dtcccc and
staryxchen
as code owners
October 27, 2026 12:41
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
owns()only checks address range, not thatbufferis exactly a slot base (aligned to… · New Using a hard-coded 4096 as the system page size breaks the stated 'whole pages' guarantee on… · NewfreePinnedHost()returns aStatus, but the destructor ignores failures. For backends where… · New The comment reads as if staging usesposix_memalign()when the pinned pool is enabled/succeeds,… · New
What changed in this PR
Adds an opt-in pinned staging pool for the io_uring transport to speed up device↔host staging by reusing pinned, page-aligned host slots, plus platform hooks and tests to validate O_DIRECT behavior.
Changes:
- Introduces
IOUringStagingPooland integrates it into io_uring staging buffer selection with fallback toposix_memalign(). - Adds
Platform::allocatePinnedHost/freePinnedHostwith CUDA and XPU specializations. - Adds new unit/integration-style tests, including O_DIRECT I/O on a real filesystem.
| File | Description |
|---|---|
| mooncake-transfer-engine/tent/tests/io_uring_transport_test.cpp | Adds staging pool unit tests and an O_DIRECT validation test path. |
| mooncake-transfer-engine/tent/src/transport/io_uring/io_uring_transport.cpp | Implements staging pool logic, lifecycle, and usage in submissions. |
| mooncake-transfer-engine/tent/src/runtime/platform.cpp | Adds default pinned-host allocation/free hooks (fallback implementation). |
| mooncake-transfer-engine/tent/src/platform/xpu/xpu_sycl_backend.h | Adds pinned host allocation/free via prepare/release_for_device_copy. |
| mooncake-transfer-engine/tent/src/platform/xpu/xpu_platform.cpp | Exposes pinned host allocation/free overrides for XPU platform. |
| mooncake-transfer-engine/tent/src/platform/cuda/cuda_allocator.cpp | Adds CUDA pinned host allocation/free using cudaHostAlloc/cudaFreeHost. |
| mooncake-transfer-engine/tent/src/common/config.cpp | Adds env/config wiring for pinned staging feature and sizing knobs. |
| mooncake-transfer-engine/tent/include/tent/transport/io_uring/io_uring_transport.h | Declares IOUringStagingPool, task ownership, and transport accessor. |
| mooncake-transfer-engine/tent/include/tent/runtime/platform.h | Extends platform interface with allocate/free pinned host APIs. |
| mooncake-transfer-engine/tent/include/tent/platform/xpu.h | Declares XPU overrides for pinned host allocation/free. |
| mooncake-transfer-engine/tent/include/tent/platform/cuda.h | Declares CUDA overrides for pinned host allocation/free. |
Review effort: Lite
Comment on lines
+65
to
+66
| auto p = static_cast<const char *>(buffer); | ||
| return base_ && p >= base_ && p < base_ + slot_size_ * slot_count_; |
Comment on lines
+149
to
+155
| const size_t kPageSize = 4096; | ||
| const size_t slot_kb = | ||
| conf_->get("transports/io_uring/staging_slot_kb", size_t{4096}); | ||
| const size_t slot_bytes = | ||
| (slot_kb * 1024 + kPageSize - 1) / kPageSize * kPageSize; | ||
| const size_t slots = | ||
| conf_->get("transports/io_uring/staging_slots", size_t{32}); |
Comment on lines
+69
to
+70
| if (base_) | ||
| Platform::getLoader().freePinnedHost(base_, slot_size_ * slot_count_); |
| ThreadLocalStorage<FileContextMap> tl_file_context_map_; | ||
| uint64_t async_memcpy_threshold_; | ||
| // Null unless transports/io_uring/pinned_staging is set and the pinned | ||
| // allocation succeeded; staging then uses posix_memalign() only. |
zxue2
force-pushed
the
iouring_pinned_staging
branch
2 times, most recently
from
October 27, 2026 13:27
12680e5 to
def1b4c
Compare
Copilot stopped reviewing on behalf of
zxue2 due to an error
October 27, 2026 15:42
1 of 36 tasks
zxue2
force-pushed
the
iouring_pinned_staging
branch
2 times, most recently
from
October 28, 2026 03:12
c177146 to
66ed04c
Compare
11 of 36 tasks
io_uring staging buffer comes from posix_memalign(), which is pageable, so the device copy into it is slow. IOUringStagingPool added to address it: one pinned host allocation made at install(), split into fixed slots. Requests that need staging take a slot; when none is free or the request is larger than a slot they fall back to posix_memalign() as before, so the pool never blocks a submission. A task holds a shared_ptr to the pool while it owns a slot, so a slot returned after uninstall() still has a live pool. Pinned memory comes from a new Platform::allocatePinnedHost / freePinnedHost hook: cudaHostAlloc(cudaHostAllocPortable) on CUDA, and page-aligned posix_memalign() elsewhere. On XPU the posix_memalign() pages are also registered with the driver through prepare_for_device_copy, so device copies stay fast. USM host memory (sycl::aligned_alloc_host) is not used: the kernel cannot pin it, so every O_DIRECT request on a slot would fail with EFAULT. The pool is off by default. - MC_IOURING_PINNED_STAGING transports/io_uring/pinned_staging (off) - MC_IOURING_STAGING_SLOT_KB transports/io_uring/staging_slot_kb (4096) - MC_IOURING_STAGING_SLOTS transports/io_uring/staging_slots (32) The size keys only take effect when pinned_staging is on. Slot sizes are rounded up to whole pages. If the pinned allocation fails, install() logs a warning and stages with pageable buffers. Add tests for the pool, including O_DIRECT I/O through a staging slot on a real filesystem (the other transport tests use tmpfs, which has no O_DIRECT and so hides pinning failures). Signed-off-by: Zhan Xue <zhan.xue@intel.com>
11 of 36 tasks
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.



io_uring staging buffer comes from posix_memalign(), which is pageable, so the device copy into it is slow. IOUringStagingPool added to address it: one pinned host allocation made at install(), split into fixed slots. Requests that need staging take a slot; when none is free or the request is larger than a slot they fall back to posix_memalign() as before, so the pool never blocks a submission. A task holds a shared_ptr to the pool while it owns a slot, so a slot returned after uninstall() still has a live pool.
Pinned memory comes from a new Platform::allocatePinnedHost / freePinnedHost hook: cudaHostAlloc(cudaHostAllocPortable) on CUDA, and page-aligned posix_memalign() elsewhere. On XPU the posix_memalign() pages are also registered with the driver through prepare_for_device_copy, so device copies stay fast. USM host memory (sycl::aligned_alloc_host) is not used: the kernel cannot pin it, so every O_DIRECT request on a slot would fail with EFAULT.
The pool is off by default:
The size keys only take effect when pinned_staging is on. Slot sizes are rounded up to whole pages. If the pinned allocation fails, install() logs a warning and stages with pageable buffers.
Add tests for the pool, including O_DIRECT I/O through a staging slot on a real filesystem (the other transport tests use tmpfs, which has no O_DIRECT and so hides pinning failures).
Description
Suggested Merge Priority
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:
# Example: bash scripts/run_ci_test.shTest results:
Checklist
./scripts/code_format.shAI Assistance Disclosure