Skip to content

[TE] Enabling UB Transport on the Kunpeng SuperNode Phase 1 - #1805

Merged
alogfans merged 16 commits into
kvcache-ai:mainfrom
zchuango:ub_transport_dev
Apr 7, 2026
Merged

alogfans merged 16 commits into
kvcache-ai:mainfrom
zchuango:ub_transport_dev

Conversation

@zchuango

@zchuango zchuango commented Apr 2, 2026

Copy link
Copy Markdown
Collaborator

Description

Overview

This PR introduces UbTransport, a new transport implementation for Mooncake's Transfer Engine that enables high-performance data transfer on Kunpeng 950 platforms using the UB (Unified Bus) protocol and URMA (Unified Remote Memory Access) APIs from the openEuler UMDK.

Related Issue: #1773


Motivation

  • Hardware: Kunpeng 950 CPUs with native UB fabric support
  • Workload: 8MB-scale embedding tables and KV cache transfers for generative recommendation
  • Target: <10ms latency for 8MB transfer, 400Gbps bandwidth saturation
  • Protocol: URMA provides RDMA-like memory semantics optimized for Kunpeng's on-die interconnect

Build & Compile

Prerequisites

  • OpenEuler 24.03 (LTS-SP3) download
  • UMDK installed: yum install umdk-urma-devel or build from source

CMake Configuration

# Clone Mooncake
git clone https://github.com/kvcache-ai/Mooncake.git
cd Mooncake

# Configure with UB transport enabled
mkdir build && cd build
cmake .. -DUSE_UB=ON \
         -DURMA_INCLUDE_DIR=/usr/include \
         -DURMA_LIBRARY=/usr/lib64/liburma.so

# Build
make -j$(nproc)

Verification

# Check UB transport is registered
./mooncake_server --list-transports
# Expected output: rdma, tcp, nvlink, ub

Run & Test

Single-node benchmark

# Terminal 1: Target
./transfer_engine_bench \
    --mode=target \
    --protocol=ub \
    --device_name=urma0 \
    --local_server_name=127.0.0.1 \
    --metadata_server=P2PHANDSHAKE

# Terminal 2: Initiator
./transfer_engine_bench \
    --mode=initiator \
    --protocol=ub \
    --device_name=urma0 \
    --metadata_server=P2PHANDSHAKE \
    --segment_size=8388608 \
    --batch_size=1\
    --segment_id=127.0.0.1:$PORT

Multi-device benchmark

# Discover multiple URMA devices
./transfer_engine_bench \
    --protocol=ub \
    --device_name=urma0,urma1,urma2,urma3

Phase Contribution Plan

Following suggestion, we propose four phased PRs for incremental review and integration:

  • Phase 1: Enable UbTransport + UrmaEndpoint ⬅️ Current PR

Review focus​: Transport interface compliance, WorkerPool design, error handling

mooncake-common/
   ├── common.cmake    # add USE_UB option
mooncake-transfer-engine/
   ├── include/
   │   └── mooncake/
   │       └── kunpeng_transport/
   │           ├── ub_transport.h     # Transport interface implementation
   │           ├── ub_context.h       # UbDevice Init and TaskPool scheduling And event polling
   │           ├── ub_endpoint.h      # ub device endpoint interface will imp
   │           └── urma_endpoint.h    # RMA Read/Write operations
   ├── src/
   │   └── kunpeng_transport/
   │       ├── CMakeLists.txt
   │       ├── ub_context.cpp
   │       ├── ub_transport.cpp
   │       └──  urma_endpoint.cpp
   ├── CMakeLists.txt     # USE_UB option integration ub_transport
   └── tests/
         └── ub_transport_test.cpp
  • Phase 2: CI/Testing Infrastructure With Kunpeng UB Hardware Env
  • Phase 3: Enable UbTransport + OBMM Feature
  • Phase 4: Next TE Tent Module Integration with UbTransport

Acknowledgments

Thanks to @stmatengss and the Mooncake team for the phased contribution guidance.
Ready for review: Phase 1 implementation is complete and tested. Please advise on any architectural adjustments before we proceed with detailed code review.

@stmatengss @alogfans @ascend-direct-dev

Module

  • Transfer Engine (mooncake-transfer-engine)
  • Mooncake Store (mooncake-store)
  • Mooncake EP (mooncake-ep)
  • Integration (mooncake-integration)
  • P2P Store (mooncake-p2p-store)
  • Python Wheel (mooncake-wheel)
  • PyTorch Backend (mooncake-pg)
  • Mooncake RL (mooncake-rl)
  • CI/CD
  • Docs
  • Other

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation update
  • Other

How Has This Been Tested?

