[PR #1330] [MERGED] [TENT] fix a bug in memory registration and add TENT support to the example #2165

Closed
opened 2026-10-29 21:33:17 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/Mooncake/pull/1330
Author: @staryxchen
Created: 1/5/2026
Status: ✅ Merged
Merged: 1/6/2026
Merged by: @alogfans

Base: main ← Head: fix/tent


📝 Commits (4)

  • 6c835cc fix(register-memory): correct function call and add metadata sync
  • 55eebe9 feat(example): add TENT backend support and refactor common utilities
  • 3946735 refactor(example): simplify protocol handling and improve signal management
  • ec31e7c style: reformat comment line length in transfer engine

📊 Changes

4 files changed (+357 additions, -154 deletions)

View changed files

📝 mooncake-transfer-engine/example/CMakeLists.txt (+4 -0)
📝 mooncake-transfer-engine/example/transfer_engine_bench.cpp (+342 -145)
📝 mooncake-transfer-engine/tent/src/runtime/transfer_engine_impl.cpp (+10 -8)
📝 mooncake-transfer-engine/tent/src/transfer_engine.cpp (+1 -1)

📄 Description

Description

This PR adds TENT backend support to the transfer engine benchmark and fixes a critical bug in memory registration that prevented remote peers from discovering newly registered buffers.

Changes

Bug Fix: Memory Registration Metadata Sync

Problem: When calling registerLocalMemory(void* addr, size_t size, Permission permission) with a single buffer, the registered memory was not visible to remote peers because the local segment metadata was not synchronized to the metadata server.

Root Cause:

  1. In transfer_engine.cpp, the single-buffer overload incorrectly called itself recursively instead of delegating to the implementation.
  2. In transfer_engine_impl.cpp, the single-buffer overload did not trigger metadata synchronization after registration.

Fix:

  • Corrected TransferEngine::registerLocalMemory to properly delegate to impl_->registerLocalMemory
  • Added metadata_->segmentManager().synchronizeLocal() call after successful buffer registration to ensure remote peers can discover the new buffers

Feature: TENT Backend Support in Benchmark

  • Added --backend flag to select between classic and tent backends
  • Refactored common buffer allocation/deallocation logic into shared helper functions
  • Added TENT-specific initiator and target implementations under tent_backend namespace
  • Updated CMakeLists.txt to conditionally link TENT library when USE_TENT is enabled

Type of Change

  • Types
    • Bug fix
    • New feature
      • Transfer Engine
      • Mooncake Store
      • Mooncake EP
      • Integration
      • P2P Store
      • Python Wheel
    • Breaking change
    • CI/CD
    • Documentation update
    • Other

How Has This Been Tested?

Testing

  • Verified that registered memory buffers are now visible to remote peers when using TENT backend
  • Tested both initiator and target modes with the new backend selection

Checklist

  • I have performed a self-review of my own code.
  • I have updated the documentation.
  • I have added tests to prove my changes are effective.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/Mooncake/pull/1330 **Author:** [@staryxchen](https://github.com/staryxchen) **Created:** 1/5/2026 **Status:** ✅ Merged **Merged:** 1/6/2026 **Merged by:** [@alogfans](https://github.com/alogfans) **Base:** `main` ← **Head:** `fix/tent` --- ### 📝 Commits (4) - [`6c835cc`](https://github.com/kvcache-ai/Mooncake/commit/6c835cc9d7696a3e89a848c24ae51614f38653ef) fix(register-memory): correct function call and add metadata sync - [`55eebe9`](https://github.com/kvcache-ai/Mooncake/commit/55eebe9be8f5d6ce99a666e21429d3b577d0fa0c) feat(example): add TENT backend support and refactor common utilities - [`3946735`](https://github.com/kvcache-ai/Mooncake/commit/39467354ccf05a59e4d0a897bda9b2a878a53e08) refactor(example): simplify protocol handling and improve signal management - [`ec31e7c`](https://github.com/kvcache-ai/Mooncake/commit/ec31e7c66e78f0a2ed163b85432a8e27efa92f86) style: reformat comment line length in transfer engine ### 📊 Changes **4 files changed** (+357 additions, -154 deletions) <details> <summary>View changed files</summary> 📝 `mooncake-transfer-engine/example/CMakeLists.txt` (+4 -0) 📝 `mooncake-transfer-engine/example/transfer_engine_bench.cpp` (+342 -145) 📝 `mooncake-transfer-engine/tent/src/runtime/transfer_engine_impl.cpp` (+10 -8) 📝 `mooncake-transfer-engine/tent/src/transfer_engine.cpp` (+1 -1) </details> ### 📄 Description ## Description This PR adds TENT backend support to the transfer engine benchmark and fixes a critical bug in memory registration that prevented remote peers from discovering newly registered buffers. ## Changes ### Bug Fix: Memory Registration Metadata Sync **Problem**: When calling `registerLocalMemory(void* addr, size_t size, Permission permission)` with a single buffer, the registered memory was not visible to remote peers because the local segment metadata was not synchronized to the metadata server. **Root Cause**: 1. In `transfer_engine.cpp`, the single-buffer overload incorrectly called itself recursively instead of delegating to the implementation. 2. In `transfer_engine_impl.cpp`, the single-buffer overload did not trigger metadata synchronization after registration. **Fix**: - Corrected `TransferEngine::registerLocalMemory` to properly delegate to `impl_->registerLocalMemory` - Added `metadata_->segmentManager().synchronizeLocal()` call after successful buffer registration to ensure remote peers can discover the new buffers ### Feature: TENT Backend Support in Benchmark - Added `--backend` flag to select between `classic` and `tent` backends - Refactored common buffer allocation/deallocation logic into shared helper functions - Added TENT-specific initiator and target implementations under `tent_backend` namespace - Updated CMakeLists.txt to conditionally link TENT library when `USE_TENT` is enabled ## Type of Change * Types - [x] Bug fix - [x] New feature - [x] Transfer Engine - [ ] Mooncake Store - [ ] Mooncake EP - [ ] Integration - [ ] P2P Store - [ ] Python Wheel - [ ] Breaking change - [ ] CI/CD - [ ] Documentation update - [ ] Other ## How Has This Been Tested? ## Testing - Verified that registered memory buffers are now visible to remote peers when using TENT backend - Tested both initiator and target modes with the new backend selection ## Checklist - [x] I have performed a self-review of my own code. - [x] I have updated the documentation. - [x] I have added tests to prove my changes are effective. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:33:17 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/Mooncake#2165
No description provided.