Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -793,13 +793,17 @@ jobs:
build_targets: ''
# Exercise the native UB target with its injected mock adapter. A
# Debug build also catches ODR/link errors hidden by optimization.
# USE_UB_MOCK adds the test-only loopback URMA adapter for focused
# TENT and Store tests without UB hardware.
- name: ub-mock
cmake_flags: >-
-DUSE_CUDA=OFF -DUSE_UB=ON -DCMAKE_BUILD_TYPE=Debug
-DWITH_STORE=OFF -DWITH_STORE_RUST=OFF
-DUSE_CUDA=OFF -DUSE_UB=ON -DUSE_UB_MOCK=ON
-DCMAKE_BUILD_TYPE=Debug -DWITH_STORE_RUST=OFF
need_cuda: false
metrics_flags: ''
build_targets: ''
build_targets: >-
mooncake-transfer-engine/all
store_tent_ub_mock_test
# Compile against stub ACL headers and embed host-only ACL stubs in
# transfer_engine for Rust checks; no CANN, NPU, or libmf_smem is required.
- name: memfabric-mock
Expand Down Expand Up @@ -912,6 +916,15 @@ jobs:
-R '^transfer_task_tent_shared_segment_test$'
shell: bash

# The hugepage case skips itself when the runner grants no hugepages.
- name: Test Store over the TENT UB loopback adapter
if: matrix.name == 'ub-mock'
run: |
sudo sysctl -w vm.nr_hugepages=64 || true
ctest --test-dir build-tent --output-on-failure --no-tests=error \
-R '^store_tent_ub_mock_test$'
shell: bash

# Only run tests on the cuda-off leg. GitHub runners have no real GPU;
# with USE_CUDA=ON tent's cuda_probe hits the CUDA stub library at
# runtime and drives some dispatch paths past the fake objects the
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ endif()
option(WITH_STORE "build mooncake store library and sample code" ON)
option(WITH_STORE_GO "build Go bindings for mooncake store" OFF)
option(WITH_CONDUCTOR "build mooncake conductor service" OFF)
option(WITH_CONDUCTOR_GO "build Go bindings for mooncake conductor" OFF)
option(WITH_CONDUCTOR_C_SHARED
"build the conductor client C ABI shared library" OFF)
if((WITH_CONDUCTOR_GO OR WITH_CONDUCTOR_C_SHARED) AND NOT WITH_CONDUCTOR)
message(FATAL_ERROR "Conductor language bindings require WITH_CONDUCTOR=ON")
endif()
option(WITH_P2P_STORE "build p2p store library and sample code" OFF)
option(WITH_RUST_EXAMPLE
"build the Rust interface and sample code for the transfer engine" OFF)
Expand Down
125 changes: 95 additions & 30 deletions README.md

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions docs/source/performance/mooncake/tebench.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ and the data fill and verify of `--check_consistency`. `Avg Tx`, `P99 Tx`,
`P999 Tx`, and `Avg Inst GB/s` time only the transfer itself, from submit to
completion.

A short (~1 second) warmup phase is executed before measurements begin.
Each case warms up for `--warmup_ms` milliseconds (1000 by default) before
measurements begin. Use `--warmup_ms=0` to measure without warmup, including
the cost of the first transfer. All worker threads still synchronize before
starting the measured workload.

### 4.1 QoS Metrics Baseline

Expand Down Expand Up @@ -301,7 +304,7 @@ When set, each completed transfer appends one JSON line:
| Field | Meaning |
| ----- | ------- |
| `block_size`, `batch_size` | Shape of the transfer, identifying the sweep point |
| `warmup` | `true` for transfers in the 1 s warmup before measurement |
| `warmup` | `true` for transfers in the configured warmup before measurement |
| `submit_us` | Time in `submitTransfer`, in microseconds with ns precision |
| `wait_us` | Time from submit return until the batch reports COMPLETED, in microseconds with ns precision |
| `polls` | Number of status polls in that wait |
Expand Down Expand Up @@ -396,6 +399,7 @@ Example:
* `--start_batch_size`, `--max_batch_size` : batch size sweep (powers of two)
* `--start_num_threads`, `--max_num_threads` : thread sweep (powers of two)
* `--duration` : measurement time per case (seconds)
* `--warmup_ms` : warmup time per case (milliseconds; default 1000, 0 disables)

