Skip to content

[TENT] Add intra-node PCIe P2P copies between Intel XPUs - #4379

Merged
alogfans merged 3 commits into
kvcache-ai:mainfrom
XinyuYe-Intel:feat/xpu-pcie-p2p
Oct 23, 2026
Merged

alogfans merged 3 commits into
kvcache-ai:mainfrom
XinyuYe-Intel:feat/xpu-pcie-p2p

Conversation

@XinyuYe-Intel

@XinyuYe-Intel XinyuYe-Intel commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

This is PR5 of the Intel XPU enablement series (RFC #4031; PR1 #4030 TENT
XPU platform, PR2 #4157 XPU transport + routing + host staging, PR3 #4270
Mooncake Store client, PR4 #4378 GPUDirect dma-buf RDMA). It adds intra-node
VRAM-to-VRAM copies between Intel XPUs to the Transfer Engine, using PCIe /
Xe Link peer access where the driver grants it and a host bounce otherwise —
within one process, and across processes on the same node via Level Zero IPC
handles.

Why. After PR2/PR4 the only way for two XPU processes on the same host
to exchange VRAM is through a network transport: dma-buf RDMA when an RNIC
is present, otherwise a D2H → TCP → H2D host bounce. This PR gives same-node
XPU↔XPU traffic a third route that needs neither:

  • Same-node P/D without an RNIC. Arc Pro B60 boxes are commonly
    deployed without RoCE. Today those nodes pay the host-staging path for
    every KV transfer ([TENT] Add Intel XPU GPUDirect dma-buf RDMA to the Transfer Engine #4378 measured it at ~4 GB/s vs ~15 GB/s direct for a
    64 MB read — and that was with an RNIC carrying the middle hop; over TCP
    it is slower still, and it grows linearly with KV size); with this PR they
    do a single PCIe/Xe Link copy.
  • Keeps same-node traffic off the NIC. Where an RNIC exists, local KV
    movement no longer competes with genuine cross-node traffic for NIC
    bandwidth or the NIC's PCIe lanes, and needs no RDMA queue pairs or MR
    lookups per transfer.
  • Xe Link scaling. On parts with Xe Link (Data Center GPU Max) the peer
    copy runs at fabric rate rather than being capped at the NIC's line rate.
    Not demonstrable on B60 (PCIe only), where the two routes are both
    PCIe-bound and measure at parity — see results below.

The network routes are unchanged and remain the fallback: cross-node stays
on RDMA/staging, and any same-node import failure (typically missing ptrace
permission) falls back to them transparently. transports/xpu/disable_ipc
turns the new route off.

Stacked on #4378. Until PR4 merges this PR shows the PR4 commit as
well; the single commit under review here is
[TENT] Add intra-node PCIe P2P copies between Intel XPUs.

Platform (platform/xpu)

  • XpuSyclBackend::init() probes every ordered pair of Level Zero devices with
    sycl_ext_oneapi_peer_access (ext_oneapi_can_access_peer →
    ext_oneapi_enable_peer_access) and records an n×n peer matrix. Pairs the
    driver refuses are simply left disabled.
  • New XpuSyclBackend::copyD2D(): same device or peer access in either
    direction → one queue::memcpy on the accessing device (push from the
    source, or pull from the destination); no peer access → chunked bounce
    through host memory (8 MB chunks). Interior pointers resolve through the
    existing allocation registry, foreign USM through get_pointer_type.
  • XpuPlatform::copy() device→device now succeeds (was NotImplemented).
  • Two enumeration fixes found on hardware and included here since the P2P path
    depends on them:
    • The oneAPI runtime exposes each Intel GPU through both Level Zero and
      OpenCL. init() now keeps only the Level Zero view when one exists, so a
      2-GPU node advertises xpu:0/xpu:1 rather than four nodes. (The OpenCL
      adapter also ur_die-aborts the process instead of throwing when asked
      about peer access, so the probe is Level Zero only.)
    • icpx 2026.1 ships the peer-access API but does not define the
      SYCL_EXT_ONEAPI_PEER_ACCESS feature macro; guarding on it silently
      compiled the whole probe out. USE_XPU already requires DPC++, so the
      call is made unconditionally.

Transport / routing

  • XpuTransport advertises gpu_to_gpu and startTransfer accepts requests
    where both sides are XPU VRAM (previously an error). Cross-node VRAM traffic
    stays on RDMA (PR4) or staging (PR2).

Cross-process IPC

  • XpuPlatform::exportIpc / importIpc / closeImport wrap
    zeMemGetIpcHandle / zeMemOpenIpcHandle / zeMemCloseIpcHandle. The
    importer fetches the exporter's dma-buf descriptor itself with
    pidfd_getfd(2) (like MnnvlTransport) and rewrites the handle so the
    compute runtime takes its plain fd import path. The runtime's opaque-handle
    path keeps a per-(fd, pid, offset) import cache that is never invalidated
    when the importer closes a mapping, so once the exporter frees and
    reallocates onto the same fd number the peer silently maps the stale buffer;
    the fd path has no such cache. Verified against intel/compute-runtime
    source and reproduced on B60 with driver 1.17.
  • XpuTransport::addMemoryBuffer publishes
    "<pid>-<base>-<size>-<handle hex>-<pidns>-<generation>" as the XPU
    transport attribute for every registered xpu:* buffer (the generation
    counts registrations, so a freed and reallocated buffer that comes back
    with the same address, size and descriptor number is never mistaken for
    the one already mapped); prepareRemoteBuffer maps a peer's buffer on
    first use (same machine-id and pid namespace, range check, one mapping per
    exporter allocation, negative cache per attribute and local device). A
    mapping superseded by a re-registration is withdrawn from lookup but kept
    until uninstall, since an in-flight transfer may still be copying through
    it; uninstall closes everything.
  • TransportSelector routes a same-machine XPU target that carries the
    attribute through XPU instead of the host network transport; the engine
    passes the mapped address to the local copy. transports/xpu/disable_ipc
    turns this off; an import failure (EPERM from pidfd_getfd when Yama
    ptrace_scope ≥ 2, a different user or a non-dumpable exporter) falls
    back to the network path with a hint in the log. With the default
    ptrace_scope 1 no capability is needed: the Level Zero runtime marks
    its processes PR_SET_PTRACER_ANY, so any same-user process in the pid
    namespace may import.

Tests

  • xpu_platform_test: DeviceToDeviceCopyOnSameDevice,
    DeviceToDeviceCopyAcrossDevices (8 MB + interior offset, byte-exact; skips
    with fewer than two devices), ProbeDoesNotDuplicateGpusAcrossAdapters.
  • xpu_transport_test: FailsWhenBothSidesAreDeviceMemory replaced by
    CopiesDeviceToDevice; ReRegistrationPublishesDistinctIpcAttribute.
  • xpu_engine_test: XpuLocalDeviceCopyTest.{SameDevice,AcrossDevices} over
    all network/dispatch modes — route must be XPU with empty
    staging_params, transfer completes and reads back the seed.
  • transport_selector_test: local XPU↔XPU resolves to XPU; the same pair
    with local_segment=false resolves to UNSPEC; a same-machine peer
    carrying the IPC attribute resolves to XPU.
  • IPC: xpu_platform_test export/import round trips on the same and the peer
    device, refused ranges, stale-mapping regression; xpu_engine_test
    XpuIpcEngineTest (two engines in one process, route XPU, byte-exact
    read+write, disable_ipc restores the TCP route); new
    tent_xpu_ipc_process_test re-executes itself as a peer process and
    transfers against the peer's VRAM (skips without a GPU or without ptrace
    permission); its XpuIpcFallbackTest fixture makes the peer non-dumpable
    so the import is refused and checks the engine quietly takes the staged
    network route (skips when the test itself holds CAP_SYS_PTRACE).

Docs: USE_XPU build option row, the GPU-Direct admonition and the Intel
XPU note in supported-protocols (IPC path, disable_ipc, ptrace_scope
requirement).

Module

  • Transfer Engine (mooncake-transfer-engine)
  • Mooncake Store (mooncake-store)
  • Mooncake Conductor (mooncake-conductor)
  • Reshard (mooncake-reshard)
  • 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?

Test commands:

# XPU build (icpx) on a node with 2x Intel Arc Pro B60
. /opt/intel/oneapi/setvars.sh
cmake -G Ninja -S . -B build-xpu -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx \
  -DUSE_TENT=ON -DUSE_XPU=ON -DBUILD_UNIT_TESTS=ON \
  -DWITH_STORE=OFF -DWITH_STORE_RUST=OFF -DWITH_P2P_STORE=OFF
cmake --build build-xpu
cd build-xpu/mooncake-transfer-engine/tent/tests
./tent_xpu_platform_test
./tent_xpu_transport_test
./tent_xpu_engine_test
./tent_xpu_ipc_process_test   # needs ptrace permission over the child peer
./tent_transport_selector_test

# GCC (USE_XPU=OFF) -- shared selector/engine changes must build and pass without icpx
cmake -G Ninja -S . -B build -DUSE_TENT=ON -DUSE_XPU=OFF -DBUILD_UNIT_TESTS=ON \
  -DWITH_STORE=OFF -DWITH_STORE_RUST=OFF -DWITH_P2P_STORE=OFF -DBUILD_EXAMPLES=OFF
cmake --build build
ctest --test-dir build -R tent_