Checklist

  • I have performed a self-review of my own code.
  • I have formatted my own code using ./scripts/code_format.sh before submitting.
  • I have updated the documentation.
  • I have added tests to prove my changes are effective.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the 'ub' (User-space Bridge) transport protocol, specifically integrating the URMA (User-space RDMA) implementation. The changes include new configuration parameters, metadata structures, and a complete transport implementation within the kunpeng_transport directory. The topology discovery mechanism has been updated to support UB devices, and example benchmarks now include 'ub' protocol support. Review feedback highlights several critical memory management issues, such as incorrect use of delete on std::shared_ptr and malloc-allocated memory, as well as the need to return Slice objects to their cache instead of deleting them. Logic errors were also identified where getters returning vectors by value were incorrectly used for modifications, and an off-by-one error was found in a bounds check.

Comment thread mooncake-transfer-engine/src/transport/kunpeng_transport/ub_transport.cpp Outdated
Comment thread mooncake-transfer-engine/src/transport/kunpeng_transport/ub_transport.cpp Outdated
Comment thread mooncake-transfer-engine/src/transport/kunpeng_transport/urma_endpoint.cpp Outdated
Comment thread mooncake-transfer-engine/src/transport/kunpeng_transport/urma_endpoint.cpp Outdated
Comment thread mooncake-transfer-engine/include/transport/kunpeng_transport/urma_endpoint.h Outdated
Comment thread mooncake-transfer-engine/include/transport/kunpeng_transport/ub_context.h Outdated
Comment thread mooncake-transfer-engine/src/topology.cpp Outdated
Comment thread mooncake-transfer-engine/src/transport/kunpeng_transport/urma_endpoint.cpp Outdated
@codecov-commenter

codecov-commenter commented Apr 2, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 3.22581% with 60 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mooncake-transfer-engine/src/transfer_metadata.cpp 4.16% 46 Missing ⚠️
...gine/example/transfer_engine_bench_with_notify.cpp 0.00% 6 Missing ⚠️
...-transfer-engine/example/transfer_engine_bench.cpp 0.00% 5 Missing ⚠️
mooncake-transfer-engine/src/config.cpp 0.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an initial UB (Unified Bus) transport implementation to Mooncake Transfer Engine, targeting Kunpeng platforms via the openEuler UMDK URMA APIs. It introduces new transport/context/endpoint codepaths, integrates UB into build + transport registration, and extends metadata/topology to support UB device discovery and connection handshakes.

Changes:

  • Introduce UbTransport with URMA-backed UrmaContext / UrmaEndpoint, plus worker pool + endpoint store.
  • Add USE_UB build option and wire UB transport into TE init, multi-transport registry, metadata encoding/handshake, and topology discovery.
  • Add a UB “test” executable and update example benchmarks to accept --protocol=ub.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
mooncake-transfer-engine/tests/ub_transport_test.cpp Adds a UB integration-style executable (currently behaves like a manual 2-process runner).
mooncake-transfer-engine/tests/CMakeLists.txt Registers ub_transport_test in build + CTest under USE_UB.
mooncake-transfer-engine/src/transport/kunpeng_transport/urma_endpoint.cpp Implements URMA context + endpoint (registration/import, jetty setup, posting/polling).
mooncake-transfer-engine/src/transport/kunpeng_transport/ub_transport.cpp Implements the Transport interface for UB and wires it to contexts + handshake.
mooncake-transfer-engine/src/transport/kunpeng_transport/ub_context.cpp Implements endpoint store + worker pool (post-send scheduling, polling, redispatch).
mooncake-transfer-engine/src/transport/kunpeng_transport/CMakeLists.txt Adds CMake target for UB transport sources + URMA linkage.
mooncake-transfer-engine/src/transport/CMakeLists.txt Adds kunpeng_transport subdir and objects into transport under USE_UB.
mooncake-transfer-engine/src/transfer_metadata.cpp Extends handshake + segment descriptor (encode/decode) for UB (EID, jetty_num, tseg).
mooncake-transfer-engine/src/transfer_engine_impl.cpp Auto-installs UB transport when USE_UB is enabled.
mooncake-transfer-engine/src/topology.cpp Adds UB device discovery via URMA + sysfs and switches CPU topology discovery under USE_UB.
mooncake-transfer-engine/src/multi_transport.cpp Registers "ub" protocol in MultiTransport.
mooncake-transfer-engine/src/config.cpp Extends env parsing to also populate UB JFC/JFCE config from MC_NUM_CQ_PER_CTX.
mooncake-transfer-engine/src/CMakeLists.txt Links UB transport target when USE_UB is enabled.
mooncake-transfer-engine/include/transport/transport.h Extends Transport::Slice union with UB-specific fields.
mooncake-transfer-engine/include/transport/kunpeng_transport/urma_endpoint.h Adds URMA context/endpoint declarations and URMA-specific helpers.
mooncake-transfer-engine/include/transport/kunpeng_transport/ub_transport.h Adds UB transport interface declaration.
mooncake-transfer-engine/include/transport/kunpeng_transport/ub_endpoint.h Adds abstract UB endpoint interface.
mooncake-transfer-engine/include/transport/kunpeng_transport/ub_context.h Adds UB context abstraction and worker pool / endpoint store declarations.
mooncake-transfer-engine/include/transfer_metadata.h Extends metadata structures for UB (EID, tseg/l_seg_index, jetty_num).
mooncake-transfer-engine/include/config.h Adds UB-related config fields (jfc/jfce counts, eid_index, max_seg_size, etc.).
mooncake-transfer-engine/example/transfer_engine_bench.cpp Adds UB transport install path and changes host free path for --protocol=ub.
mooncake-transfer-engine/example/transfer_engine_bench_with_retry.cpp Adds UB transport install path.
mooncake-transfer-engine/example/transfer_engine_bench_with_notify.cpp Adds UB transport install path.
mooncake-common/common.cmake Adds USE_UB option and compile definition.
Comments suppressed due to low confidence (1)

mooncake-transfer-engine/src/topology.cpp:490

  • When USE_UB is enabled, all_hca is a std::vector<UBDevice>, but discoverCudaTopology is declared to take const std::vector<InfinibandDevice>&. This call will not compile in CUDA/MUSA/HIP builds. Consider templating/overloading discoverCudaTopology for UBDevice, or using a shared device struct type for both RDMA and UB discovery paths.
#if defined(USE_CUDA) || defined(USE_MUSA) || defined(USE_HIP)
    for (auto &ent : discoverCudaTopology(all_hca)) {
        matrix_[ent.name] = ent;
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mooncake-transfer-engine/tests/ub_transport_test.cpp
Comment thread mooncake-transfer-engine/tests/ub_transport_test.cpp
Comment thread mooncake-transfer-engine/src/topology.cpp
Comment thread mooncake-transfer-engine/example/transfer_engine_bench.cpp
Comment thread mooncake-transfer-engine/src/transport/kunpeng_transport/ub_context.cpp Outdated
Comment thread mooncake-transfer-engine/tests/CMakeLists.txt
Comment thread mooncake-transfer-engine/src/transport/kunpeng_transport/urma_endpoint.cpp Outdated
Comment thread mooncake-transfer-engine/src/topology.cpp
@alogfans

alogfans commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

The usage guide should be included in the docs. In addition, what's the main advantage of using this approach, rather than other compatible xports?

@zchuango

zchuango commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator Author

The usage guide should be included in the docs. In addition, what's the main advantage of using this approach, rather than other compatible xports?

Sure, I will add some more details about the usage guide later. By the way, which directory should I write it to? @alogfans

Here are some of my thoughts on the advantages of the current proposal:

  1. It will improve and expand the current mainstream protocol framework of the TE module, enabling the mooncake TE to run on more communication protocols and related hardware, thus expanding the mooncake's application platform.
  2. The UB protocol is a peer-to-peer communication protocol comparable to NVlink, CXL, and RDMA. Currently, there is already hardware support on the Kunpeng 950 super node. Based on the UB protocol, we can implement a URMA component that supports DMA semantics, as well as an OBMM component that supports LD/ST semantics. As the technology evolves, these components can support core requirements for lower latency and higher bandwidth in model inference.

@alogfans @stmatengss welcome any suggestions for this issue. I am very happy to participate in the construction of the community ecosystem together.

@stmatengss

stmatengss commented Apr 5, 2026

Copy link
Copy Markdown
Collaborator

@zchuango

zchuango commented Apr 5, 2026

Copy link
Copy Markdown
Collaborator Author

Please fix this CI error.

https://github.com/kvcache-ai/Mooncake/actions/runs/23950310040/job/69858773912?pr=1805

@stmatengss could you please rerun it again? I haven't been able to pinpoint the problem yet. I tried running CI/Testing on my personal repository pull request zchuango#2 and it can run normally, so I suspect it might be an intermittent issue.

Comment thread mooncake-transfer-engine/include/config.h Outdated
Comment thread mooncake-transfer-engine/include/transfer_metadata.h
Comment thread mooncake-transfer-engine/src/config.cpp
@stmatengss

Copy link
Copy Markdown
Collaborator

Please update the documentation at https://github.com/kvcache-ai/Mooncake/tree/main/docs/source/design/transfer-engine or consider it as the next step.

Comment thread mooncake-transfer-engine/src/topology.cpp
@stmatengss

Copy link
Copy Markdown
Collaborator
image @alogfans Please double-check

@zchuango

zchuango commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator Author

Please update the documentation at https://github.com/kvcache-ai/Mooncake/tree/main/docs/source/design/transfer-engine or consider it as the next step.

Yes, I plan to update the documentation in the next step.

@alogfans
alogfans merged commit 6da2572 into kvcache-ai:main Apr 7, 2026
17 checks passed
A-Liuhao pushed a commit to A-Liuhao/Mooncake that referenced this pull request Jun 25, 2026
…ai#1805)

* add the support for ub transport

* refine the code format

* change some log for ub transport

* change ub_transport to kunpeng_transport

* add the support for ub transport

* refine the code format

* change some log for ub transport

* change ub_transport to kunpeng_transport

* clean some comments and unused code

* fix the config.h merge error

* fix the code with review suggestion

* add the usage docs and refine some code for code review

* fix some comments with chinese and modify the CMakeLists.txt file
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.

5 participants