Each thread owns one fixed region in its local buffer and one in its target
buffer, sized for the largest operation (`max_block_size × max_batch_size`, or
Expand Down
Binary file added image/ecosystem/atom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/awex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/chitu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/dynamo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/fastdeploy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/gpustack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/lightx2v.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/llm-d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/lmcache.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/lmdeploy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/miles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/mstar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/pytorch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/sglang-omni.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/sglang.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/slime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/specforge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/tokenspeed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/ucm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/vllm-ascend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/vllm-omni.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/vllm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/ecosystem/xllm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/hardwares/enflame_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified image/hardwares/supported_hardware.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions mooncake-common/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ option(USE_MNNVL "option for using Multi-Node NVLink transport" OFF)
option(USE_CXL "option for using CXL protocol" OFF)
option(USE_EFA "option for using AWS EFA transport" OFF)
option(USE_UB "option for using UB protocol transport" OFF)
option(
USE_UB_MOCK
"test-only: build TENT UB with an in-process loopback URMA adapter, enabled at runtime by MC_TENT_UB_MOCK=1; never use in production builds"
OFF)
if(USE_UB_MOCK AND NOT USE_UB)
message(FATAL_ERROR "USE_UB_MOCK requires USE_UB=ON")
endif()
option(USE_SUNRISE
"option for enabling gpu features for Sunrise GPU with Tang runtime" OFF)
option(USE_ENFLAME
Expand Down
44 changes: 44 additions & 0 deletions mooncake-conductor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ endif()

find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED COMPONENTS Crypto)
option(WITH_CONDUCTOR_GO "build Go bindings for mooncake conductor" OFF)
option(WITH_CONDUCTOR_C_SHARED
"build the conductor client C ABI shared library" OFF)

# Standalone builds own their dependencies; the top-level build provides this
# target before adding Conductor and Store.
Expand Down Expand Up @@ -133,6 +136,47 @@ else()
"conductor: SHA-256 backend = EVP (low-level API unavailable or forced)")
endif()