Test results:

  • Unit tests pass
    • icpx / 2x B60 + 1 RNIC (Level Zero, can_access_peer true both ways;
      pod with CAP_SYS_PTRACE, host ptrace_scope=1):
      tent_xpu_platform_test 18/18, tent_xpu_transport_test 7/7,
      tent_xpu_engine_test 91 pass / 5 skipped (pre-existing intentional
      skips, XpuDirectRdmaTest included in the passes),
      tent_xpu_ipc_process_test 4 pass / 4 skipped (fallback fixture skips
      under CAP_SYS_PTRACE), tent_transport_selector_test all pass.
    • icpx / 2x B60, no RNIC, container without CAP_SYS_PTRACE
      (host ptrace_scope=1): tent_xpu_engine_test 84 pass / 12 skipped
      (RNIC-only skips), XpuLocalDeviceCopyTest + XpuIpcEngineTest stable
      over 5 repeats; tent_xpu_ipc_process_test 8/8 — the IPC tests map the
      child's buffer (runtime PR_SET_PTRACER_ANY), the fallback tests get
      EPERM on the non-dumpable peer and take the staged route.
    • icpx with no GPU (OpenCL CPU fallback): same binaries pass, cross-device
      and IPC tests skip.
    • GCC (USE_XPU=OFF): all tent_* ctest targets pass.
  • Integration tests pass: vLLM 0.29.0+xpu disaggregated prefill/decode
    (MooncakeConnector, Qwen2.5-0.5B-Instruct, prefill on xpu:0 / decode on
    xpu:1 in the same pod, MC_USE_TENT=1) with the engine built from this
    branch. Same-node KV blocks go through the IPC-mapped peer buffer — the
    prefill worker logs one XpuTransport: mapped peer buffer ... (13084131328 bytes) of segment <decode> ... on xpu:0 and no
    cannot map peer buffer — and the decode side reports
    prompt_tokens_by_source_total{source="external_kv_transfer"} growing
    with every request. Outputs correct and identical to the
    transports/xpu/disable_ipc=true run, which never maps a peer buffer and
    stays on the PR4 dma-buf RDMA path (the pod had one RNIC).
    No regression vs same-node RDMA: E2E for 8 sequential 2855-token
    prefills (max_tokens=1, second pass) is 126.0 ms IPC vs 125.7 ms
    RDMA. Parity is expected on B60: both routes are bound by the GPU's PCIe
    link, and this model moves only ~34 MB of KV per request (~2 ms of
    transfer), so the E2E number is dominated by prefill compute. The
    comparison shows the new route is safe to take by default when an RNIC
    is present; the benefit is on nodes without one (see Why).
  • Integration tests pass: same vLLM P/D setup on a pod without an
    RNIC
    (TENT installs only the TCP transport). IPC route: READY in 115 s,
    same output and the same 26051 external_kv_transfer tokens, 8-prefill
    E2E medians 120.1 / 118.1 ms (two passes). disable_ipc=true (host
    staging over TCP): identical output and token count, 322.8 / 230.6 ms.
    Repeating the IPC run in a container without CAP_SYS_PTRACE still maps
    the peer buffer (124.7 / 102.2 ms, no cannot map warning), confirming
    the default ptrace_scope=1 needs no extra capability.
  • Manual testing done: two-process Transfer Engine micro-benchmark
    (transfer_sync_read/write xpu:1 ↔ xpu:0, 20 iters, byte-exact
    verify) — IPC route vs dma-buf RDMA loopback through the NIC
    (disable_ipc): 16 MB read 22.3 / write 21.9 GB/s vs 20.9 / 18.6 GB/s;
    1 GB read 18.5 / write 22.6 GB/s vs 22.4 / 15.3 GB/s. Both sit at the
    B60's PCIe ceiling.
  • Manual testing done: RFC acceptance criterion "P2P copy is correct and
    faster than host-staged" measured on the same pod with a 512 MB
    XpuPlatform::copy xpu:0 → xpu:1: 28.4 GB/s direct vs 9.5 GB/s for
    the D2H + H2D staged equivalent (≈3×), readback byte-exact. A standalone
    SYCL probe confirms queue::memcpy between the two B60s saturates the PCIe
    link at the same ~28 GB/s, and that zeMemAllocDevice + dma-buf export
    allocations (PR4) copy P2P at the same rate as plain malloc_device.

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 on the files changed in this PR and all hooks pass
  • I have updated the documentation (if applicable)
  • I have added tests to prove my changes are effective
  • For changes >500 LOC: I have filed an RFC issue ([RFC]: Add Intel XPU support to Transfer Engine & Mooncake Store #4031)

AI Assistance Disclosure

  • No AI tools were used
  • AI tools were used (specify below)

GitHub Copilot (Claude) assisted with drafting the peer-access / copyD2D code,
the tests and this description. All changes were reviewed, built and run on a
2-GPU Intel XPU node by the submitter.

@github-actions github-actions Bot added documentation Improvements or additions to documentation run-ci Transfer Engine labels Sep 29, 2026
@XinyuYe-Intel
XinyuYe-Intel force-pushed the feat/xpu-pcie-p2p branch 2 times, most recently from 721a9a2 to ecdb2ed Compare September 30, 2026 05:16
@XinyuYe-Intel
XinyuYe-Intel marked this pull request as ready for review October 8, 2026 06:13
Copilot AI balanced review requested due to automatic review settings October 8, 2026 06:13

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.

🟡 Changes recommended

IPC cache identity, mapping lifetime races, and dma-buf range validation can cause stale or unsafe transfers.

5 open findings
What changed in this PR

Adds same-node Intel XPU transfers using PCIe/Xe Link peer copies and Level Zero IPC, while retaining RDMA/TCP staging fallbacks.

Changes:

  • Adds XPU device-to-device copies, dma-buf export, and cross-process IPC mapping.
  • Updates transport selection for local XPU, IPC, direct RDMA, and fallback routes.
  • Expands XPU/RDMA tests and deployment documentation.
File Description
tent/​tests/​xpu/​xpu_transport_test.cpp Tests local D2D copies and unmapped peers.
tent/​tests/​xpu/​xpu_platform_test.cpp Tests enumeration, D2D, dma-buf, and IPC.
tent/​tests/​xpu/​xpu_ipc_process_test.cpp Adds cross-process IPC and fallback tests.
tent/​tests/​xpu/​xpu_engine_test.cpp Tests local, IPC, and direct-RDMA routing.
tent/​tests/​transport_selector_test.cpp Covers XPU IPC selection rules.
tent/​tests/​rdma_transport_test.cpp Tests dma-buf MR registration.
tent/​tests/​CMakeLists.txt Registers the IPC process test.
tent/​src/​transport/​xpu/​xpu_transport.cpp Implements IPC publication, import, and relocation.
tent/​src/​transport/​rdma/​rdma_transport.cpp Detects XPU dma-buf capability.
tent/​src/​transport/​rdma/​ibv_loader.cpp Loads the optional dma-buf verb.
tent/​src/​transport/​rdma/​context.cpp Registers and tracks dma-buf MRs.
tent/​src/​runtime/​transport_selector.cpp Allows mapped same-host XPU peers.
tent/​src/​runtime/​transfer_engine_impl.cpp Plans IPC, direct RDMA, and staged routes.
tent/​src/​runtime/​platform.cpp Adds default dma-buf export behavior.
tent/​src/​platform/​xpu/​xpu_sycl_backend.h Implements peer access, D2D, dma-buf, and IPC.
tent/​src/​platform/​xpu/​xpu_platform.cpp Exposes XPU D2D and sharing operations.
tent/​include/​tent/​transport/​xpu/​xpu_transport.h Defines XPU IPC transport state.
tent/​include/​tent/​transport/​rdma/​ibv_loader.h Declares the dma-buf verb symbol.
tent/​include/​tent/​transport/​rdma/​context.h Defines dma-buf registration support.
tent/​include/​tent/​runtime/​transport_selector.h Adds IPC selection context.
tent/​include/​tent/​runtime/​transfer_engine_impl.h Declares direct XPU planning helpers.
tent/​include/​tent/​runtime/​platform.h Defines the generic dma-buf export API.
tent/​include/​tent/​platform/​xpu.h Declares XPU dma-buf and IPC APIs.
docs/​source/​getting_started/​supported-protocols.md Documents XPU direct-transfer behavior.
docs/​source/​getting_started/​build.md Documents XPU build and runtime requirements.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@XinyuYe-Intel

Copy link
Copy Markdown
Contributor Author

The TENT CI checks are passing; the remaining failure comes from an upstream Store test that leaves its injected write failure enabled, unrelated to the XPU changes.
If bandwidth allows, could you please prioritize review, with merge once the CI blocker and 4378 dependency are resolved? Thanks for your help! @stmatengss @alogfans @staryxchen

kpjeeja added a commit to kpjeeja/sglang that referenced this pull request Oct 20, 2026
XPU P/D landed on NIXL (sgl-project#24188), but the XPU CI image does not install NIXL,
so its registered test could not run. This builds both the Mooncake transfer
engine and NIXL into the image and runs the registered XPU P/D test on both
backends.

docker/xpu.Dockerfile builds the Mooncake transfer engine from a pinned
upstream commit with icpx (-DUSE_XPU=ON -DUSE_TENT=ON -DWITH_STORE=OFF; the
store does not build with icpx at that commit) and installs sglang-router,
which the P/D tests launch between prefill and decode.

It also builds UCX from a pinned master commit (--with-ze --with-mlx5) into
/opt/intel, a static Abseil 20250814.1 into /opt/intel/abseil, and NIXL from a
pinned commit through NIXL's documented source install: the nixl-cu12 package,
the C++ libraries and plugins, then the nixl meta package. Mooncake's
dependencies.sh pulls in Ubuntu's libabsl-dev 20220623, too old for NIXL (VLOG
not declared), so the Abseil build goes first on PKG_CONFIG_PATH. nixl-cu12
keeps a RUNPATH to the meson prefix, so pip and meson share
--prefix=/opt/intel/intel_nixl. The image sets UCX_MEMTYPE_CACHE=n: without it
UCX misdetects host buffers as ze-device memory and asserts in rma_rndv.c.

test/registered/disaggregation/test_disaggregation_xpu.py runs both backends
on nightly-xpu-kernel-main-2-gpu through a shared mixin. Mooncake sets
MC_USE_TENT=1 and MOONCAKE_PROTOCOL=tcp, since CI has no RDMA NIC; TCP is
temporary until kvcache-ai/Mooncake#4379 enables ze_ipc. NIXL sets
UCX_MEMTYPE_CACHE=n. Each class fails, not skips, when its backend is not
importable, so the nightly also checks that the image carries both builds.
Decode keeps the default host_pool retraction backup now that sgl-project#32503 enables
HiCache L1<->L2 transfer on XPU.

scripts/ci/xpu/xpu_ci_start_container.sh adds --cap-add SYS_PTRACE: UCX's
ze_ipc transport maps the peer process's device memory through pidfd_getfd(),
which needs ptrace rights, so NIXL transfers fail with EPERM in a default
container.

MetadataBuffers no longer places metadata on "cuda" for
SGLANG_MOONCAKE_CUSTOM_MEM_POOL=INTRA_NODE_NVLINK on XPU; CUDA, ROCm and other
devices keep their existing behaviour.

Docs: the XPU page's P/D section adds a Mooncake backend subsection (build or
Docker image, MC_USE_TENT=1 and the temporary MOONCAKE_PROTOCOL=tcp,
host-staged TCP transport, no Mooncake store so no HiCache L3, a full prefill/
decode example) and a backend column with Mooncake and NIXL nightly rows. The
NIXL subsection now requires a UCX built with the Level Zero transport (the
PyPI nixl wheel's bundled UCX has none) and sets UCX_MEMTYPE_CACHE=n.
pd_disaggregation.mdx notes the XPU Mooncake and NIXL builds and that
SGLANG_MOONCAKE_CUSTOM_MEM_POOL is CUDA-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kpjeeja added a commit to kpjeeja/sglang that referenced this pull request Oct 20, 2026
XPU P/D landed on NIXL (sgl-project#24188), but the XPU CI image does not install NIXL,
so its registered test could not run. This builds both the Mooncake transfer
engine and NIXL into the image and runs the registered XPU P/D test on both
backends.

docker/xpu.Dockerfile builds the Mooncake transfer engine from a pinned
upstream commit with icpx (-DUSE_XPU=ON -DUSE_TENT=ON -DWITH_STORE=OFF; the
store does not build with icpx at that commit) and installs sglang-router,
which the P/D tests launch between prefill and decode.

It also builds UCX from a pinned master commit (--with-ze --with-mlx5) into its
own prefix, /opt/ucx (NIXL finds it through its RUNPATH; no ld.so.conf entry), a
static Abseil 20250814.1 into /opt/intel/abseil, and NIXL from a
pinned commit through NIXL's documented source install: the nixl-cu12 package,
the C++ libraries and plugins, then the nixl meta package. Mooncake's
dependencies.sh pulls in Ubuntu's libabsl-dev 20220623, too old for NIXL (VLOG
not declared), so the Abseil build goes first on PKG_CONFIG_PATH. nixl-cu12
keeps a RUNPATH to the meson prefix, so pip and meson share
--prefix=/opt/intel/intel_nixl. The build-only pip packages are removed afterwards.
The image sets UCX_MEMTYPE_CACHE=n: with the memtype cache on, UCX classifies XPU
device memory as host and NIXL fails to register the KV cache (NIXL_ERR_BACKEND).

test/registered/disaggregation/test_disaggregation_xpu.py runs both backends
on nightly-xpu-kernel-main-2-gpu through a shared mixin. Mooncake sets
MC_USE_TENT=1 and MOONCAKE_PROTOCOL=tcp, since CI has no RDMA NIC; TCP is
temporary until kvcache-ai/Mooncake#4379 enables ze_ipc. NIXL sets
UCX_MEMTYPE_CACHE=n. Each class fails, not skips, when its backend is not
importable, so the nightly also checks that the image carries both builds.
The mixin sets use_rdma = False, a new PDDisaggregationServerBase flag
(default True, so CUDA tests are unchanged). With it, CI mode skips the NIC
lookup, --disaggregation-ib-device and the MC_GID_INDEX/UCX_NET_DEVICES env.
Without it the fixture hands both servers its CUDA-runner default NICs
(mlx5_roce*) on the NIC-less XPU runners, and Mooncake refuses to start.
get_rdma_devices_args() now counts cards with get_gpu_count() instead of
torch.cuda.device_count(), so the card-to-NIC mapping is right off CUDA too;
on CUDA the count is unchanged.
Decode keeps the default host_pool retraction backup now that sgl-project#32503 enables
HiCache L1<->L2 transfer on XPU.

scripts/ci/xpu/xpu_ci_start_container.sh adds --cap-add SYS_PTRACE: UCX's
ze_ipc transport maps the peer process's device memory through pidfd_getfd(),
which needs ptrace rights, so NIXL transfers fail with EPERM in a default
container. pr-test-xpu.yml drops test_disaggregation_xpu.py from its path filter,
since the test now runs only in the nightly.

MetadataBuffers no longer places metadata on "cuda" for
SGLANG_MOONCAKE_CUSTOM_MEM_POOL=INTRA_NODE_NVLINK on XPU; CUDA, ROCm and other
devices keep their existing behaviour.

Docs: the XPU page's P/D section adds a Mooncake backend subsection (build or
Docker image, MC_USE_TENT=1 and the temporary MOONCAKE_PROTOCOL=tcp,
host-staged TCP transport, no Mooncake store so no HiCache L3, a full prefill/
decode example) and a backend column with Mooncake and NIXL nightly rows. The
NIXL subsection now requires a UCX built with the Level Zero transport (the
PyPI nixl wheel's bundled UCX has none), sets UCX_MEMTYPE_CACHE=n, and says
containers need --cap-add SYS_PTRACE.
pd_disaggregation.mdx notes the XPU Mooncake and NIXL builds and that
SGLANG_MOONCAKE_CUSTOM_MEM_POOL is CUDA-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kpjeeja added a commit to kpjeeja/sglang that referenced this pull request Oct 21, 2026
XPU P/D landed on NIXL (sgl-project#24188), but the XPU CI image does not install NIXL,
so its registered test could not run. This builds both the Mooncake transfer
engine and NIXL into the image and runs the registered XPU P/D test on both
backends.

docker/xpu.Dockerfile builds the Mooncake transfer engine from a pinned
upstream commit with icpx (-DUSE_XPU=ON -DUSE_TENT=ON -DWITH_STORE=OFF; the
store does not build with icpx at that commit) and installs sglang-router,
which the P/D tests launch between prefill and decode. Mooncake's
dependencies.sh is run with libboost-dev in place of libboost-all-dev, which
pulls OpenMPI, libfabric and Ubuntu's UCX 1.16; Mooncake, store and P2P
included, uses only header-only Boost.

It also builds UCX from a pinned master commit (--with-ze --with-mlx5) into its
own prefix, /opt/ucx (NIXL finds it through its RUNPATH; no ld.so.conf entry), a
static Abseil 20250814.1 into /opt/intel/abseil, and NIXL from a
pinned commit through NIXL's documented source install: the nixl-cu12 package,
the C++ libraries and plugins, then the nixl meta package. Mooncake's
dependencies.sh pulls in Ubuntu's libabsl-dev 20220623, too old for NIXL (VLOG
not declared), so the Abseil build goes first on PKG_CONFIG_PATH. nixl-cu12
keeps a RUNPATH to the meson prefix, so pip and meson share
--prefix=/opt/intel/intel_nixl. The build-only pip packages are removed afterwards.
The image sets UCX_MEMTYPE_CACHE=n: with the memtype cache on, UCX classifies XPU
device memory as host and NIXL fails to register the KV cache (NIXL_ERR_BACKEND).

test/registered/disaggregation/test_disaggregation_xpu.py runs both backends
on nightly-xpu-kernel-main-2-gpu through a shared mixin. Mooncake sets
MC_USE_TENT=1 and MOONCAKE_PROTOCOL=tcp, since CI has no RDMA NIC; TCP is
temporary until kvcache-ai/Mooncake#4379 enables ze_ipc. NIXL sets
UCX_MEMTYPE_CACHE=n. Each class fails, not skips, when its backend is not
importable, so the nightly also checks that the image carries both builds.
The mixin sets use_rdma = False, a new PDDisaggregationServerBase flag
(default True, so CUDA tests are unchanged). With it, CI mode skips the NIC
lookup, --disaggregation-ib-device and the MC_GID_INDEX/UCX_NET_DEVICES env.
Without it the fixture hands both servers its CUDA-runner default NICs
(mlx5_roce*) on the NIC-less XPU runners, and Mooncake refuses to start.
get_rdma_devices_args() now counts cards with get_gpu_count() instead of
torch.cuda.device_count(), so the card-to-NIC mapping is right off CUDA too;
on CUDA the count is unchanged.
Decode keeps the default host_pool retraction backup now that sgl-project#32503 enables
HiCache L1<->L2 transfer on XPU.

scripts/ci/xpu/xpu_ci_start_container.sh adds --cap-add SYS_PTRACE: UCX's
ze_ipc transport maps the peer process's device memory through pidfd_getfd(),
which needs ptrace rights, so NIXL transfers fail with EPERM in a default
container. pr-test-xpu.yml drops test_disaggregation_xpu.py from its path filter,
since the test now runs only in the nightly.

MetadataBuffers no longer places metadata on "cuda" for
SGLANG_MOONCAKE_CUSTOM_MEM_POOL=INTRA_NODE_NVLINK on XPU; CUDA, ROCm and other
devices keep their existing behaviour.

Docs: the XPU page's P/D section adds a Mooncake backend subsection (build or
Docker image, MC_USE_TENT=1 and the temporary MOONCAKE_PROTOCOL=tcp,
host-staged TCP transport, no Mooncake store so no HiCache L3, a full prefill/
decode example) and a backend column with Mooncake and NIXL nightly rows. The
NIXL subsection now requires a UCX built with the Level Zero transport (the
PyPI nixl wheel's bundled UCX has none), sets UCX_MEMTYPE_CACHE=n, and says
containers need --cap-add SYS_PTRACE.
pd_disaggregation.mdx notes the XPU Mooncake and NIXL builds and that
SGLANG_MOONCAKE_CUSTOM_MEM_POOL is CUDA-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kpjeeja added a commit to kpjeeja/sglang that referenced this pull request Oct 21, 2026
XPU P/D landed on NIXL (sgl-project#24188), but the XPU CI image does not install NIXL,
so its registered test could not run. This builds both the Mooncake transfer
engine and NIXL into the image and runs the registered XPU P/D test on both
backends.

docker/xpu.Dockerfile builds the Mooncake transfer engine from a pinned
upstream commit with icpx (-DUSE_XPU=ON -DUSE_TENT=ON -DWITH_STORE=OFF; the
store does not build with icpx at that commit) and installs sglang-router,
which the P/D tests launch between prefill and decode. Mooncake's
dependencies.sh is run with libboost-dev in place of libboost-all-dev, which
pulls OpenMPI, libfabric and Ubuntu's UCX 1.16; Mooncake, store and P2P
included, uses only header-only Boost. A grep guard fails the build if a
MOONCAKE_COMMIT bump renames that line.

It also builds UCX from a pinned master commit (--with-ze --with-mlx5) into its
own prefix, /opt/ucx (NIXL finds it through its RUNPATH; no ld.so.conf entry), a
static Abseil 20250814.1 into /opt/intel/abseil, and NIXL from a
pinned commit through NIXL's documented source install: the nixl-cu12 package,
the C++ libraries and plugins, then the nixl meta package. Mooncake's
dependencies.sh pulls in Ubuntu's libabsl-dev 20220623, too old for NIXL (VLOG
not declared), so the Abseil build goes first on PKG_CONFIG_PATH. nixl-cu12
keeps a RUNPATH to the meson prefix, so pip and meson share
--prefix=/opt/intel/intel_nixl. The build-only pip packages are removed afterwards.
The image sets UCX_MEMTYPE_CACHE=n: with the memtype cache on, UCX classifies XPU
device memory as host and NIXL fails to register the KV cache (NIXL_ERR_BACKEND).

test/registered/disaggregation/test_disaggregation_xpu.py runs both backends
on nightly-xpu-kernel-main-2-gpu through a shared mixin. Mooncake sets
MC_USE_TENT=1 and MOONCAKE_PROTOCOL=tcp, since CI has no RDMA NIC; TCP is
temporary until kvcache-ai/Mooncake#4379 enables ze_ipc. NIXL sets
UCX_MEMTYPE_CACHE=n. Each class fails, not skips, when its backend is not
importable, so the nightly also checks that the image carries both builds.
The mixin sets use_rdma = False, a new PDDisaggregationServerBase flag
(default True, so CUDA tests are unchanged). With it, CI mode skips the NIC
lookup, --disaggregation-ib-device and the MC_GID_INDEX/UCX_NET_DEVICES env.
Without it the fixture hands both servers its CUDA-runner default NICs
(mlx5_roce*) on the NIC-less XPU runners, and Mooncake refuses to start.
get_rdma_devices_args() now counts cards with get_gpu_count() instead of
torch.cuda.device_count(), so the card-to-NIC mapping is right off CUDA too;
on CUDA the count is unchanged.
Decode keeps the default host_pool retraction backup now that sgl-project#32503 enables
HiCache L1<->L2 transfer on XPU.

scripts/ci/xpu/xpu_ci_start_container.sh adds --cap-add SYS_PTRACE: UCX's
ze_ipc transport maps the peer process's device memory through pidfd_getfd(),
which needs ptrace rights, so NIXL transfers fail with EPERM in a default
container. pr-test-xpu.yml drops test_disaggregation_xpu.py from its path filter,
since the test now runs only in the nightly.

Server-args validation now rejects SGLANG_MOONCAKE_CUSTOM_MEM_POOL on
--device xpu when it enables a pool: Mooncake's pools use CUDA allocators,
which XPU lacks. Values that leave the pool off are accepted, and CUDA, ROCm,
MUSA and Ascend NPU keep their existing behaviour.

Docs: the XPU page's P/D section adds a Mooncake backend subsection (build or
Docker image, MC_USE_TENT=1 and the temporary MOONCAKE_PROTOCOL=tcp,
host-staged TCP transport, no Mooncake store so no HiCache L3, a full prefill/
decode example) and a backend column with Mooncake and NIXL nightly rows. The
NIXL subsection now requires a UCX built with the Level Zero transport (the
PyPI nixl wheel's bundled UCX has none), sets UCX_MEMTYPE_CACHE=n, and says
containers need --cap-add SYS_PTRACE.
pd_disaggregation.mdx notes the XPU Mooncake and NIXL builds and that
SGLANG_MOONCAKE_CUSTOM_MEM_POOL is CUDA-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kpjeeja added a commit to kpjeeja/sglang that referenced this pull request Oct 21, 2026
XPU P/D landed on NIXL (sgl-project#24188), but the XPU CI image does not install NIXL,
so its registered test could not run. This builds both the Mooncake transfer
engine and NIXL into the image and runs the registered XPU P/D test on both
backends.

docker/xpu.Dockerfile builds the Mooncake transfer engine from a pinned
upstream commit with icpx (-DUSE_XPU=ON -DUSE_TENT=ON -DWITH_STORE=OFF; the
store does not build with icpx at that commit) and installs sglang-router,
which the P/D tests launch between prefill and decode. Mooncake's
dependencies.sh is run with libboost-dev in place of libboost-all-dev, which
pulls OpenMPI, libfabric and Ubuntu's UCX 1.16; Mooncake, store and P2P
included, uses only header-only Boost. A grep anchored to the package entry
fails the build if a MOONCAKE_COMMIT bump renames or drops it.

It also builds UCX from a pinned master commit (--with-ze --with-mlx5) into its
own prefix, /opt/ucx (NIXL finds it through its RUNPATH; no ld.so.conf entry), a
static Abseil 20250814.1 into /opt/intel/abseil, and NIXL from a
pinned commit through NIXL's documented source install: the nixl-cu12 package,
the C++ libraries and plugins, then the nixl meta package. Mooncake's
dependencies.sh pulls in Ubuntu's libabsl-dev 20220623, too old for NIXL (VLOG
not declared), so the Abseil build goes first on PKG_CONFIG_PATH. nixl-cu12
keeps a RUNPATH to the meson prefix, so pip and meson share
--prefix=/opt/intel/intel_nixl. The build-only pip packages are removed afterwards.
The image sets UCX_MEMTYPE_CACHE=n: with the memtype cache on, UCX classifies XPU
device memory as host and NIXL fails to register the KV cache (NIXL_ERR_BACKEND).

test/registered/disaggregation/test_disaggregation_xpu.py runs both backends
on nightly-xpu-kernel-main-2-gpu through a shared mixin. Mooncake sets
MC_USE_TENT=1 and MOONCAKE_PROTOCOL=tcp, since CI has no RDMA NIC; TCP is
temporary until kvcache-ai/Mooncake#4379 enables ze_ipc. NIXL sets
UCX_MEMTYPE_CACHE=n. Each class fails, not skips, when its backend is not
importable, so the nightly also checks that the image carries both builds.
The mixin sets use_rdma = False, a new PDDisaggregationServerBase flag
(default True, so CUDA tests are unchanged). With it, CI mode skips the NIC
lookup, --disaggregation-ib-device and the MC_GID_INDEX/UCX_NET_DEVICES env.
Without it the fixture hands both servers its CUDA-runner default NICs
(mlx5_roce*) on the NIC-less XPU runners, and Mooncake refuses to start.
get_rdma_devices_args() now counts cards with get_gpu_count() instead of
torch.cuda.device_count(), so the card-to-NIC mapping is right off CUDA too;
on CUDA the count is unchanged.
Decode keeps the default host_pool retraction backup now that sgl-project#32503 enables
HiCache L1<->L2 transfer on XPU.

scripts/ci/xpu/xpu_ci_start_container.sh adds --cap-add SYS_PTRACE: UCX's
ze_ipc transport maps the peer process's device memory through pidfd_getfd(),
which needs ptrace rights, so NIXL transfers fail with EPERM in a default
container. pr-test-xpu.yml drops test_disaggregation_xpu.py from its path filter,
since the test now runs only in the nightly.

Server-args validation now rejects SGLANG_MOONCAKE_CUSTOM_MEM_POOL on
--device xpu when it enables a pool: Mooncake's pools use CUDA allocators,
which XPU lacks. Values that leave the pool off are accepted, and CUDA, ROCm,
MUSA and Ascend NPU keep their existing behaviour.

Docs: the XPU page's P/D section adds a Mooncake backend subsection (build or
Docker image, MC_USE_TENT=1 and the temporary MOONCAKE_PROTOCOL=tcp,
host-staged TCP transport, no Mooncake store so no HiCache L3, a full prefill/
decode example) and a backend column with Mooncake and NIXL nightly rows. The
NIXL subsection now requires a UCX built with the Level Zero transport (the
PyPI nixl wheel's bundled UCX has none), sets UCX_MEMTYPE_CACHE=n, and says
containers need --cap-add SYS_PTRACE.
pd_disaggregation.mdx notes the XPU Mooncake and NIXL builds and that
SGLANG_MOONCAKE_CUSTOM_MEM_POOL is CUDA-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kpjeeja added a commit to kpjeeja/sglang that referenced this pull request Oct 21, 2026
XPU P/D landed on NIXL (sgl-project#24188), but the XPU CI image does not install NIXL,
so its registered test could not run. This builds both the Mooncake transfer
engine and NIXL into the image and runs the registered XPU P/D test on both
backends.

docker/xpu.Dockerfile builds the Mooncake transfer engine from a pinned
upstream commit with icpx (-DUSE_XPU=ON -DUSE_TENT=ON -DWITH_STORE=OFF; the
store does not build with icpx at that commit) and installs sglang-router,
which the P/D tests launch between prefill and decode. Mooncake's
dependencies.sh is run with libboost-dev in place of libboost-all-dev, which
pulls OpenMPI, libfabric and Ubuntu's UCX 1.16; Mooncake, store and P2P
included, uses only header-only Boost. A grep anchored to the package entry
fails the build if a MOONCAKE_COMMIT bump renames or drops it.

It also builds UCX from a pinned master commit (--with-ze --with-mlx5) into its
own prefix, /opt/ucx (NIXL finds it through its RUNPATH; no ld.so.conf entry), a
static Abseil 20250814.1 into /opt/intel/abseil, and NIXL from a
pinned commit through NIXL's documented source install: the nixl-cu12 package,
the C++ libraries and plugins, then the nixl meta package. Mooncake's
dependencies.sh pulls in Ubuntu's libabsl-dev 20220623, too old for NIXL (VLOG
not declared), so the Abseil build goes first on PKG_CONFIG_PATH. nixl-cu12
keeps a RUNPATH to the meson prefix, so pip and meson share
--prefix=/opt/intel/intel_nixl. The build-only pip packages are removed afterwards.
The image sets UCX_MEMTYPE_CACHE=n: with the memtype cache on, UCX classifies XPU
device memory as host and NIXL fails to register the KV cache (NIXL_ERR_BACKEND).

test/registered/disaggregation/test_disaggregation_xpu.py runs both backends
on nightly-xpu-kernel-main-2-gpu through a shared mixin. Mooncake sets
MC_USE_TENT=1 and MOONCAKE_PROTOCOL=tcp, since CI has no RDMA NIC; TCP is
temporary until kvcache-ai/Mooncake#4379 enables ze_ipc. NIXL sets
UCX_MEMTYPE_CACHE=n. Each class fails, not skips, when its backend is not
importable, so the nightly also checks that the image carries both builds.
The mixin sets use_rdma = False, a new PDDisaggregationServerBase flag
(default True, so CUDA tests are unchanged). With it, CI mode skips the NIC
lookup, --disaggregation-ib-device and the MC_GID_INDEX/UCX_NET_DEVICES env.
Without it the fixture hands both servers its CUDA-runner default NICs
(mlx5_roce*) on the NIC-less XPU runners, and Mooncake refuses to start.
get_rdma_devices_args() now counts cards with get_gpu_count() instead of
torch.cuda.device_count(), so the card-to-NIC mapping is right off CUDA too;
on CUDA the count is unchanged.
Decode keeps the default host_pool retraction backup now that sgl-project#32503 enables
HiCache L1<->L2 transfer on XPU.

scripts/ci/xpu/xpu_ci_start_container.sh adds --cap-add SYS_PTRACE: UCX's
ze_ipc transport maps the peer process's device memory through pidfd_getfd(),
which needs ptrace rights, so NIXL transfers fail with EPERM in a default
container. pr-test-xpu.yml drops test_disaggregation_xpu.py from its path filter,
since the test now runs only in the nightly.

Server-args validation now rejects SGLANG_MOONCAKE_CUSTOM_MEM_POOL on
--device xpu when it enables a pool: Mooncake's pools use CUDA allocators,
which XPU lacks. Values that leave the pool off are accepted, and CUDA, ROCm,
MUSA and Ascend NPU keep their existing behaviour.

Docs: the XPU page's P/D section adds a Mooncake backend subsection (build or
Docker image, MC_USE_TENT=1 and the temporary MOONCAKE_PROTOCOL=tcp,
host-staged TCP transport, no Mooncake store so no HiCache L3, a full prefill/
decode example) and a backend column with Mooncake and NIXL nightly rows. The
NIXL subsection now requires a UCX built with the Level Zero transport (the
PyPI nixl wheel's bundled UCX has none), sets UCX_MEMTYPE_CACHE=n, and says
containers need --cap-add SYS_PTRACE.
pd_disaggregation.mdx notes the XPU Mooncake and NIXL builds and that
SGLANG_MOONCAKE_CUSTOM_MEM_POOL is CUDA-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kpjeeja added a commit to kpjeeja/sglang that referenced this pull request Oct 21, 2026
XPU P/D landed on NIXL (sgl-project#24188), but the XPU CI image does not install NIXL,
so its registered test could not run. This builds both the Mooncake transfer
engine and NIXL into the image and runs the registered XPU P/D test on both
backends.

docker/xpu.Dockerfile builds the Mooncake transfer engine from a pinned
upstream commit with icpx (-DUSE_XPU=ON -DUSE_TENT=ON -DWITH_STORE=OFF; the
store does not build with icpx at that commit) and installs sglang-router,
which the P/D tests launch between prefill and decode. Mooncake's
dependencies.sh is run with libboost-dev in place of libboost-all-dev, which
pulls OpenMPI, libfabric and Ubuntu's UCX 1.16; Mooncake, store and P2P
included, uses only header-only Boost. A grep anchored to the package entry
fails the build if a MOONCAKE_COMMIT bump renames or drops it.

It also builds UCX from a pinned master commit (--with-ze --with-mlx5) into its
own prefix, /opt/ucx (NIXL finds it through its RUNPATH; no ld.so.conf entry), a
static Abseil 20250814.1 into /opt/intel/abseil, and NIXL from a
pinned commit through NIXL's documented source install: the nixl-cu12 package,
the C++ libraries and plugins, then the nixl meta package. Mooncake's
dependencies.sh pulls in Ubuntu's libabsl-dev 20220623, too old for NIXL (VLOG
not declared), so the Abseil build goes first on PKG_CONFIG_PATH. nixl-cu12
keeps a RUNPATH to the meson prefix, so pip and meson share
--prefix=/opt/intel/intel_nixl. The build-only pip packages are removed afterwards.
The image sets UCX_MEMTYPE_CACHE=n: with the memtype cache on, UCX classifies XPU
device memory as host and NIXL fails to register the KV cache (NIXL_ERR_BACKEND).

test/registered/disaggregation/test_disaggregation_xpu.py runs both backends
on nightly-xpu-kernel-main-2-gpu through a shared mixin. Mooncake sets
MC_USE_TENT=1 and MOONCAKE_PROTOCOL=tcp, since CI has no RDMA NIC; TCP is
temporary until kvcache-ai/Mooncake#4379 enables ze_ipc. NIXL sets
UCX_MEMTYPE_CACHE=n. Each class fails, not skips, when its backend is not
importable, so the nightly also checks that the image carries both builds.
The mixin sets use_rdma = False, a new PDDisaggregationServerBase flag
(default True, so CUDA tests are unchanged). With it, CI mode skips the NIC
lookup, --disaggregation-ib-device and the MC_GID_INDEX/UCX_NET_DEVICES env.
Without it the fixture hands both servers its CUDA-runner default NICs
(mlx5_roce*) on the NIC-less XPU runners, and Mooncake refuses to start.
get_rdma_devices_args() now counts cards with get_gpu_count() instead of
torch.cuda.device_count(), so the card-to-NIC mapping is right off CUDA too;
on CUDA the count is unchanged.
Decode keeps the default host_pool retraction backup now that sgl-project#32503 enables
HiCache L1<->L2 transfer on XPU.

scripts/ci/xpu/xpu_ci_start_container.sh adds --cap-add SYS_PTRACE: UCX's
ze_ipc transport maps the peer process's device memory through pidfd_getfd(),
which needs ptrace rights, so NIXL transfers fail with EPERM in a default
container. pr-test-xpu.yml drops test_disaggregation_xpu.py from its path filter,
since the test now runs only in the nightly.

Server-args validation now rejects SGLANG_MOONCAKE_CUSTOM_MEM_POOL on
--device xpu when it enables a pool: Mooncake's pools use CUDA allocators,
which XPU lacks. Values that leave the pool off are accepted, and CUDA, ROCm,
MUSA and Ascend NPU keep their existing behaviour.

Docs: the XPU page's P/D section adds a Mooncake backend subsection (build or
Docker image, MC_USE_TENT=1 and the temporary MOONCAKE_PROTOCOL=tcp,
host-staged TCP transport, no Mooncake store so no HiCache L3, a full prefill/
decode example) and a backend column with Mooncake and NIXL nightly rows. The
NIXL subsection now requires a UCX built with the Level Zero transport (the
PyPI nixl wheel's bundled UCX has none), sets UCX_MEMTYPE_CACHE=n, and says
containers need --cap-add SYS_PTRACE.
pd_disaggregation.mdx notes the XPU Mooncake and NIXL builds and that
SGLANG_MOONCAKE_CUSTOM_MEM_POOL is CUDA-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VRAM-to-VRAM transfers between Intel XPUs on the same node previously went
through host memory, and between processes through the network transport.
This teaches the XPU platform and transport to copy directly.

Within one process:
- XpuSyclBackend::init() probes every ordered pair of Level Zero devices
  with sycl_ext_oneapi_peer_access and records a peer matrix; copyD2D()
  issues one queue::memcpy on the accessing device when peer access
  exists and bounces through host memory in 8 MB chunks otherwise.
- init() keeps only the Level Zero view of each GPU (the OpenCL adapter
  exposes duplicates and ur_die-aborts on peer-access queries), and the
  peer probe no longer hides behind SYCL_EXT_ONEAPI_PEER_ACCESS, which
  icpx 2026.1 does not define.
- XpuTransport advertises gpu_to_gpu and accepts device-to-device
  requests; XpuPlatform::copy() device->device succeeds.

Across processes on the same node (e.g. prefill and decode workers):
- XpuPlatform gains exportIpc / importIpc / closeImport over Level Zero
  IPC handles. The importer fetches the exporter's dma-buf descriptor
  with pidfd_getfd(2) and rewrites the handle so the compute runtime
  takes its fd import path; the opaque-handle path keeps a per-fd import
  cache that is never invalidated and maps stale buffers once the
  exporter reallocates.
- Segment metadata carries "<pid>-<base>-<size>-<handle>-<pidns>" as
  the XPU transport attribute; the selector routes same-machine XPU
  targets that carry it through the XPU transport, and the transport
  maps the peer buffer on first use.
- `transports/xpu/disable_ipc` turns the mechanism off; import failures
  (e.g. missing ptrace permission) fall back to the network path.

Tests: platform D2D copies and IPC round trips, transport D2D, two-engine
same-process IPC transfers, a fork+exec cross-process test, selector
routing. Docs: build option, GPU-Direct admonition and supported-protocols
note (IPC path and its CAP_SYS_PTRACE / ptrace_scope requirement).
kpjeeja added a commit to kpjeeja/sglang that referenced this pull request Oct 22, 2026
XPU P/D landed on NIXL (sgl-project#24188), but the XPU CI image does not install NIXL,
so its registered test could not run. This builds both the Mooncake transfer
engine and NIXL into the image and runs the registered XPU P/D test on both
backends.

docker/xpu.Dockerfile builds the Mooncake transfer engine from a pinned
upstream commit with icpx (-DUSE_XPU=ON -DUSE_TENT=ON -DWITH_STORE=OFF; the
store does not build with icpx at that commit) and installs sglang-router,
which the P/D tests launch between prefill and decode. Mooncake's
dependencies.sh is run with libboost-dev in place of libboost-all-dev, which
pulls OpenMPI, libfabric and Ubuntu's UCX 1.16; Mooncake, store and P2P
included, uses only header-only Boost. A grep anchored to the package entry
fails the build if a MOONCAKE_COMMIT bump renames or drops it.

It also builds UCX from a pinned master commit (--with-ze --with-mlx5) into its
own prefix, /opt/ucx (NIXL finds it through its RUNPATH; no ld.so.conf entry), a
static Abseil 20250814.1 into /opt/intel/abseil, and NIXL from a
pinned commit through NIXL's documented source install: the nixl-cu12 package,
the C++ libraries and plugins, then the nixl meta package. Mooncake's
dependencies.sh pulls in Ubuntu's libabsl-dev 20220623, too old for NIXL (VLOG
not declared), so the Abseil build goes first on PKG_CONFIG_PATH. nixl-cu12
keeps a RUNPATH to the meson prefix, so pip and meson share
--prefix=/opt/intel/intel_nixl. The build-only pip packages are removed afterwards.
The image sets UCX_MEMTYPE_CACHE=n: with the memtype cache on, UCX classifies XPU
device memory as host and NIXL fails to register the KV cache (NIXL_ERR_BACKEND).

test/registered/disaggregation/test_disaggregation_xpu.py runs both backends
on nightly-xpu-kernel-main-2-gpu through a shared mixin. Mooncake sets
MC_USE_TENT=1 and MOONCAKE_PROTOCOL=tcp, since CI has no RDMA NIC; TCP is
temporary until kvcache-ai/Mooncake#4379 enables ze_ipc. NIXL sets
UCX_MEMTYPE_CACHE=n. Each class fails, not skips, when its backend is not
importable, so the nightly also checks that the image carries both builds.
The mixin sets use_rdma = False, a new PDDisaggregationServerBase flag
(default True, so CUDA tests are unchanged). With it, CI mode skips the NIC
lookup, --disaggregation-ib-device and the MC_GID_INDEX/UCX_NET_DEVICES env.
Without it the fixture hands both servers its CUDA-runner default NICs
(mlx5_roce*) on the NIC-less XPU runners, and Mooncake refuses to start.
get_rdma_devices_args() now counts cards with get_gpu_count() instead of
torch.cuda.device_count(), so the card-to-NIC mapping is right off CUDA too;
on CUDA the count is unchanged.
Decode keeps the default host_pool retraction backup now that sgl-project#32503 enables
HiCache L1<->L2 transfer on XPU.

scripts/ci/xpu/xpu_ci_start_container.sh adds --cap-add SYS_PTRACE: UCX's
ze_ipc transport maps the peer process's device memory through pidfd_getfd(),
which needs ptrace rights, so NIXL transfers fail with EPERM in a default
container. pr-test-xpu.yml drops test_disaggregation_xpu.py from its path filter,
since the test now runs only in the nightly.

Server-args validation now rejects SGLANG_MOONCAKE_CUSTOM_MEM_POOL on
--device xpu when it enables a pool: Mooncake's pools use CUDA allocators,
which XPU lacks. Values that leave the pool off are accepted, and CUDA, ROCm,
MUSA and Ascend NPU keep their existing behaviour.

Docs: the XPU page's P/D section adds a Mooncake backend subsection (build or
Docker image, MC_USE_TENT=1 and the temporary MOONCAKE_PROTOCOL=tcp,
host-staged TCP transport, no Mooncake store so no HiCache L3, a full prefill/
decode example) and a backend column with Mooncake and NIXL nightly rows. The
NIXL subsection now requires a UCX built with the Level Zero transport (the
PyPI nixl wheel's bundled UCX has none), sets UCX_MEMTYPE_CACHE=n, and says
containers need --cap-add SYS_PTRACE.
pd_disaggregation.mdx notes the XPU Mooncake and NIXL builds and that
SGLANG_MOONCAKE_CUSTOM_MEM_POOL is CUDA-only.

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

@staryxchen staryxchen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Single-GPU IPC looks right (generation, per-device negative cache, mapping kept across relocate/memcpy, ptrace documented). Three gaps: the success cache is not per device, imported dma-bufs live until process exit, and a policy that does not list "xpu" keeps the network path. Details inline.

Address review: cache imports per local device, reference-count mappings so dropped ones close after in-flight copies, drop imports on closeSegment or when the peer stops publishing a buffer, list xpu ahead of rdma in the default policy, and use overflow-safe range checks.
Address review:
- Plan same-host XPU IPC without importing; the mapping is opened only
  when XPU is selected, and failover candidates behind it stay
  host-staged. A policy that does not list "xpu" never maps peer memory.
- Publish the owning device UUID with each IPC handle and refuse imports
  on a local device without peer access to it; a host source maps on
  the owner device.
- Order IPC attributes by a registration generation, so an older
  descriptor snapshot cannot unmap buffers registered after it.
- Cache import failures per segment, prune them with the descriptor,
  and retry transient errnos.
- Close the fetched dma-buf fd once the handle is opened, verify the
  mapped size, and hold the backend lock only for bookkeeping.
- Reject exportIpc ranges whose end wraps; use F_DUPFD_CLOEXEC and guard
  the pidfd syscalls.
@XinyuYe-Intel

XinyuYe-Intel commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

@staryxchen Thanks for the detailed review! All four points are addressed in the latest commits. On 2× Arc Pro B60 (same host, Level Zero IPC), the XPU platform, transport, IPC-process and engine tests pass, including the new ones. The CPU TENT suites also pass.

@staryxchen staryxchen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

kpjeeja added a commit to kpjeeja/sglang that referenced this pull request Oct 22, 2026
XPU P/D landed on NIXL (sgl-project#24188), but the XPU CI image does not install NIXL,
so its registered test could not run. This builds both the Mooncake transfer
engine and NIXL into the image and runs the registered XPU P/D test on both
backends.

docker/xpu.Dockerfile builds the Mooncake transfer engine from a pinned
upstream commit with icpx (-DUSE_XPU=ON -DUSE_TENT=ON -DWITH_STORE=OFF; the
store does not build with icpx at that commit) and installs a pinned sglang-router,
which the P/D tests launch between prefill and decode. Mooncake's
dependencies.sh is run with libboost-dev in place of libboost-all-dev, which
pulls OpenMPI, libfabric and Ubuntu's UCX 1.16; Mooncake, store and P2P
included, uses only header-only Boost. A grep anchored to the package entry
fails the build if a MOONCAKE_COMMIT bump renames or drops it.

It also builds UCX from a pinned master commit (--with-ze --with-mlx5,
--enable-optimizations), since ZE IPC for Intel GPUs (openucx/ucx#11218) is in
no UCX release yet, into its
own prefix, /opt/ucx (NIXL finds it through its RUNPATH; no ld.so.conf entry), a
static Abseil 20250814.1 into /opt/abseil, and NIXL from a
pinned commit through NIXL's documented source install: the nixl-cu12 package,
the C++ libraries and plugins, then the nixl meta package. Mooncake's
dependencies.sh pulls in Ubuntu's libabsl-dev 20220623, too old for NIXL (VLOG
not declared), so the Abseil build goes first on PKG_CONFIG_PATH. nixl-cu12
keeps a RUNPATH to the meson prefix, so pip and meson share
--prefix=/opt/nixl. Afterwards only the build tools the venv did not already
have are removed, so packages sglang depends on (ninja, pyyaml) stay.
The NIXL pin includes ai-dynamo/nixl#1536: its UCX plugin passes the VRAM memory
type to UCX at registration, and the default auto hint selects ze-device on a
ZE-only UCX, so UCX does not misclassify XPU memory as host (NIXL_ERR_BACKEND)
and no UCX_MEMTYPE_CACHE override is needed.

test/registered/disaggregation/test_disaggregation_xpu.py runs both backends
on nightly-xpu-kernel-main-2-gpu through a shared mixin. Mooncake sets
MC_USE_TENT=1 and MOONCAKE_PROTOCOL=tcp, since CI has no RDMA NIC; TCP is
temporary until kvcache-ai/Mooncake#4379 enables ze_ipc. Both servers use the
documented XPU attention backend, intel_xpu (page size 128), and prefill uses a
256-token chunk, so a ~1.1k-token greedy prompt that must recall a fact from its
first page covers multi-page, multi-chunk KV transfer. Each class fails, not skips, when its backend is not
importable, so the nightly also checks that the image carries both builds. In
CI it also fails, rather than skips, when fewer than two XPUs are visible, so a
runner with a missing card does not leave the nightly green; outside CI it
still skips.
The mixin sets use_rdma = False, a new PDDisaggregationServerBase flag
(default True, so CUDA tests are unchanged). With it, CI mode skips the NIC
lookup, --disaggregation-ib-device and the MC_GID_INDEX/UCX_NET_DEVICES env.
Without it the fixture hands both servers its CUDA-runner default NICs
(mlx5_roce*) on the NIC-less XPU runners, and Mooncake refuses to start.
get_rdma_devices_args() now counts cards with get_gpu_count() instead of
torch.cuda.device_count(), so the card-to-NIC mapping is right off CUDA too;
on CUDA the count is unchanged.
Decode keeps the default host_pool retraction backup now that sgl-project#32503 enables
HiCache L1<->L2 transfer on XPU.

scripts/ci/xpu/xpu_ci_start_container.sh adds --cap-add SYS_PTRACE: UCX's
ze_ipc transport maps the peer process's device memory through pidfd_getfd(),
which needs ptrace rights, so NIXL transfers fail with EPERM in a default
container. pr-test-xpu.yml drops test_disaggregation_xpu.py from its path filter,
since the test now runs only in the nightly.

Server-args validation now rejects SGLANG_MOONCAKE_CUSTOM_MEM_POOL on
--device xpu when it enables a pool: Mooncake's pools use CUDA allocators,
which XPU lacks. Values that leave the pool off are accepted, and CUDA, ROCm,
MUSA and Ascend NPU keep their existing behaviour.

Docs: the XPU page's P/D section adds a Mooncake backend subsection (build or
Docker image, MC_USE_TENT=1 and the temporary MOONCAKE_PROTOCOL=tcp,
host-staged TCP transport, no Mooncake store so no HiCache L3, a full prefill/
decode example) and a backend column with Mooncake and NIXL nightly rows. The
NIXL subsection now requires a UCX built with the Level Zero transport (the
PyPI nixl wheel's bundled UCX has none) and says
containers need --cap-add SYS_PTRACE. Its launch commands no longer set
UCX_POSIX_USE_PROC_LINK=n, matching the nightly; the note now gives it as the fix
if UCX's shared-memory transport cannot open a peer's /proc/<pid>/fd/<fd>.
pd_disaggregation.mdx notes the XPU Mooncake and NIXL builds and that
SGLANG_MOONCAKE_CUSTOM_MEM_POOL is CUDA-only.
@alogfans
alogfans merged commit db4f146 into kvcache-ai:main Oct 23, 2026
35 checks passed
@XinyuYe-Intel
XinyuYe-Intel deleted the feat/xpu-pcie-p2p branch October 23, 2026 07:00
kpjeeja added a commit to kpjeeja/sglang that referenced this pull request Oct 23, 2026
XPU P/D landed on NIXL (sgl-project#24188), but the XPU CI image does not install NIXL,
so its registered test could not run. This builds both the Mooncake transfer
engine and NIXL into the image and runs the registered XPU P/D test on both
backends.

docker/xpu.Dockerfile builds the Mooncake transfer engine from a pinned
upstream commit with icpx (-DUSE_XPU=ON -DUSE_TENT=ON -DWITH_STORE=OFF; the
store does not build with icpx at that commit). The pin includes
kvcache-ai/Mooncake#4379, so on one node TENT's XPU transport copies KV card to
card through Level Zero IPC and no RDMA NIC is needed. The image also installs
a pinned sglang-router,
which the P/D tests launch between prefill and decode. Mooncake's
dependencies.sh is run with libboost-dev in place of libboost-all-dev, which
pulls OpenMPI, libfabric and Ubuntu's UCX 1.16; Mooncake, store and P2P
included, uses only header-only Boost. A grep anchored to the package entry
fails the build if a MOONCAKE_COMMIT bump renames or drops it.

It also builds UCX from a pinned master commit (--with-ze --with-mlx5,
--enable-optimizations), since ZE IPC for Intel GPUs (openucx/ucx#11218) is in
no UCX release yet, into its
own prefix, /opt/ucx (NIXL finds it through its RUNPATH; no ld.so.conf entry), a
static Abseil 20250814.1 into /opt/abseil, and NIXL from a
pinned commit through NIXL's documented source install: the nixl-cu12 package,
the C++ libraries and plugins, then the nixl meta package. Mooncake's
dependencies.sh pulls in Ubuntu's libabsl-dev 20220623, too old for NIXL (VLOG
not declared), so the Abseil build goes first on PKG_CONFIG_PATH. nixl-cu12
keeps a RUNPATH to the meson prefix, so pip and meson share
--prefix=/opt/nixl. Afterwards only the build tools the venv did not already
have are removed, so packages sglang depends on (ninja, pyyaml) stay.
The NIXL pin includes ai-dynamo/nixl#1536: its UCX plugin passes the VRAM memory
type to UCX at registration, and the default auto hint selects ze-device on a
ZE-only UCX, so UCX does not misclassify XPU memory as host (NIXL_ERR_BACKEND)
and no UCX_MEMTYPE_CACHE override is needed.

test/registered/disaggregation/test_disaggregation_xpu.py runs both backends
on nightly-xpu-kernel-main-2-gpu through a shared mixin. Mooncake sets
only MC_USE_TENT=1, so it copies KV card to card; both servers see both cards
(same ZE_AFFINITY_MASK, decode on --base-gpu-id 1), which TENT needs for that.
Both servers use the
documented XPU attention backend, intel_xpu (page size 128), and prefill uses a
256-token chunk, so a ~1.1k-token greedy prompt that must recall a fact from its
first page covers multi-page, multi-chunk KV transfer. Each class fails, not skips, when its backend is not
importable, so the nightly also checks that the image carries both builds. In
CI it also fails, rather than skips, when fewer than two XPUs are visible, so a
runner with a missing card does not leave the nightly green; outside CI it
still skips.
The mixin sets use_rdma = False, a new PDDisaggregationServerBase flag
(default True, so CUDA tests are unchanged). With it, CI mode skips the NIC
lookup, --disaggregation-ib-device and the MC_GID_INDEX/UCX_NET_DEVICES env.
Without it the fixture hands both servers its CUDA-runner default NICs
(mlx5_roce*) on the NIC-less XPU runners, and Mooncake refuses to start.
get_rdma_devices_args() now counts cards with get_gpu_count() instead of
torch.cuda.device_count(), so the card-to-NIC mapping is right off CUDA too;
on CUDA the count is unchanged.
Decode keeps the default host_pool retraction backup now that sgl-project#32503 enables
HiCache L1<->L2 transfer on XPU.

scripts/ci/xpu/xpu_ci_start_container.sh adds --cap-add SYS_PTRACE: Level
Zero IPC (NIXL's UCX ze_ipc and Mooncake's XPU transport) maps the peer
process's device memory through pidfd_getfd(), which needs ptrace rights. In a
default container NIXL transfers fail with EPERM, and Mooncake stops copying
KV card to card. pr-test-xpu.yml drops test_disaggregation_xpu.py from its path filter,
since the test now runs only in the nightly.

Server-args validation now rejects SGLANG_MOONCAKE_CUSTOM_MEM_POOL on
--device xpu when it enables a pool: Mooncake's pools use CUDA allocators,
which XPU lacks. Values that leave the pool off are accepted, and CUDA, ROCm,
MUSA and Ascend NPU keep their existing behaviour.

Docs: the XPU page's P/D section adds a Mooncake backend subsection (build or
Docker image, MC_USE_TENT=1, card-to-card copies that need both servers to
see both cards and --cap-add SYS_PTRACE in containers, no Mooncake store so no
HiCache L3, a prefill/decode example on ZE_AFFINITY_MASK=0,1) and a backend column with Mooncake and NIXL nightly rows. The
NIXL subsection now requires a UCX built with the Level Zero transport (the
PyPI nixl wheel's bundled UCX has none) and says
containers need --cap-add SYS_PTRACE. Its launch commands no longer set
UCX_POSIX_USE_PROC_LINK=n, matching the nightly; the note now gives it as the fix
if UCX's shared-memory transport cannot open a peer's /proc/<pid>/fd/<fd>.
pd_disaggregation.mdx notes the XPU Mooncake and NIXL builds and that
SGLANG_MOONCAKE_CUSTOM_MEM_POOL is CUDA-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kpjeeja added a commit to kpjeeja/sglang that referenced this pull request Oct 23, 2026
XPU P/D landed on NIXL (sgl-project#24188), but the XPU CI image does not install NIXL,
so its registered test could not run. This builds both the Mooncake transfer
engine and NIXL into the image and runs the registered XPU P/D test on both
backends.

docker/xpu.Dockerfile builds the Mooncake transfer engine from a pinned
upstream commit with icpx (-DUSE_XPU=ON -DUSE_TENT=ON -DWITH_STORE=OFF; the
store does not build with icpx at that commit). The pin includes
kvcache-ai/Mooncake#4379, so on one node TENT's XPU transport copies KV card to
card through Level Zero IPC and no RDMA NIC is needed. The image also installs
a pinned sglang-router,
which the P/D tests launch between prefill and decode. Mooncake's
dependencies.sh is run with libboost-dev in place of libboost-all-dev, which
pulls OpenMPI, libfabric and Ubuntu's UCX 1.16; Mooncake, store and P2P
included, uses only header-only Boost. A grep anchored to the package entry
fails the build if a MOONCAKE_COMMIT bump renames or drops it.

It also builds UCX from a pinned master commit (--with-ze --with-mlx5,
--enable-optimizations), since ZE IPC for Intel GPUs (openucx/ucx#11218) is in
no UCX release yet, into its
own prefix, /opt/ucx (NIXL finds it through its RUNPATH; no ld.so.conf entry), a
static Abseil 20250814.1 into /opt/abseil, and NIXL from a
pinned commit through NIXL's documented source install: the nixl-cu12 package,
the C++ libraries and plugins, then the nixl meta package. Mooncake's
dependencies.sh pulls in Ubuntu's libabsl-dev 20220623, too old for NIXL (VLOG
not declared), so the Abseil build goes first on PKG_CONFIG_PATH. nixl-cu12
keeps a RUNPATH to the meson prefix, so pip and meson share
--prefix=/opt/nixl. Afterwards only the build tools the venv did not already
have are removed, so packages sglang depends on (ninja, pyyaml) stay.
The NIXL pin includes ai-dynamo/nixl#1536: its UCX plugin passes the VRAM memory
type to UCX at registration, and the default auto hint selects ze-device on a
ZE-only UCX, so UCX does not misclassify XPU memory as host (NIXL_ERR_BACKEND)
and no UCX_MEMTYPE_CACHE override is needed.

test/registered/disaggregation/test_disaggregation_xpu.py runs both backends
on nightly-xpu-kernel-main-2-gpu through a shared mixin. Mooncake sets
only MC_USE_TENT=1, so it copies KV card to card; both servers see both cards
(same ZE_AFFINITY_MASK, decode on --base-gpu-id 1), which TENT needs for that.
Both servers use the
documented XPU attention backend, intel_xpu (page size 128), and prefill uses a
256-token chunk, so a ~1.1k-token greedy prompt that must recall a fact from its
first page covers multi-page, multi-chunk KV transfer. Each class fails, not skips, when its backend is not
importable, so the nightly also checks that the image carries both builds. In
CI it also fails, rather than skips, when fewer than two XPUs are visible, so a
runner with a missing card does not leave the nightly green; outside CI it
still skips.
The mixin sets use_rdma = False, a new PDDisaggregationServerBase flag
(default True, so CUDA tests are unchanged). With it, CI mode skips the NIC
lookup, --disaggregation-ib-device and the MC_GID_INDEX/UCX_NET_DEVICES env.
Without it the fixture hands both servers its CUDA-runner default NICs
(mlx5_roce*) on the NIC-less XPU runners, and Mooncake refuses to start.
get_rdma_devices_args() now counts cards with get_gpu_count() instead of
torch.cuda.device_count(), so the card-to-NIC mapping is right off CUDA too;
on CUDA the count is unchanged.
Decode keeps the default host_pool retraction backup now that sgl-project#32503 enables
HiCache L1<->L2 transfer on XPU.

scripts/ci/xpu/xpu_ci_start_container.sh adds --cap-add SYS_PTRACE: Level
Zero IPC (NIXL's UCX ze_ipc and Mooncake's XPU transport) maps the peer
process's device memory through pidfd_getfd(), which needs ptrace rights. In a
default container NIXL transfers fail with EPERM, and Mooncake stops copying
KV card to card. pr-test-xpu.yml drops test_disaggregation_xpu.py from its path filter,
since the test now runs only in the nightly.

Server-args validation now rejects SGLANG_MOONCAKE_CUSTOM_MEM_POOL on
--device xpu when it enables a pool: Mooncake's pools use CUDA allocators,
which XPU lacks. Values that leave the pool off are accepted, and CUDA, ROCm,
MUSA and Ascend NPU keep their existing behaviour.

Docs: the XPU page's P/D section adds a Mooncake backend subsection (build or
Docker image, MC_USE_TENT=1, card-to-card copies that need both servers to
see both cards and --cap-add SYS_PTRACE in containers, no Mooncake store so no
HiCache L3, a prefill/decode example on ZE_AFFINITY_MASK=0,1) and a backend column with Mooncake and NIXL nightly rows. The
NIXL subsection now requires a UCX built with the Level Zero transport (the
PyPI nixl wheel's bundled UCX has none) and says
containers need --cap-add SYS_PTRACE. Its launch commands no longer set
UCX_POSIX_USE_PROC_LINK=n, matching the nightly; the note now gives it as the fix
if UCX's shared-memory transport cannot open a peer's /proc/<pid>/fd/<fd>.
pd_disaggregation.mdx notes the XPU Mooncake and NIXL builds and that
SGLANG_MOONCAKE_CUSTOM_MEM_POOL is CUDA-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kpjeeja added a commit to kpjeeja/sglang that referenced this pull request Oct 26, 2026
XPU P/D landed on NIXL (sgl-project#24188), but the XPU CI image does not install NIXL,
so its registered test could not run. This builds both the Mooncake transfer
engine and NIXL into the image and runs the registered XPU P/D test on both
backends.

docker/xpu.Dockerfile builds the Mooncake transfer engine from a pinned
upstream commit with icpx (-DUSE_XPU=ON -DUSE_TENT=ON -DWITH_STORE=OFF; the
store does not build with icpx at that commit). The pin includes
kvcache-ai/Mooncake#4379, so on one node TENT's XPU transport copies KV card to
card through Level Zero IPC and no RDMA NIC is needed. The image also installs
a pinned sglang-router,
which the P/D tests launch between prefill and decode. Mooncake's
dependencies.sh is run with libboost-dev in place of libboost-all-dev, which
pulls OpenMPI, libfabric and Ubuntu's UCX 1.16; Mooncake, store and P2P
included, uses only header-only Boost. A grep anchored to the package entry
fails the build if a MOONCAKE_COMMIT bump renames or drops it.

It also builds UCX from a pinned master commit (--with-ze --with-mlx5,
--enable-optimizations), since ZE IPC for Intel GPUs (openucx/ucx#11218) is in
no UCX release yet, into its
own prefix, /opt/ucx (NIXL finds it through its RUNPATH; no ld.so.conf entry), a
static Abseil 20250814.1 into /opt/abseil, and NIXL from a
pinned commit through NIXL's documented source install: the nixl-cu12 package,
the C++ libraries and plugins, then the nixl meta package. Mooncake's
dependencies.sh pulls in Ubuntu's libabsl-dev 20220623, too old for NIXL (VLOG
not declared), so the Abseil build goes first on PKG_CONFIG_PATH. nixl-cu12
keeps a RUNPATH to the meson prefix, so pip and meson share
--prefix=/opt/nixl. Afterwards only the build tools the venv did not already
have are removed, so packages sglang depends on (ninja, pyyaml) stay.
The NIXL pin includes ai-dynamo/nixl#1536: its UCX plugin passes the VRAM memory
type to UCX at registration, and the default auto hint selects ze-device on a
ZE-only UCX, so UCX does not misclassify XPU memory as host (NIXL_ERR_BACKEND)
and no UCX_MEMTYPE_CACHE override is needed.

test/registered/disaggregation/test_disaggregation_xpu.py runs both backends
on nightly-xpu-kernel-main-2-gpu through a shared mixin. Mooncake sets
only MC_USE_TENT=1, so it copies KV card to card; both servers see both cards
(same ZE_AFFINITY_MASK, decode on --base-gpu-id 1), which TENT needs for that.
Both servers use the
documented XPU attention backend, intel_xpu (page size 128), and prefill uses a
256-token chunk, so a ~1.1k-token greedy prompt that must recall a fact from its
first page covers multi-page, multi-chunk KV transfer. Each class fails, not skips, when its backend is not
importable, so the nightly also checks that the image carries both builds. In
CI it also fails, rather than skips, when fewer than two XPUs are visible, so a
runner with a missing card does not leave the nightly green; outside CI it
still skips.
The mixin sets use_rdma = False, a new PDDisaggregationServerBase flag
(default True, so CUDA tests are unchanged). With it, CI mode skips the NIC
lookup, --disaggregation-ib-device and the MC_GID_INDEX/UCX_NET_DEVICES env.
Without it the fixture hands both servers its CUDA-runner default NICs
(mlx5_roce*) on the NIC-less XPU runners, and Mooncake refuses to start.
get_rdma_devices_args() now counts cards with get_gpu_count() instead of
torch.cuda.device_count(), so the card-to-NIC mapping is right off CUDA too;
on CUDA the count is unchanged.
Decode keeps the default host_pool retraction backup now that sgl-project#32503 enables
HiCache L1<->L2 transfer on XPU.

scripts/ci/xpu/xpu_ci_start_container.sh adds --cap-add SYS_PTRACE: Level
Zero IPC (NIXL's UCX ze_ipc and Mooncake's XPU transport) maps the peer
process's device memory through pidfd_getfd(), which needs ptrace rights. In a
default container NIXL transfers fail with EPERM, and Mooncake stops copying
KV card to card. pr-test-xpu.yml drops test_disaggregation_xpu.py from its path filter,
since the test now runs only in the nightly.

Server-args validation now rejects SGLANG_MOONCAKE_CUSTOM_MEM_POOL on
--device xpu when it enables a pool: Mooncake's pools use CUDA allocators,
which XPU lacks. Values that leave the pool off are accepted, and CUDA, ROCm,
MUSA and Ascend NPU keep their existing behaviour.

Docs: the XPU page's P/D section adds a Mooncake backend subsection (build or
Docker image, MC_USE_TENT=1, card-to-card copies that need both servers to
see both cards and --cap-add SYS_PTRACE in containers, no Mooncake store so no
HiCache L3, a prefill/decode example on ZE_AFFINITY_MASK=0,1) and a backend column with Mooncake and NIXL nightly rows. The
NIXL subsection now requires a UCX built with the Level Zero transport (the
PyPI nixl wheel's bundled UCX has none) and says
containers need --cap-add SYS_PTRACE. Its launch commands no longer set
UCX_POSIX_USE_PROC_LINK=n, matching the nightly; the note now gives it as the fix
if UCX's shared-memory transport cannot open a peer's /proc/<pid>/fd/<fd>.
pd_disaggregation.mdx notes the XPU Mooncake and NIXL builds and that
SGLANG_MOONCAKE_CUSTOM_MEM_POOL is CUDA-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kpjeeja added a commit to kpjeeja/sglang that referenced this pull request Oct 26, 2026
XPU P/D landed on NIXL (sgl-project#24188), but the XPU CI image does not install NIXL,
so its registered test could not run. This builds both the Mooncake transfer
engine and NIXL into the image and runs the registered XPU P/D test on both
backends.

docker/xpu.Dockerfile builds the Mooncake transfer engine from a pinned
upstream commit with icpx (-DUSE_XPU=ON -DUSE_TENT=ON -DWITH_STORE=OFF; the
store does not build with icpx at that commit). The pin includes
kvcache-ai/Mooncake#4379, so on one node TENT's XPU transport copies KV card to
card through Level Zero IPC and no RDMA NIC is needed. The image also installs
a pinned sglang-router,
which the P/D tests launch between prefill and decode. Mooncake's
dependencies.sh is run with libboost-dev in place of libboost-all-dev, which
pulls OpenMPI, libfabric and Ubuntu's UCX 1.16; Mooncake, store and P2P
included, uses only header-only Boost. A grep anchored to the package entry
fails the build if a MOONCAKE_COMMIT bump renames or drops it.

It also builds UCX from a pinned master commit (--with-ze --with-mlx5,
--enable-optimizations), since ZE IPC for Intel GPUs (openucx/ucx#11218) is in
no UCX release yet, into its
own prefix, /opt/ucx (NIXL finds it through its RUNPATH; no ld.so.conf entry), a
static Abseil 20250814.1 into /opt/abseil, and NIXL from a
pinned commit through NIXL's documented source install: the nixl-cu12 package,
the C++ libraries and plugins, then the nixl meta package. Mooncake's
dependencies.sh pulls in Ubuntu's libabsl-dev 20220623, too old for NIXL (VLOG
not declared), so the Abseil build goes first on PKG_CONFIG_PATH. nixl-cu12
keeps a RUNPATH to the meson prefix, so pip and meson share
--prefix=/opt/nixl. Afterwards only the build tools the venv did not already
have are removed, so packages sglang depends on (ninja, pyyaml) stay.
The NIXL pin includes ai-dynamo/nixl#1536: its UCX plugin passes the VRAM memory
type to UCX at registration, and the default auto hint selects ze-device on a
ZE-only UCX, so UCX does not misclassify XPU memory as host (NIXL_ERR_BACKEND)
and no UCX_MEMTYPE_CACHE override is needed.

test/registered/disaggregation/test_disaggregation_xpu.py runs both backends
on nightly-xpu-kernel-main-2-gpu through a shared mixin. Mooncake sets
only MC_USE_TENT=1, so it copies KV card to card; both servers see both cards
(same ZE_AFFINITY_MASK, decode on --base-gpu-id 1), which TENT needs for that.
Both servers use the
documented XPU attention backend, intel_xpu (page size 128), and prefill uses a
256-token chunk, so a ~1.1k-token greedy prompt that must recall a fact from its
first page covers multi-page, multi-chunk KV transfer. Each class fails, not skips, when its backend is not
importable, so the nightly also checks that the image carries both builds. In
CI it also fails, rather than skips, when fewer than two XPUs are visible, so a
runner with a missing card does not leave the nightly green; outside CI it
still skips.
The mixin sets use_rdma = False, a new PDDisaggregationServerBase flag
(default True, so CUDA tests are unchanged). With it, CI mode skips the NIC
lookup, --disaggregation-ib-device and the MC_GID_INDEX/UCX_NET_DEVICES env.
Without it the fixture hands both servers its CUDA-runner default NICs
(mlx5_roce*) on the NIC-less XPU runners, and Mooncake refuses to start.
get_rdma_devices_args() now counts cards with get_gpu_count() instead of
torch.cuda.device_count(), so the card-to-NIC mapping is right off CUDA too;
on CUDA the count is unchanged.
Decode keeps the default host_pool retraction backup now that sgl-project#32503 enables
HiCache L1<->L2 transfer on XPU.

scripts/ci/xpu/xpu_ci_start_container.sh adds --cap-add SYS_PTRACE: Level
Zero IPC (NIXL's UCX ze_ipc and Mooncake's XPU transport) maps the peer
process's device memory through pidfd_getfd(), which needs ptrace rights. In a
default container NIXL transfers fail with EPERM, and Mooncake stops copying
KV card to card. pr-test-xpu.yml drops test_disaggregation_xpu.py from its path filter,
since the test now runs only in the nightly.

Server-args validation now rejects SGLANG_MOONCAKE_CUSTOM_MEM_POOL on
--device xpu when it enables a pool: Mooncake's pools use CUDA allocators,
which XPU lacks. Values that leave the pool off are accepted, and CUDA, ROCm,
MUSA and Ascend NPU keep their existing behaviour.

Docs: the XPU page's P/D section adds a Mooncake backend subsection (build or
Docker image, MC_USE_TENT=1, card-to-card copies that need both servers to
see both cards and --cap-add SYS_PTRACE in containers, no Mooncake store so no
HiCache L3, a prefill/decode example on ZE_AFFINITY_MASK=0,1) and a backend column with Mooncake and NIXL nightly rows. The
NIXL subsection now requires a UCX built with the Level Zero transport (the
PyPI nixl wheel's bundled UCX has none) and says
containers need --cap-add SYS_PTRACE. Its launch commands no longer set
UCX_POSIX_USE_PROC_LINK=n, matching the nightly; the note now gives it as the fix
if UCX's shared-memory transport cannot open a peer's /proc/<pid>/fd/<fd>.
pd_disaggregation.mdx notes the XPU Mooncake and NIXL builds and that
SGLANG_MOONCAKE_CUSTOM_MEM_POOL is CUDA-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wzy-782 added a commit to wzy-782/Mooncake that referenced this pull request Oct 29, 2026
Conflicts with upstream main, resolved:
- transfer_engine_impl.cpp, planTransport (getTransportType before
  kvcache-ai#4378): upstream added the XPU dma-buf RDMA (kvcache-ai#4378) and same-host XPU
  IPC (kvcache-ai#4379) routes. A request with a TPU side always stages and never
  takes either route; XPU and MLU requests behave as upstream.
- transfer_engine_impl.cpp, findStagingPolicy: #2's combined TPU/XPU/MLU
  staging block replaces the old TPU case, with upstream's note on the
  XPU dma-buf bypass. XPU memory is no longer called never
  NIC-addressable.
- transfer_engine_impl.cpp, submitTransfer: upstream's progress lock
  (kvcache-ai#4720) around #2's prepareSubmit call with the staged route.
- tent/tests/CMakeLists.txt: #1's TPU adapter tests, then #2's engine,
  staged-route and host-initiator tests.

Known failure: EngineFailoverE2E.MergedStagingRequestsShareOneSubmission
(kvcache-ai#4797). The test marks the peer buffer as MLU only in the test thread's
segment cache, which is thread-local. #2 re-plans a staged request's hop
on the ProxyManager thread, whose cache shows host memory, so the hop
gets no route.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation run-ci Transfer Engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants