mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[PR #502] [MERGED] [TransferEngine] Enable Huawei Ascend Transport for TransferEngine #1610
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#1610
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/Mooncake/pull/502
Author: @AscendTransport
Created: 6/16/2025
Status: ✅ Merged
Merged: 7/1/2025
Merged by: @ShangmingCai
Base:
main← Head:main📝 Commits (4)
b2879cbAscend Transport50b467eMerge branch 'main' into main0eaa333fix ci930ae39reviewed changes📊 Changes
27 files changed (+3557 additions, -0 deletions)
View changed files
➕
doc/en/ascend_transport.md(+145 -0)➕
doc/zh/ascend_transport.md(+94 -0)📝
mooncake-common/common.cmake(+17 -0)📝
mooncake-integration/transfer_engine/transfer_engine_py.cpp(+2 -0)📝
mooncake-transfer-engine/CMakeLists.txt(+22 -0)📝
mooncake-transfer-engine/example/CMakeLists.txt(+13 -0)➕
mooncake-transfer-engine/example/transfer_engine_ascend_one_sided.cpp(+421 -0)➕
mooncake-transfer-engine/example/transfer_engine_ascend_perf.cpp(+354 -0)📝
mooncake-transfer-engine/include/common.h(+40 -0)📝
mooncake-transfer-engine/include/transfer_metadata.h(+14 -0)➕
mooncake-transfer-engine/include/transport/ascend_transport/hccl_transport/hccl_transport.h(+102 -0)➕
mooncake-transfer-engine/include/transport/ascend_transport/hccl_transport/hccl_transport_mem_c.h(+118 -0)📝
mooncake-transfer-engine/include/transport/transport.h(+3 -0)📝
mooncake-transfer-engine/src/CMakeLists.txt(+9 -0)📝
mooncake-transfer-engine/src/multi_transport.cpp(+8 -0)📝
mooncake-transfer-engine/src/transfer_engine.cpp(+16 -0)📝
mooncake-transfer-engine/src/transfer_metadata.cpp(+67 -0)📝
mooncake-transfer-engine/src/transport/CMakeLists.txt(+5 -0)➕
mooncake-transfer-engine/src/transport/ascend_transport/CMakeLists.txt(+21 -0)➕
mooncake-transfer-engine/src/transport/ascend_transport/hccl_transport/ascend_transport_c/CMakeLists.txt(+39 -0)...and 7 more files
📄 Description
Ascend Transport
The source code path for Ascend Transport is
Mooncake/mooncake-transfer-engine/src/transport/ascend_transport, which also includes automated build scripts and the README file.Overview
Ascend Transport is a high-performance zero-copy NPU data transfer library with one-sided semantics, directly compatible with Mooncake Transfer Engine. To compile and use the Ascend Transport library, please set the
USE_ASCENDflag to"ON"in themooncake-common/common.cmakefile.Ascend Transport supports inter-NPU data transfer using one-sided semantics (currently supports Device to Device; other modes are under development). Users only need to specify the node and memory information at both ends through the Mooncake Transfer Engine interface to achieve high-performance point-to-point data transfer. Ascend Transport abstracts away internal complexities and automatically handles operations such as establishing connections, registering and exchanging memory, and checking transfer status.
New Dependencies
In addition to the dependencies already required by Mooncake, Ascend Transport needs some HCCL-related dependencies:
MPI
One-Step Build Script
Ascend Transport provides a one-step build script located at
Mooncake/mooncake-transfer-engine/src/transport/ascend_transport/scripts/build_all_with_dependencies.sh. Copy this script to the desired installation directory and run it. You can also pass an installation path as an argument; if not provided, it defaults to the current directory:This script also supports environments where users cannot perform
git clonedirectly. Users can place the source code for dependencies and Mooncake in the target directory, and the script will handle the compilation accordingly.One-Step Installation Script (Without Building Mooncake)
To avoid potential conflicts when running other processes during Mooncake compilation, Ascend Transport offers a solution that separates the build and runtime environments.
After completing the Mooncake build via build_all_with_dependencies.sh, you can run setup_basic_dependencies.sh to install only the required dependencies. Place the generated Mooncake .whl package and libascend_transport_mem.so into the installation directory.
Copy the script to the installation directory and run:
Before use, ensure that
libascend_transport_mem.sohas been copied to/usr/local/Ascend/ascend-toolkit/latest/python/site-packages, then execute:Build Instructions
Once all dependencies are installed successfully, you can proceed with building Mooncake normally. If errors occur, try setting the following environment variable:
Endpoint Management
Each Huawei NPU card has a dedicated parameter-plane NIC and should be managed by a single
TransferEngineinstance responsible for all its data transfers.Ranktable Management
Ascend Transport does not rely on global Ranktable information. It only needs to obtain the local Ranktable information of the current NPU card. During the initialization of Ascend Transport, it will automatically parse the /etc/hccn.conf file to acquire this information.
Initialization
When using Ascend Transport, the
TransferEnginemust still call theinitfunction after construction:The only difference is that the
local_server_nameparameter must now include the physical NPU card ID. The format changes fromip:porttoip:port:npu_x, e.g.,"0.0.0.0:12345:npu_2".Metadata Service
Ascend Transport is compatible with all metadata services currently supported by Mooncake, including
etcd,redis,http, andp2phandshake. Upon initialization, Ascend Transport registers key NPU card information such asdevice_id,device_ip,rank_id, andserver_ip.Data Transfer
Ascend Transport supports write/read semantics and automatically determines whether cross-HCCS communication is needed, selecting either HCCS or ROCE as the underlying transport protocol. Users can use the standard Mooncake
getTransferStatusAPI to monitor the progress of each transfer request.Fault Handling
Building upon HCCL’s built-in fault handling mechanisms, Ascend Transport implements comprehensive error recovery strategies across multiple stages, including initialization, connection setup, and data transfer. It incorporates retry logic and returns precise error codes based on HCCL collective communication standards when retries fail. For detailed logs, refer to
/root/Ascend/log/plog.Test Cases
Ascend Transport provides two test files:
mooncake-transfer-engine/example/transfer_engine_ascend_one_sided.cppmooncake-transfer-engine/example/transfer_engine_ascend_perf.cppYou can configure various scenarios (e.g., 1-to-1, 1-to-2, 2-to-1) and performance tests by passing valid parameters to these programs.
Example Commands for Scenario Testing
Start Initiator Node:
Start Target Node:
Example Commands for Performance Testing
Start Initiator Node:
Start Target Node:
Print Description
If you need to obtain information about whether each transport request is cross-hccs and its corresponding execution time, you can enable the related logs by setting the environment variable. Use the following command to turn on the logging:
Notes
ascned_transport will establish a TCP connection on the host side.This connection uses port (10000 + deviceId). Please avoid using this port for other services to prevent conflicts.
ascned_transport has an automatic reconnection mechanism in place that triggers after a transfer is completed, in case the remote end goes offline and restarts. There is no need to manually restart the local service.
Note If the target end goes offline and restarts, the initiating end will attempt to re-establish the connection when it sends the next request. The target must complete its restart and become ready within 5 seconds after the initiator sends the request. If the target does not become available within this window, the connection will fail and an error will be returned.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.