if(WITH_CONDUCTOR_C_SHARED OR WITH_CONDUCTOR_GO)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(FATAL_ERROR "Conductor C shared library currently supports Linux")
endif()
include(GNUInstallDirs)
add_library(mooncake_conductor_client SHARED src/client/conductor_c.cpp)
target_link_libraries(mooncake_conductor_client PRIVATE conductor_cpp_core)
set_target_properties(
mooncake_conductor_client
PROPERTIES VERSION 1.0.0
SOVERSION 1
INSTALL_RPATH "$ORIGIN"
LINK_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/src/client/conductor_c.map")
target_link_options(
mooncake_conductor_client
PRIVATE
"LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/client/conductor_c.map"
)
install(TARGETS mooncake_conductor_client
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES include/conductor/client/conductor_c.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/conductor/client)
endif()

if(WITH_CONDUCTOR_GO)
find_program(CONDUCTOR_GO_EXECUTABLE go)
if(NOT CONDUCTOR_GO_EXECUTABLE)
message(FATAL_ERROR "WITH_CONDUCTOR_GO=ON requires the Go compiler")
endif()
add_custom_target(
build_conductor_go ALL
COMMAND
${CMAKE_COMMAND} -E env "GO=${CONDUCTOR_GO_EXECUTABLE}" bash
${CMAKE_CURRENT_SOURCE_DIR}/go/build.sh ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/mooncake-conductor-go-example
DEPENDS mooncake_conductor_client
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/go
VERBATIM)
endif()

if(BUILD_UNIT_TESTS)
enable_testing()
add_subdirectory(tests)
Expand Down
18 changes: 18 additions & 0 deletions mooncake-conductor/go/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0

set -euo pipefail
if [ "$#" -ne 2 ]; then
echo "Usage: $0 CONDUCTOR_BUILD_DIR OUTPUT_BINARY" >&2
exit 1
fi
conductor_build=$(cd "$1" && pwd)
output_binary=$2
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Match Store's cgo build: provide native header and library paths explicitly.
export CGO_CFLAGS="-I${script_dir}/../include${CGO_CFLAGS:+ $CGO_CFLAGS}"
export CGO_LDFLAGS="-L${conductor_build} -lmooncake_conductor_client${CGO_LDFLAGS:+ $CGO_LDFLAGS}"
export CGO_ENABLED=1
cd "$script_dir"
"${GO:-go}" build -o "$output_binary" ./examples/basic
42 changes: 42 additions & 0 deletions mooncake-conductor/go/examples/basic/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: Apache-2.0
package main

import (
"encoding/json"
"flag"
"fmt"
"log"

conductor "github.com/kvcache-ai/Mooncake/mooncake-conductor/go/mooncakeconductor"
)

func main() {
addr := flag.String("addr", "127.0.0.1:13334", "Conductor RPC address")
model := flag.String("model", "model", "registered model name")
block := flag.Int64("block-size", 16, "registered prefix block size")
flag.Parse()
if err := run(*addr, *model, *block); err != nil {
log.Fatal(err)
}
}

func run(addr, model string, block int64) error {
client, err := conductor.New()
if err != nil {
return err
}
defer client.Close()
if err = client.Setup(conductor.ClientConfig{Address: addr}); err != nil {
return err
}
result, err := client.Query(conductor.QueryRequest{ModelName: model, BlockSize: block, TokenIDs: []int32{1, 2, 3}})
if err != nil {
return err
}
data, err := json.Marshal(result)
if err != nil {
return err
}
fmt.Println(string(data))
return nil
}
3 changes: 3 additions & 0 deletions mooncake-conductor/go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/kvcache-ai/Mooncake/mooncake-conductor/go

go 1.23
145 changes: 145 additions & 0 deletions mooncake-conductor/go/mooncakeconductor/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
// Copyright 2026 KVCache.AI
// SPDX-License-Identifier: Apache-2.0
// Package mooncakeconductor provides a synchronous Conductor RPC client.
package mooncakeconductor

import (
"sync"
"time"
)

// Client serializes operations on one RPC connection. Use separate clients for
// parallel requests. Do not copy a Client after first use. Close it explicitly.
type Client struct {
mu sync.Mutex
native *nativeClient
}

func New() (*Client, error) {
n, err := newNative()
if err != nil {
return nil, err
}
return &Client{native: n}, nil
}

func timeoutMillis(value, fallback time.Duration) (int64, error) {
// Native setup treats any negative timeout as disabled.
if value < 0 {
return -1, nil
}
// Rounded milliseconds must remain representable as native nanoseconds.
if value > time.Duration((1<<63-1)/int64(time.Millisecond))*time.Millisecond {
return 0, &Error{Op: "setup", Code: InvalidParams}
}
if value == 0 {
value = fallback
}
ms := int64(value / time.Millisecond)
if value%time.Millisecond != 0 {
ms++
}
return ms, nil
}

// Setup replaces any previous connection, including on failure. Zero timeouts
// use 1s/3s defaults; negative timeouts disable the timeout. After Close,
// Setup creates a fresh native client.
func (c *Client) Setup(config ClientConfig) error {
c.mu.Lock()
defer c.mu.Unlock()
connect, err := timeoutMillis(config.ConnectTimeout, time.Second)
var request int64
if err == nil {
request, err = timeoutMillis(config.RequestTimeout, 3*time.Second)
}
if err != nil {
// Native Setup closes the old connection on valid Go input. Validation
// failures must also leave the previous connection unavailable.
if c.native != nil {
if closeErr := c.native.disconnect(); closeErr != nil {
return closeErr
}
}
return err
}
if c.native == nil {
c.native, err = newNative()
if err != nil {
return err
}
}
return c.native.setup(config.Address, connect, request)
}

// Close releases client resources only; it does not unregister any publisher.
// It waits for an in-flight operation and is idempotent.
func (c *Client) Close() error {
c.mu.Lock()
defer c.mu.Unlock()
if c.native == nil {
return nil
}
err := c.native.close()
c.native = nil
return err
}

// HealthCheck probes RPC reachability, not event progress or engine health.
func (c *Client) HealthCheck() (HealthStatus, error) {
c.mu.Lock()
defer c.mu.Unlock()
if c.native == nil {
return NotInitialized, nil
}
return c.native.health()
}

func unavailable(op string) error { return &Error{Op: op, Code: ConductorUnavailable} }

func (c *Client) Register(config ServiceConfig) (RegisterResult, error) {
c.mu.Lock()
defer c.mu.Unlock()
if c.native == nil {
return RegisterResult{}, unavailable("register")
}
return c.native.register(config)
}

func (c *Client) Unregister(instanceID, tenantID string, dpRank int32) (UnregisterResult, error) {
c.mu.Lock()
defer c.mu.Unlock()
if c.native == nil {
return UnregisterResult{}, unavailable("unregister")
}
return c.native.unregister(instanceID, tenantID, dpRank)
}

// Query sends raw tokens. Do not mutate TokenIDs during the call. RequestTimeout
// applies to the native RPC, not time waiting for another operation's mutex.
func (c *Client) Query(request QueryRequest) (QueryResult, error) {
c.mu.Lock()
defer c.mu.Unlock()
if c.native == nil {
return QueryResult{}, unavailable("query")
}
return c.native.query(request)
}

func (c *Client) GetGlobalView() (GlobalView, error) {
c.mu.Lock()
defer c.mu.Unlock()
if c.native == nil {
return GlobalView{}, unavailable("get_global_view")
}
return c.native.global()
}

func (c *Client) ListServices() ([]RegisteredService, error) {
c.mu.Lock()
defer c.mu.Unlock()
if c.native == nil {
return nil, unavailable("list_services")
}
return c.native.list()
}
Loading
Loading