Skip to content

[TE/TENT] Enable UB Transport in TENT on Kunpeng SuperNode (Phase 3) - #30

Open
zchuango wants to merge 116 commits into
mainfrom
UB_TENT
Open

[TE/TENT] Enable UB Transport in TENT on Kunpeng SuperNode (Phase 3)#30
zchuango wants to merge 116 commits into
mainfrom
UB_TENT

Conversation

@zchuango

@zchuango zchuango commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Description

Overview

This PR continues the phased UB transport work for Mooncake Transfer Engine on the Kunpeng SuperNode.

Phase 1 introduced the initial UbTransport and URMA endpoint implementation for the legacy Transfer Engine. Phase 2 added mock URMA support, unit tests, and CI/testing infrastructure for UB transport. This Phase 3 PR enables UB transport in TENT by adding a TENT-side UB transport adapter and the required control-plane integration.

This PR is submitted early to make the UB-in-TENT integration visible for incremental review. The current scope is to make UB recognizable, selectable, bootstrappable, and usable from TENT while reusing the existing legacy UbTransport data path. Follow-up commits may further refine the memory allocation/alignment path, metadata abstraction, and deeper TENT-native integration.

Related work:


Motivation

UB transport support already exists in the legacy Transfer Engine path, but TENT currently cannot select or drive UB as a first-class transport.

This prevents Kunpeng SuperNode UB hardware from being used through the newer TENT transport abstraction. To close this gap, this PR introduces a compatibility layer that maps TENT transport APIs, segment metadata, memory registration, transfer batches, bootstrap information, and status queries to the existing UB transport implementation.

The goal of this phase is not to rewrite the full URMA/UB data path. Instead, this PR provides a practical bridge so that UB can be used through TENT first, while leaving room for a more native TENT UB implementation later.


Major Changes

1. Add UB as a TENT transport type

This PR adds UB support to the TENT transport type system, including:

  • TransportType::UB
  • "ub" string parsing in the TENT selector
  • UB transport creation in the TENT transport loader
  • UB transport type exposure through pybind
  • CMake integration for the TENT UB transport target

This allows TENT to recognize UB as a selectable transport type.


2. Add UbTentTransport

This PR introduces UbTentTransport, a TENT transport adapter for the existing legacy UbTransport.

UbTentTransport implements the TENT transport interface and delegates UB data path operations to the legacy UbTransport.

It handles:

  • TENT transport installation and uninstallation
  • UB device selection
  • Local memory registration and unregistration
  • TENT buffer descriptor conversion
  • TENT batch allocation and release
  • TENT transfer request conversion
  • Transfer status query and status mapping

This keeps the existing URMA/UB data path mostly unchanged and limits this PR to the TENT integration layer.


3. Add UbTentMetadataBridge

Legacy UbTransport depends on the old TransferMetadata interface, while TENT uses SegmentManager and TENT-style segment descriptors.

This PR adds UbTentMetadataBridge to bridge the two metadata systems. The bridge is responsible for:

  • Looking up local and remote TENT segments
  • Converting TENT segment descriptors to legacy Transfer Engine segment descriptors
  • Extracting UB-specific transport attributes such as EID and remote segment information
  • Providing the metadata interface expected by legacy UbTransport

This allows the existing UB transport logic to work under the TENT segment management model.


4. Add UB bootstrap support to the TENT control plane

UB requires endpoint bootstrap information exchange before data transfer.

This PR adds a UB bootstrap path to the TENT control plane, including:

  • RpcFuncID::BootstrapUb
  • UB bootstrap descriptor structure
  • ControlClient::bootstrapUb()
  • ControlService::onBootstrapUb()
  • Callback registration support for UB bootstrap handling

With this change, UB endpoint bootstrap can be performed through the TENT control-plane RPC path.


5. Fix UB device selection and device_name propagation

This PR fixes UB device selection in the TENT path.

Before this change, device_name propagation was incomplete for UB, which could cause UB to discover or select the wrong device even when the expected UB device was provided by configuration or benchmark parameters.

This PR ensures that UB can use the configured device name, such as bonding_dev_0, through the TENT configuration path.

The intended selection order is:

  1. transports/ub/device_name
  2. MC_UB_DEVICE_NAME
  3. Automatic UB device discovery

This makes dual-node UB/TENT testing and production deployment more deterministic.


6. Improve URMA memory registration and cleanup behavior

During UB/TENT integration, several URMA resource lifetime issues were found and fixed.

This PR improves:

  • Page-aligned memory registration for URMA
  • Avoiding repeated registration of the same host virtual address across multiple URMA contexts
  • Reusing the primary registered segment where possible
  • Releasing local segment references before unregistering memory
  • Avoiding incorrect urma_uninit() usage during per-context teardown
  • Safer cleanup paths when initialization partially fails

These changes make UB transport more stable in real URMA environments.


7. Add tests and documentation

This PR adds TENT UB related tests and documentation, covering:

  • TENT UB transport install/uninstall path
  • Memory buffer registration and removal
  • Sub-batch allocation and release
  • Mock transfer submit and status query
  • Dual-node UB/TENT integration test entry
  • Phase 3 UB/TENT test guide

The dual-node test path is documented in:

mooncake-transfer-engine/tent/docs/ub_tent_transport_guide.md

Scope

This PR focuses on enabling UB transport inside TENT by adapting the existing UB implementation.

This PR does not redesign the full UB data path and does not introduce a full TENT-native UB backend. It also does not change the existing TENT RDMA slice-spraying implementation.

The current implementation should be understood as a Phase 3 compatibility/integration layer:

  • TENT can select UB.
  • TENT can bootstrap UB endpoints.
  • TENT can register UB memory.
  • TENT can submit transfer requests through UB.
  • The actual UB data path still reuses legacy UbTransport.

Current Limitations and Follow-up Work

Memory alignment and allocator integration

The current implementation fixes URMA registration stability with page-aligned memory handling and primary-context registration/adoption.

As follow-up work, we will evaluate whether this page-alignment logic should be moved to or replaced by a common allocator. This would avoid keeping transport-specific allocation/alignment logic scattered inside the UB/TENT adapter path.


TENT slice spraying integration

TENT’s design intends slice spraying to be a transport-agnostic scheduling capability at the TENT layer. The current upstream implementation mainly provides RDMA-oriented QoS and slice spraying.

This PR does not yet integrate UB into the TENT-native slice scheduling path. UB is currently exposed as a selectable TENT transport while reusing the legacy UB data path.

A deeper integration with TENT slice scheduling/QoS can be evaluated in follow-up work once the UB backend is refactored away from the legacy UbTransport adapter.


Metadata abstraction cleanup

This PR makes selected TransferMetadata methods virtual so that UbTentMetadataBridge can provide the metadata and bootstrap behavior expected by legacy UbTransport.

This is a practical bridge for Phase 3, but it is not necessarily the cleanest long-term abstraction. A future refactor may introduce a narrower UB metadata/handshake interface or decouple UbTransport from the legacy TransferMetadata dependency.


Native TENT UB backend

This PR is not a full TENT-native UB rewrite.

A native TENT UB backend, including deeper integration with TENT scheduling, QoS, and slice spraying, will be considered based on the evolution and stabilization of TENT transport/scheduler interfaces.


Module

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

Type of Change

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

How Has This Been Tested?

Build with UB and TENT enabled

mkdir -p build
cd build

cmake .. \
  -DUSE_UB=ON \
  -DUSE_TENT=ON \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo

cmake --build . -j$(nproc)

Run TENT UB unit tests

ctest -R ub_tent_transport_test --output-on-failure

Run UB transport tests

ctest -R ub_transport_test --output-on-failure

Dual-node UB/TENT validation

This PR has been validated on a dual-node Kunpeng UB setup with real UB devices.

The validation covers:

  • TENT-side UB transport selection
  • UB device_name propagation
  • UB endpoint bootstrap through TENT control-plane RPC
  • TENT segment publishing and lookup
  • URMA memory registration
  • End-to-end UB transfer through the TENT adapter path

The dual-node test procedure is documented in:

mooncake-transfer-engine/tent/docs/ub_tent_transport_guide.md

Test results

  • Unit tests pass
  • UB transport tests pass
  • Dual-node UB/TENT integration test passes
  • Manual validation on real Kunpeng UB hardware completed

Checklist

  • I have performed a self-review of my own code
  • I have formatted my code using ./scripts/code_format.sh
  • I have run pre-commit run --all-files and all hooks pass
  • I have updated the documentation
  • I have added tests to prove my changes are effective
  • For changes >500 LOC: I have filed or referenced related RFC / phased development issues or PRs

AI Assistance Disclosure

  • No AI tools were used
  • AI tools were used

AI tools were used to help draft and polish the PR description. The implementation, testing, and final verification are the responsibility of the human submitter.

dependabot Bot and others added 6 commits July 4, 2026 23:01
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.47.0 to 0.55.0.
- [Commits](golang/net@v0.47.0...v0.55.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.55.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* [TE] Add TPU (PJRT) staging support to TENT

Adds Google TPU support to the TENT transfer engine. TPU HBM is not
NIC-addressable, so transfers touching TPU memory are staged through host
DRAM and chained by the existing ProxyManager pipeline:

    TPU HBM <-> host DRAM (PJRT device copy)  ->  host <-> host (RDMA/TCP)

Rather than a standalone networked transport, this reuses ProxyManager's
chunked double-buffering / staging machinery and adds only:

  * MTYPE_TPU memory type + "tpu" location/type parsing.
  * TpuPlatform (derives CpuPlatform): host DRAM + NIC topology are
    inherited; only the TPU-device-aware paths (copy, getMemoryType,
    getLocation, per-device MemEntry probe) are overridden and delegated
    to a device-copy adapter.
  * A thin TpuTransport: the local HBM<->host staging executor. It only
    advertises gpu_to_dram / dram_to_gpu (gpu_to_gpu stays false so the
    engine always stages cross-node traffic through host DRAM) and runs
    the copy via Platform::copy for LOCAL_SEGMENT_ID requests. It is
    same-machine-only, like SHM/NVLINK.
  * A findStagingPolicy case for TPU: local HBM<->host via TpuTransport,
    host<->host via whichever host transport is present (RDMA or TCP;
    cloud TPU deployments are typically TCP/multi-NIC).

The PJRT device I/O (HBM<->host DMA, pointer classification, device
topology) sits behind TpuPjrtShim, which resolves an adapter shared
library at runtime via dlopen (C ABI in tpu_pjrt_abi.h). TENT therefore
carries no build-time PJRT/XLA dependency. The whole feature is gated
behind -DUSE_TPU (OFF by default), so CI and existing builds are
unaffected.

Includes a mock adapter + unit test that exercise the shim ABI on any
Linux host without TPU hardware, and a docs entry under supported
protocols.

Refs kvcache-ai#2662.
…in auto-selection (kvcache-ai#2741)

* [TransferEngine] Prefer private-range IPv4 GIDs over link-local IPv6 in auto-selection

Fixes kvcache-ai#2729.

isOverlayIPv4() classifies every RFC1918/CGNAT address as overlay, which
dropped routable 10.x datacenter-fabric GIDs into the same degraded tier
as link-local fe80:: GIDs; the lowest-gid-index tie-break then
deterministically picked the link-local entry (indices 0/1 on mlx5),
which can only ever work same-L2 and broke RoCEv2 deployments addressed
from 10/8.

Split the degraded tier instead of reordering anything else: private-range
IPv4-mapped GIDs (10/8, 172.16/12, 100.64/10) now rank in their own tier
strictly below genuinely routable GIDs and strictly above link-local /
overlay-named-interface GIDs. The interface-name overlay heuristic
(docker*/cni*/...) remains the strongest demotion signal. All pre-existing
cross-tier orderings are preserved; deployments that pin MC_GID_INDEX are
unaffected. For the topology reported in kvcache-ai#2729 this restores the effective
pre-4d7c1a19 selection.
…ai#2734)

When aclrtPointerGetAttributes returns an unknown location type, the
transport already falls back to host memory; INFO is sufficient and
avoids noisy error logs during normal operation.

Co-authored-by: lbjyx <youxiao@huawei.com>
alogfans and others added 29 commits July 13, 2026 14:37
…ic (kvcache-ai#2872)

* [TransferEngine] Add RDMA rail failover diagnostics

* Reformat

* Propose MC_TRACK_RDMA_POSTED_SLICES to track only in necessary
* feat(tent): add best-effort RDMA task cancellation

* fix(tent): harden rdma cancellation review issues

---------

Co-authored-by: 彦纾 <wangyanshu.wys@alibaba-inc.com>
…ache-ai#2625)

* Gate RDMA sends until peer QP readiness is confirmed

* Fix CI disk usage for RDMA ready ACK PR

* Guard RDMA ready ACK against disconnects

* Drop unrelated CI changes from RDMA ready ACK PR

* Model RDMA ready ACK wait as endpoint state

* Handle stale RDMA ready ACKs safely

* Clarify ready ACK capability marker

---------

Co-authored-by: leichao.lc <leichao.lc@antgroup.com>
…ache-ai#2821)

* [TENT] Add causal chain stage decomposition for transfer latency

Break end-to-end transfer latency into queue_wait → dispatch → transport
stages via TaskInfo::dispatch_time and post_time timestamps. Record each
stage into dedicated Prometheus histograms (tent_stage_queue_wait_us,
tent_stage_dispatch_us, tent_stage_transport_us).

Zero overhead when TENT_METRICS_ENABLED=0 (compile-time elimination).
Covers both runtime-queue path and direct-commit path.

* fix: correct include path and eliminate unused-variable warnings

- Fix tent/transport/transport.h → tent/runtime/transport.h in test
- Wrap causal chain block with #if TENT_METRICS_ENABLED to avoid
  unused-variable warnings when metrics are compile-time disabled

* fix: add concrete FakeSubBatch to avoid abstract class instantiation

* fix: rewrite causal_chain_test to match current Transport API

Use SubBatchRef (raw pointer), Config key-value store, and proper
install() signature matching runtime_queue_dispatch_test patterns.

* fix: remove LOCAL_SEGMENT_ID redefinition (already a macro in types.h)

* fix: complete causal chain metrics coverage

* test: include cstdlib in causal chain coverage

* test: keep metrics include at global scope

---------

Co-authored-by: 彦纾 <wangyanshu.wys@alibaba-inc.com>
Co-authored-by: Yanshu <237344440@qq.com>
* [TE] Add metadata refresh polling for segment cache

* [TE] Format metadata refresh code

Apply the repository C/C++ formatting rules using scripts/code_format.sh.

* [TE] Log segment cache sync duration

Record sync_duration_ms in the existing completion log to observe production refresh latency and guide polling interval tuning.

* [TE] Remove unrelated readFully test

---------

Co-authored-by: xianghang7 <xianghuang7@iflytek.com>
* feat(tent): bind transport policies to intent type

* chore(tent): initialize default policy qos fields

* test(tebench): add request intent flag

* fix: normalize benchmark intent type parsing

---------

Co-authored-by: 彦纾 <wangyanshu.wys@alibaba-inc.com>
…lica (kvcache-ai#2516)

* [store] Opt-in topology-aware remote replica scoring in SelectBestReplica (kvcache-ai#2516)

When the master returns multiple remote MEMORY replicas for a key,
SelectBestReplica kept the first one it encountered, so the choice among
otherwise-equivalent remote replicas was effectively arbitrary (master
return order). This adds an opt-in scoring hook to pick a better remote
replica instead.

  * Extract SelectBestReplica + helpers into replica_selection.h so the
    pure selection logic is unit-testable (was in an anonymous namespace
    inside real_client.cpp, unreachable from tests).
  * Add a ReplicaScorer injection point (SetRemoteReplicaScorer) plus a
    built-in protocol-priority scorer (prefer rdma over tcp). Richer
    signals (NIC role, NUMA distance, live load) live in the transfer
    engine and can be fed in via the scorer without mooncake-store taking
    a dependency on that layer.
  * Disabled by default: behaviour is byte-identical to the historical
    'first remote MEMORY' pick unless MC_STORE_REPLICA_SCORING=1 or a
    scorer is injected. Local replicas and non-MEMORY fallbacks are
    unchanged; ties keep master return order.
  * Add replica_selection_test with 7 cases covering base policy
    (unchanged), opt-in scoring, tie-break, incomplete-skip, and
    local-still-wins.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(replica_selection): guard scorer with shared_mutex to eliminate data race

Replace the bare static `std::function` with a `std::shared_mutex`-guarded
accessor pair (GetRemoteReplicaScorer / SetRemoteReplicaScorer). Readers
take a shared_lock and copy the scorer out; the copy is invoked outside the
lock. Writers take a unique_lock.

This eliminates the data race identified in review: concurrent operator=
(write) and operator()/operator bool (read) on the same std::function
object is undefined behavior and can cause SIGSEGV via a torn vtable
pointer.

Add ConcurrentSetAndSelectIsRaceFree stress test (8 readers × 1 writer,
50 000 write iterations) to validate thread-safety under contention.

Cluster-validated: 3.2M concurrent reader calls with zero crash/assert.

* style: fix clang-format violation in concurrent test

Extract the long method chain to a local variable to avoid a ternary
expression layout that clang-format-20 rejects.

* test(store): cover replica selection fallback paths

---------

Co-authored-by: 彦纾 <wangyanshu.wys@alibaba-inc.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
…e-ai#2831)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* [TENT] Opt-in deadline-aware NIC bandwidth arbitration (RFC kvcache-ai#2792)

Within a priority tier, when several flows contend for one NIC the bandwidth
is split blindly/equally today, with no way to give a flow about to miss its
deadline a larger share. This adds an opt-in, deadline-aware arbitration.

The ordering acts at the per-NIC-path slice-post point: after slices are
grouped by (local NIC -> remote NIC), they are sorted most-urgent-first by
predicted MLU (predicted transfer time / remaining deadline window, reusing
the MLU notion from kvcache-ai#2618) before submitSlices() hands them to the QP budget.
That is the point where same-tier flows actually contend for the shared NIC;
an earlier prototype that reordered at the priority-queue pop had no effect
because the QP budget, not the tier queue, is the contention point.

  * bw_arbitration.h: pure OrderByUrgency() policy (unit-testable, no RDMA
    deps) + PredictedMlu(). bw<=0 or no-deadline degrade to original order.
  * workers.cpp: opt-in wiring via transports/rdma/deadline_bw_arbitration
    (default false = byte-identical FIFO / equal split).
  * transfer_engine_bench: --deadline_us / --deadline_tight_threads to tag N
    threads as tight-deadline flows + per-flow tight/loose throughput report.
  * bw_arbitration_test: 7 cases (tighter-first, no-deadline-last, past-due,
    FIFO ties, zero-bandwidth no-op, size-weighting).

Measured (H20/ConnectX 200G RoCE, 2 nodes, 16 threads = 4 tight + 12 loose,
1 MB): tight flows 12.1 -> 44.6 GB/s (+269%), loose yield, total throughput
unchanged (48.4 GB/s). At light load it is a no-op, as intended.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix: arbitrate RDMA slices by slice length

* fix: reuse deadline arbitration scratch buffer

* bench: move deadline arbitration coverage to tebench

* bench: expose deadline arbitration toggle

---------

Co-authored-by: 彦纾 <wangyanshu.wys@alibaba-inc.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Yanshu <237344440@qq.com>
Co-authored-by: Feng Ren <alogfans@users.noreply.github.com>
…vcache-ai#2878)

* Update metadata for bad RNICs or GID changes

* Code format change

* Update GID change results
… Engine (kvcache-ai#2771)

New page docs/source/deployment/kubernetes-deployment-guide.md covering
four scenarios, modeled on the sgl-project/rbg mooncake examples, each in
vanilla-Kubernetes and RoleBasedGroup (RBG) form:

  A — standalone Mooncake Store cluster (master + N store nodes, no GPU)
  B — aggregated inference using the Store as HiCache L3
  C — P/D disaggregation with Store (HiCache) + Transfer Engine (SGLang)
  D — Transfer-Engine-only P/D KV transfer, no Store (master-free,
      P2PHANDSHAKE; corrects the rbg boilerplate header comment)

Includes three env/flag cheat-sheet tables (Store/HiCache, SGLang TE,
vLLM MooncakeConnector) kept as separate surfaces so TE-only deployments
do not inherit Store env, plus Notes on HA, TCP vs RDMA, and capacity.

Engine-client scenarios use the rbg worker/prefill buffer values
(5gb segment + 16777216 local buffer); LOCAL_BUFFER_SIZE=0 is documented
as valid only for pure store nodes. Metadata cleanup on client timeout is
framed as opt-in (--enable_metadata_cleanup_on_timeout, default false),
not enabled in the manifests.

Wires the page into the deployment toctree (index.md) and adds a short
Kubernetes stub cross-linking it from the Store deployment guide.

Build is warning-clean; all cross-doc anchors resolve.
…che-ai#2891)

* [TENT] Share SHM relocation mappings across threads

* Address SHM uninstall review feedback

* Address SHM relocation cache review feedback
…ache-ai#2892)

* [Bugfix] Reject invalid RDMA completion configuration

* Test zero-vector RDMA device rejection
…cy (kvcache-ai#2816)

* [TENT] Wire live RDMA bandwidth into admission queue degradation policy

Bridge the existing per-NIC EWMA bandwidth (DeviceSelector, updated on
every RDMA completion via relaxed atomics) into the admission queue's
BandwidthProvider.  When both `runtime_queue/deadline_aware` and
`runtime_queue/mlu_local_threshold` are configured, the queue uses real
transfer throughput to predict deadline feasibility and drop infeasible
owners — replacing the static mock that only existed in unit tests.

Design:
- Transport base gets `virtual double getEstimatedBandwidth() const`
- RdmaTransport overrides it: sums per-NIC EWMA via DeviceSelector
- TransferEngineImpl reads the two new config keys and calls
  setDegradationPolicy() with a lambda that invokes the above

Opt-in, default-off: without both config keys set, the code path is
never entered and all existing behavior is unchanged.

* style: fix clang-format-20 violation in LOG continuation

* fix: keep live bandwidth PR focused

* fix: avoid retaining rdma transport in bandwidth provider

* fix: scope live bandwidth to direct RDMA owners

* [TENT] Make RDMA degradation eligibility opt-in

* [TENT] Update admission queue degradation tests

---------

Co-authored-by: 彦纾 <wangyanshu.wys@alibaba-inc.com>
Co-authored-by: Yanshu <237344440@qq.com>
* Use std::atomic to support ARM64 coherence protocol

* Fix unlock()

* Code reformat

* Add spinlock tests
…pletions (kvcache-ai#2893)

* [Bugfix] Reject unsupported NVMe-oF task batches and aggregate status

* Address NVMe-oF completion review feedback
* tent: add receiver credit ledger model

* tent: initialize credit resource indices

* tent: fence replayed credit activations

* tent: add epoch-safe credit session cleanup

* [TENT] Document partial receiver credit grants

---------

Co-authored-by: 彦纾 <wangyanshu.wys@alibaba-inc.com>
* bench: add QoS metrics baseline to tebench

* bench: harden QoS metric test inputs

* bench: retain QoS metric inputs in JSONL

* perf: batch benchmark metric sample insertion

* fix(tebench): decouple QoS metrics from deadline policy

* [TENT] Move QoS metrics to common

---------

Co-authored-by: 彦纾 <wangyanshu.wys@alibaba-inc.com>
…rt (kvcache-ai#2921)

* [TENT] Fix mismatched cuFileBatchIOGetStatus semantics in gds transport

Co-authored-by: tong1heng <tongyiheng.tyh@antgroup.com>
Co-authored-by: foraxe <1055696449@qq.com>

* [TENT] Fix batch range status

Co-authored-by: tong1heng <tongyiheng.tyh@antgroup.com>
Co-authored-by: foraxe <1055696449@qq.com>

* [TENT] Fix loop boundary

Co-authored-by: tong1heng <tongyiheng.tyh@antgroup.com>
Co-authored-by: foraxe <1055696449@qq.com>

---------

Co-authored-by: tong1heng <tongyiheng.tyh@antgroup.com>
Co-authored-by: foraxe <1055696449@qq.com>
* Store: fix GPU-addressed local copy crashes

* test: cover CUDA local Store copy paths

* style: format local copy fix
---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Teng Ma <teng-ma@linux.alibaba.com>
Co-authored-by: Teng Ma <stmatengss@gmail.com>
…1 usage (kvcache-ai#2523)

* [TransferEngine] Share one dma_buf fd across all NICs to avoid ×N BAR1 usage

When KV-cache GPU memory is registered for RDMA across N NICs each NIC's
RdmaContext independently called cuMemGetHandleForAddressRange (or
hsa_amd_portable_export_dmabuf for HIP), producing N distinct dma_buf
kernel objects for the same physical allocation.  Whether those objects
share a single BAR1 window or each consume one depends on driver-side
dedup by physical range (the "×8 / ~632 GB worst case" scenario).

Fix: export a single dma_buf fd once per registerLocalMemory call and
import it into every NIC's protection domain before closing it.  One
kernel object means one BAR1 window by object identity — no driver dedup
required.

New static helpers on RdmaContext:
- exportDmabuf(addr, out)  — normalises to allocation base, exports fd
- closeDmabufExport(exp)   — idempotent fd close

registerMemoryRegion gains a shared-fd overload; the single-NIC path
(preTouchMemory, callers that hold one context) continues to export and
close inline.  registerLocalMemoryInternal in RdmaTransport now exports
once, fans the same DmabufExport out to all parallel registration
threads, then closes the fd after all threads are joined.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* [TransferEngine] Add hardware-free unit tests for DmabufExport

Covers DmabufExport struct defaults, closeDmabufExport (idempotency, real
fd close via pipe()), and exportDmabuf on host-memory addresses (malloc,
mmap-anonymous, stack) — the kHostReg fast-path exercised on every CI
runner without any RDMA device or GPU.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* [TransferEngine] Fix make_test_fd to use ASSERT_EQ via void+ref pattern

ASSERT_* macros expand to `return;` on failure so they only work in void
functions. The previous int-returning make_test_fd used EXPECT_EQ, meaning
a pipe() failure would continue with an uninitialized pipefd array —
undefined behaviour when closing or returning from it.

Refactor to return void and output the fd via a reference parameter so
ASSERT_EQ can abort the test immediately on failure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Format

Signed-off-by: Dao Le <daole@inferact.ai>

* Empty

---------

Signed-off-by: Dao Le <daole@inferact.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Feng Ren <alogfans@users.noreply.github.com>
…vcache-ai#2879)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.