Skip to content

UCP/PROTO: Fix buffer copy estimation for CPU-accessible memory - #11902

Merged
tvegas1 merged 14 commits into
openucx:masterfrom
intel-staging:fix/proto-cpu-accessible-memtype-eligibility
Oct 30, 2026
Merged

tvegas1 merged 14 commits into
openucx:masterfrom
intel-staging:fix/proto-cpu-accessible-memtype-eligibility

Conversation

@yafshar

@yafshar yafshar commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

What?

ucp_proto_init_add_buffer_copy_time() modeled a plain memcpy only when both buffers are UCS_MEMORY_TYPE_HOST. For the other memory types in UCS_MEMORY_TYPES_CPU_ACCESSIBLE — ze-host, ze-managed and rocm-managed — this went wrong in two different ways:

  • Direct-access protocols, which set memtype_op == UCT_EP_OP_LAST, fell through to the memtype endpoint lookup and returned UCS_ERR_UNSUPPORTED, so the candidate could be rejected. ucp_proto_buffer_copy_factor_id() also asserted that the operation is GET_ZCOPY or PUT_ZCOPY, which aborted:

    proto_init.c:292  Assertion `(memtype_op == UCT_EP_OP_GET_ZCOPY) || (memtype_op == UCT_EP_OP_PUT_ZCOPY)' failed: memtype_op=15
  • Eager protocols cost their payload copies with UCT_EP_OP_GET_SHORT (sender pack) and UCT_EP_OP_PUT_SHORT (receiver unpack), and these were costed with the copy interface bandwidth, so the candidate was mis-ranked.

Neither matches runtime behavior: ucp_dt_contig_pack()/unpack() use memcpy for CPU-accessible memory and reach the memtype endpoint only for non-CPU-accessible memory.

Why?

With ze_copy, initiating a 4 MB tag send from ze-host memory aborted while initializing protocol candidates. Even with the assertion silenced, the direct-access candidate was dropped, and the eager candidates were priced by the copy interface rather than by memcpy.

How?

  • ucp_proto_buffer_copy_factor_id() handles UCT_EP_OP_LAST explicitly: it asserts that both memory types are CPU accessible, reporting both of them if not, and attributes the copy to the CPU factor.
  • ucp_proto_init_add_buffer_copy_time() models the copy as memcpy when its cost is attributed to the CPU factor and both memory types are CPU accessible. This covers host/host, UCT_EP_OP_LAST, and GET_SHORT/PUT_SHORT between CPU-accessible buffers. GET_ZCOPY/PUT_ZCOPY involving non-host memory keep the copy interface estimation, because the rendezvous mtype protocols perform a real memtype endpoint copy. Non-CPU-accessible memory such as ze-device is unchanged.

This changes protocol selection, not only the abort. In the tested configuration, tag send from ze-host previously selected eager short at size 0 and rendezvous from one byte onward. It now selects:

      0..115  eager short
    116..404  eager copy-in copy-out
   405..8247  eager zero-copy copy-out
 8248..25731  multi-frag eager zero-copy copy-out
  25732..inf  rendezvous zero-copy read from remote

The crossover values are hardware dependent; the shape of the change is that eager is no longer priced out of small and mid-size messages.

Test in test_ucp_proto.cc, protocol selection only (no data movement):

  • test_ucp_proto_cpu_accessible.small_msg_eager, instantiated with UCP_INSTANTIATE_TEST_CASE, checks that a one-byte tag send from every non-host type in UCS_MEMORY_TYPES_CPU_ACCESSIBLE selects an eager protocol. It runs protocol selection on a select_param without allocating a payload buffer, so it needs no ZE or ROCm hardware.
  • It does not compare with the protocol selected for host memory. On tcp, host memory selects egr/single/zcopy at one byte, while CPU-accessible non-host memory selects egr/short, because tcp zero-copy accesses only host memory. Both are correct.
  • With master's proto_init.c the test hits the assertion above. With the UCT_EP_OP_LAST handling but without the CPU-accessible memcpy condition, every transport selects reconfig for these memory types.

Tested on Intel Arc Pro B60, rc_mlx5 over RoCE:

  • Protocol initialization completes. The thresholds above are observed for ze-host. ze-device is not CPU accessible and is unchanged.
  • ucx_perftest tag_lat -V passes for ze-host and ze-managed, which aborted before.

The gtest was run on an Intel Arc Pro B70 node and an NVIDIA H200 node, both with mlx5 over RoCE. It passes on the nine instantiations available on each node (srd and ugni are not). *test_ucp_proto* has no new failures: on the H200 node there are none, and the eight on the B70 node fail the same way without this change (ze-host and ze-device buffers registered as host memory). On the B70 node the run also had the change from #12110, which this branch predates: without it, the ze_copy device-count warning fails every gtest when two GPUs are visible.

Remaining gaps: CPU-accessible GET_ZCOPY/PUT_ZCOPY costing is not covered, because protocol selection reaches that path only above a hardware-dependent threshold and neither RNDV_THRESH nor RNDV_SCHEME reliably forces it for these memory types; covering it would need a lower-level test that constructs and inspects buffer-copy performance directly with a configured memtype endpoint. The rocm-managed case is covered by the protocol-selection tests, but its impact was not validated on ROCm hardware.

…emory

Protocols which access the payload directly do not set a memtype
operation, and ucp_proto_common_check_mem_access() explicitly permits
UCT_EP_OP_LAST when the memory is accessible from the CPU. The
performance estimation path did not follow that contract:

- ucp_proto_buffer_copy_factor_id() asserted that the operation is
  GET_ZCOPY or PUT_ZCOPY, so any CPU-accessible memory type other than
  host aborted with "memtype_op=16".

- ucp_proto_init_add_buffer_copy_time() modeled a plain memcpy only when
  both buffers are UCS_MEMORY_TYPE_HOST. Other CPU-accessible types fell
  through to the memtype endpoint lookup and returned
  UCS_ERR_UNSUPPORTED, which silently dropped the protocol.

Both affect the memory types in UCS_MEMORY_TYPES_CPU_ACCESSIBLE which
are not plain host memory: ze-host, ze-managed and rocm-managed.

Add ucp_proto_buffer_copy_is_memcpy() to decide when the copy is
performed by the CPU, and use it for the memcpy estimation. Keep the
explicit UCT_EP_OP_LAST branch in ucp_proto_buffer_copy_factor_id() so
that a non-CPU-accessible pair still reports the memory types rather
than the misleading zero-copy assertion.

With rc_x and ze_copy, initiating a 4 MB tag send from ze-host memory
aborted while initializing protocol candidates at proto_init.c:292.
After the fix, protocol initialization completes. For messages in the
0..2038-byte range, ze-host and ze-managed select "eager short" instead
of "eager copy-in copy-out", confirming that direct-access protocols
remain eligible. ze-device is not CPU accessible and is unchanged.

Add test_ucp_proto_ze.cpu_accessible_direct_proto_eligible, which asserts
that egr/short is selected for ze-host and ze-managed. Reverting only
proto_init.c makes it reproduce the original assertion failure.

Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread src/ucp/proto/proto_init.c Resolved
@yafshar
yafshar marked this pull request as ready for review September 5, 2026 11:38
@svc-ucx

svc-ucx commented Sep 5, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Tests gpu on worker 3) · commit 71fac44b

TL;DR: The GPU gtest job failed on a single test — shm_ib/test_ucp_proto_am_rndv.am_explicit_scheme_disables_force_provenance/0 — because the protocol chosen for a 1 MB CUDA AM send is no longer the hard‑expected am/rndv; the commit under test widened protocol eligibility for CPU‑accessible memory (ucp_proto_common_check_mem_access() / ucp_proto_buffer_copy_is_memcpy()), which changes protocol selection/costing, so either the eligibility rule must be narrowed to pairwise CPU‑accessible copies or the test's rigid protocol‑name expectation must be updated.

Full analysis

Summary: make test in the "gpu on worker 3" Azure job exited with error after 1 of 10257 gtests failed: shm_ib/test_ucp_proto_am_rndv.am_explicit_scheme_disables_force_provenance/0, GetParam() = shm,ib,cuda_copy,rocm_copy (all other tests passed, 20 skipped).

Root cause: The failing test (test/gtest/ucp/test_ucp_proto.cc:779) runs with RNDV_PIPELINE_SHM_CUDA_STAGING_FORCE=y + RNDV_SCHEME=get_zcopy and then calls check_am_rndv_remote_proto_config(0, 0). That helper goes through select_am_rndv_remote_proto_config(), which requires that the protocol selected for a 1 MB UCP_OP_ID_AM_SEND with UCS_MEMORY_TYPE_CUDA be literally "am/rndv" (EXPECT_STREQ("am/rndv", ...) at line 439, then ASSERT_NE(nullptr, remote_proto_config) at line 455). Nothing in the forced‑provenance path can trigger for AM (ucp_proto_rndv_shm_pipeline_force_scope() in src/ucp/rndv/proto_rndv.inl:30 bails out when TAG_RNDV op flag is absent and when rndv_mode != AUTO), so the only assertions that can fail here are the protocol‑selection ones.

The commit under test changes exactly that selection logic:

  • ucp_proto_common_check_mem_access() (src/ucp/proto/proto_init.c:517‑532) now keeps protocols with memtype_op == UCT_EP_OP_LAST (direct buffer access) eligible for any UCP_MEM_IS_ACCESSIBLE_FROM_CPU() memory instead of host‑only.
  • ucp_proto_buffer_copy_is_memcpy() (proto_init.c:283‑293) now costs such copies as a plain CPU memcpy at bcopy_bw, and ucp_proto_buffer_copy_factor_id() gained an ucs_assertv() (proto_init.c:313) that assumes both local and remote types are CPU accessible — while ucp_proto_init_add_buffer_copy_time() still returns UCS_ERR_UNSUPPORTED for UCT_EP_OP_LAST (line 388) when they are not.

Widening eligibility and making direct‑access protocols look cheaper changes the winner/thresholds of protocol selection, so with an explicit RNDV_SCHEME=get_zcopy on this shm+ib+cuda_copy worker a non‑am/rndv protocol is now returned at 1 MB and the test's hard‑coded name check fails. (Caveat: the Azure log only exposes the tail of the gtest output, so the exact EXPECT_* line is not quoted in the log; the failure is confined to this code path by the summary line plus the test source.)

Implicated commit: [REDACTED:Hex High Entropy String] — Yaser Afshar, "UCP/PROTO: Keep direct access protocols eligible for CPU-accessible memory" (touches both src/ucp/proto/proto_init.c and test/gtest/ucp/test_ucp_proto.cc)

File: src/ucp/proto/proto_init.c:517-532 (and proto_init.c:283-293, proto_init.c:313, proto_init.c:388); test expectation at test/gtest/ucp/test_ucp_proto.cc:439 used by test/gtest/ucp/test_ucp_proto.cc:779

Suggested fix:

  1. Narrow the new rule so it only applies when the copy is genuinely CPU‑doable end‑to‑end: gate ucp_proto_common_check_mem_access() on the pair of memory types (local select_param->mem_type and rkey_config_key->mem_type / reg_mem_info.type) being CPU accessible, keeping the memtype_op != UCT_EP_OP_LAST requirement otherwise. This removes the inconsistency between the new ucs_assertv at proto_init.c:313 and the UCT_EP_OP_LAST → UCS_ERR_UNSUPPORTED path at proto_init.c:388, and limits the selection perturbation to managed memory only.
  2. If the broader eligibility is intentional, make the test robust instead of pinning a name: in select_am_rndv_remote_proto_config() skip/accept when the selected protocol is not am/rndv (or use UCS_TEST_SKIP_R with the selected protocol name and ucp_ep_print_info() dump) so protocol‑selection changes on GPU workers don't produce a bare EXPECT_STREQ failure.
  3. Re‑run this job with UCX_LOG_LEVEL=debug/ucp_ep_print_info for the CUDA AM 1 MB selection to confirm which protocol replaced am/rndv before merging.

Related: PR #11902 (this PR); prior CI triage of the same tests: #11685, #11858, #11861, #11864

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 5dacb1c1-31a9-435a-addf-e57e2788ab64 in the triage console for the audit trail.

@yafshar yafshar closed this Sep 5, 2026
@yafshar yafshar reopened this Sep 5, 2026
@yafshar

yafshar commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

🤖 CI Triage Agent — UCX PR (Tests gpu on worker 3) · commit 71fac44b

TL;DR: The GPU gtest job failed on a single test — shm_ib/test_ucp_proto_am_rndv.am_explicit_scheme_disables_force_provenance/0 — because the protocol chosen for a 1 MB CUDA AM send is no longer the hard‑expected am/rndv; the commit under test widened protocol eligibility for CPU‑accessible memory (ucp_proto_common_check_mem_access() / ucp_proto_buffer_copy_is_memcpy()), which changes protocol selection/costing, so either the eligibility rule must be narrowed to pairwise CPU‑accessible copies or the test's rigid protocol‑name expectation must be updated.

Full analysis
Summary: make test in the "gpu on worker 3" Azure job exited with error after 1 of 10257 gtests failed: shm_ib/test_ucp_proto_am_rndv.am_explicit_scheme_disables_force_provenance/0, GetParam() = shm,ib,cuda_copy,rocm_copy (all other tests passed, 20 skipped).

Root cause: The failing test (test/gtest/ucp/test_ucp_proto.cc:779) runs with RNDV_PIPELINE_SHM_CUDA_STAGING_FORCE=y + RNDV_SCHEME=get_zcopy and then calls check_am_rndv_remote_proto_config(0, 0). That helper goes through select_am_rndv_remote_proto_config(), which requires that the protocol selected for a 1 MB UCP_OP_ID_AM_SEND with UCS_MEMORY_TYPE_CUDA be literally "am/rndv" (EXPECT_STREQ("am/rndv", ...) at line 439, then ASSERT_NE(nullptr, remote_proto_config) at line 455). Nothing in the forced‑provenance path can trigger for AM (ucp_proto_rndv_shm_pipeline_force_scope() in src/ucp/rndv/proto_rndv.inl:30 bails out when TAG_RNDV op flag is absent and when rndv_mode != AUTO), so the only assertions that can fail here are the protocol‑selection ones.

The commit under test changes exactly that selection logic:

  • ucp_proto_common_check_mem_access() (src/ucp/proto/proto_init.c:517‑532) now keeps protocols with memtype_op == UCT_EP_OP_LAST (direct buffer access) eligible for any UCP_MEM_IS_ACCESSIBLE_FROM_CPU() memory instead of host‑only.
  • ucp_proto_buffer_copy_is_memcpy() (proto_init.c:283‑293) now costs such copies as a plain CPU memcpy at bcopy_bw, and ucp_proto_buffer_copy_factor_id() gained an ucs_assertv() (proto_init.c:313) that assumes both local and remote types are CPU accessible — while ucp_proto_init_add_buffer_copy_time() still returns UCS_ERR_UNSUPPORTED for UCT_EP_OP_LAST (line 388) when they are not.

Widening eligibility and making direct‑access protocols look cheaper changes the winner/thresholds of protocol selection, so with an explicit RNDV_SCHEME=get_zcopy on this shm+ib+cuda_copy worker a non‑am/rndv protocol is now returned at 1 MB and the test's hard‑coded name check fails. (Caveat: the Azure log only exposes the tail of the gtest output, so the exact EXPECT_* line is not quoted in the log; the failure is confined to this code path by the summary line plus the test source.)

Implicated commit: [REDACTED:Hex High Entropy String] — Yaser Afshar, "UCP/PROTO: Keep direct access protocols eligible for CPU-accessible memory" (touches both src/ucp/proto/proto_init.c and test/gtest/ucp/test_ucp_proto.cc)

File: src/ucp/proto/proto_init.c:517-532 (and proto_init.c:283-293, proto_init.c:313, proto_init.c:388); test expectation at test/gtest/ucp/test_ucp_proto.cc:439 used by test/gtest/ucp/test_ucp_proto.cc:779

Suggested fix:

  1. Narrow the new rule so it only applies when the copy is genuinely CPU‑doable end‑to‑end: gate ucp_proto_common_check_mem_access() on the pair of memory types (local select_param->mem_type and rkey_config_key->mem_type / reg_mem_info.type) being CPU accessible, keeping the memtype_op != UCT_EP_OP_LAST requirement otherwise. This removes the inconsistency between the new ucs_assertv at proto_init.c:313 and the UCT_EP_OP_LAST → UCS_ERR_UNSUPPORTED path at proto_init.c:388, and limits the selection perturbation to managed memory only.
  2. If the broader eligibility is intentional, make the test robust instead of pinning a name: in select_am_rndv_remote_proto_config() skip/accept when the selected protocol is not am/rndv (or use UCS_TEST_SKIP_R with the selected protocol name and ucp_ep_print_info() dump) so protocol‑selection changes on GPU workers don't produce a bare EXPECT_STREQ failure.
  3. Re‑run this job with UCX_LOG_LEVEL=debug/ucp_ep_print_info for the CUDA AM 1 MB selection to confirm which protocol replaced am/rndv before merging.

Related: PR #11902 (this PR); prior CI triage of the same tests: #11685, #11858, #11861, #11864

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 5dacb1c1-31a9-435a-addf-e57e2788ab64 in the triage console for the audit trail.

This analysis is based on a change that isn't in this PR. ucp_proto_common_check_mem_access() is untouched here — its body is byte-identical at master and 71fac44b; the UCP_MEM_IS_ACCESSIBLE_FROM_CPU() predicate is pre-existing. Eligibility was not widened.

The failing test uses UCS_MEMORY_TYPE_CUDA (not CUDA_MANAGED), which is not CPU accessible, so the new is_memcpy() arm evaluates exactly as the old host-to-host check and UCT_EP_OP_LAST still returns UCS_ERR_UNSUPPORTED.

No costing or selection change for CUDA — this cannot alter the protocol chosen for a 1 MB CUDA AM send.

The failure is pre-existing: same test failed on #11685 (093ce688) and #11858 (cc5c6916). The #11858 triage found the real cause — with RNDV_SCHEME=get_zcopy, am/rndv may not be selected and the helper hard-asserts the name via an unguarded EXPECT_STREQ. That's suggested fix (2), and it belongs in its own PR.

Suggested fix (1) would regress this PR: pair-gating the eligibility check makes direct-access protocols ineligible for ZE_HOST / ZE_MANAGED, the bug being fixed here.

yao531441 added a commit to yao531441/llm-d that referenced this pull request Sep 16, 2026
Add modelserver/xpu/vllm/base/ mirroring the GPU OffloadingConnector
P2P-tier setup, adapted for Intel XPU:

- DRA ResourceClaimTemplate (gpu.intel.com), 1 XPU per pod, matching
  the pattern used by precise-prefix-cache-routing and
  tiered-prefix-cache's Intel XPU overlays, instead of the GPU
  overlay's nvidia.com/gpu device-plugin request.
- CI-sized functional check: 2 replicas (1 source + 1 receiver) of
  Qwen/Qwen3-0.6B instead of the GPU overlay's 16x gpt-oss-120b -
  validates the same P2P pull mechanism without requiring 24GB+ of
  device memory per pod or reproducing the GPU benchmark's scale.
  cpu_bytes_to_use and the shm tier are sized down to match.
- Same routing-sidecar (patch-sidecar.yaml) and P2P/kv-events port
  layout as the GPU overlay - both are accelerator-agnostic.

No RDMA overlay (xpu/vllm/rdma) is added. Direct RDMA over Intel XPU
device memory currently hits an upstream UCX ze_copy/DMA-BUF
data-correctness bug (silently wrong bytes, reported success) that
guides/modelexpress-p2p's Intel XPU PR (llm-d#2461) already ran into and
documented; tracked at openucx/ucx#11902 and #11903. The TCP-only
side channel here does not depend on that fix and is safe to ship now.

README changes:
- Supported Hardware Backends: document the Intel XPU variant, its
  scope (functional check, not a benchmark), and why RDMA is deferred.
- Step 3 (Deploy the Model Server): ACCELERATOR_TYPE now documents
  xpu, and TRANSPORT=base is called out as the only option for xpu.

Verified guides/p2p-kv-cache-sharing/modelserver/xpu/vllm/base renders
cleanly with 'kubectl kustomize' (ServiceAccount, Deployment with
sidecar + engine container merged correctly, port 8000->8200 renamed,
ResourceClaimTemplate name-referenced correctly). Not yet deployed to
a live cluster.

Signed-off-by: Yao, Qing <qing.yao@intel.com>
yao531441 added a commit to yao531441/llm-d that referenced this pull request Sep 16, 2026
Traced the actual vLLM OffloadingConnector/TieringOffloadingSpec P2P
data path: every transfer is staged through its CPU-mmap-backed
offload tier, and NIXL registers only that host memory (DRAM) with
UCX. XPU device memory is never handed to UCX/NIXL directly, unlike
guides/modelexpress-p2p's Intel XPU variant (llm-d#2461), which
does register device memory for its weight transfer and genuinely
needs UCX_TLS=tcp,ze_copy.

So for this overlay:
- UCX_TLS=tcp was already the right pin, but the comment overstated
  the risk (implying UCX could still reach device memory here).
- The claim that a missing RDMA overlay is 'blocked' by the upstream
  UCX ze_copy/DMA-BUF bug (openucx/ucx#11902, #11903) doesn't hold for
  this connector: an RDMA transport here would still only move
  CPU-to-CPU DRAM, not touch XPU VRAM directly. It just hasn't been
  built/validated yet, for unrelated reasons.
- 'TCP-only side channel' conflated the P2P tier's ZMQ control channel
  with the NIXL/UCX data plane; described them separately.

Reworded the patch-vllm.yaml comment, kustomization.yaml comment, and
README Supported Hardware Backends section accordingly, keeping a
pointer to the real UCX bug and llm-d#2461 for readers evaluating direct
XPU-device RDMA elsewhere.

Signed-off-by: Yao, Qing <qing.yao@intel.com>
maugustosilva pushed a commit to llm-d/llm-d that referenced this pull request Sep 16, 2026
* feat(p2p-kv-cache-sharing): add Intel XPU (TCP-only) variant

Add modelserver/xpu/vllm/base/ mirroring the GPU OffloadingConnector
P2P-tier setup, adapted for Intel XPU:

- DRA ResourceClaimTemplate (gpu.intel.com), 1 XPU per pod, matching
  the pattern used by precise-prefix-cache-routing and
  tiered-prefix-cache's Intel XPU overlays, instead of the GPU
  overlay's nvidia.com/gpu device-plugin request.
- CI-sized functional check: 2 replicas (1 source + 1 receiver) of
  Qwen/Qwen3-0.6B instead of the GPU overlay's 16x gpt-oss-120b -
  validates the same P2P pull mechanism without requiring 24GB+ of
  device memory per pod or reproducing the GPU benchmark's scale.
  cpu_bytes_to_use and the shm tier are sized down to match.
- Same routing-sidecar (patch-sidecar.yaml) and P2P/kv-events port
  layout as the GPU overlay - both are accelerator-agnostic.

No RDMA overlay (xpu/vllm/rdma) is added. Direct RDMA over Intel XPU
device memory currently hits an upstream UCX ze_copy/DMA-BUF
data-correctness bug (silently wrong bytes, reported success) that
guides/modelexpress-p2p's Intel XPU PR (#2461) already ran into and
documented; tracked at openucx/ucx#11902 and #11903. The TCP-only
side channel here does not depend on that fix and is safe to ship now.

README changes:
- Supported Hardware Backends: document the Intel XPU variant, its
  scope (functional check, not a benchmark), and why RDMA is deferred.
- Step 3 (Deploy the Model Server): ACCELERATOR_TYPE now documents
  xpu, and TRANSPORT=base is called out as the only option for xpu.

Verified guides/p2p-kv-cache-sharing/modelserver/xpu/vllm/base renders
cleanly with 'kubectl kustomize' (ServiceAccount, Deployment with
sidecar + engine container merged correctly, port 8000->8200 renamed,
ResourceClaimTemplate name-referenced correctly). Not yet deployed to
a live cluster.

* p2p-kv-cache-sharing: document XPU cluster verification results

Tested the xpu/vllm/base overlay on XPU-8xB60-817225 (real Intel Arc Pro
B60 hardware). DRA allocation, sidecar init, and vLLM boot with
OffloadingConnector + NIXL/UCX + P2P secondary tier all verified working.

However, the P2P pull itself is not yet verified: the pinned XPU image
(llm-d-xpu:v0.9.0, vLLM 0.26.0) has no remote_kv_source handling in its
OffloadingConnector (only max_offload_tokens), unlike the GPU overlay's
vllm-openai:v0.27.1. Documented this version-gap limitation in the guide
README.

* p2p-kv-cache-sharing: confirm XPU P2P pull works with nightly vLLM image

Manual pull test on real Intel Arc Pro B60 hardware (XPU-8xB60-817225)
confirms the P2P pull mechanism itself works correctly once the pinned
vLLM version carries vllm/v1/kv_offload/tiering/p2p/. Swapping the test
deployment's image from ghcr.io/llm-d/llm-d-xpu:v0.9.0 (vLLM 0.26.0, no
remote_kv_source support) to docker.io/vllm/vllm-openai-xpu:nightly
(vLLM 0.29.1rc1) made a 4096-token prefix pull succeed end-to-end
(external_prefix_cache_hits_total incremented by exactly 4096,
reproduced twice).

Updates the README's Intel XPU warning to reflect this: the gap is
purely the pinned image's vLLM version, not the manifests or the pull
mechanism, with a workaround (temporarily point the xpu-vllm component
at nightly) documented until ghcr.io/llm-d/llm-d-xpu is rebuilt against
a newer vLLM release.

* p2p-kv-cache-sharing: default XPU overlay to nightly xpu-vllm image

ghcr.io/llm-d/llm-d-xpu:v0.9.0 (vLLM 0.26.0) has no remote_kv_source
handling in its OffloadingConnector, so the P2P pull this guide exists
to demonstrate cannot work on it. Point the overlay at the existing
xpu-vllm/nightly component (vLLM main) instead, which was verified
end-to-end on real Intel Arc Pro B60 hardware, rather than shipping an
overlay that starts cleanly but can't do the one thing the guide is
about. Switch back to the llm-d component once ghcr.io/llm-d/llm-d-xpu
is rebuilt against a vLLM release carrying
vllm/v1/kv_offload/tiering/p2p/.

Also trims the README's Intel XPU warning now that this is the
default rather than a documented manual workaround.

Signed-off-by: Yao, Qing <qing.yao@intel.com>

* p2p-kv-cache-sharing: fix XPU review findings

- Add UCX_TLS=tcp to the XPU overlay's vLLM env, matching the
  pd-disaggregation XPU precedent, so this TCP-only overlay can't
  silently fall back to the buggy ze_copy/DMA-BUF transport.
- Stop citing guides/modelexpress-p2p's README as documenting the
  Intel XPU UCX bug: that content is still an unmerged draft
  (#2461), not on main. Reference the draft PR directly.
- Scope the '16 replicas, TP=1' summary to the GPU overlay; the XPU
  overlay is 2 replicas of a different model.
- Note that this guide's router values hard-code modelName:
  openai/gpt-oss-120b, and must be changed to Qwen/Qwen3-0.6B before
  installing the router when deploying the XPU overlay, or the render
  Service and every downstream verification command target a model
  the XPU pods never load.

All four issues were raised by automated review on the upstream PR;
verified against the actual repo state before fixing.

* p2p-kv-cache-sharing: correct UCX bug attribution for XPU overlay

Traced the actual vLLM OffloadingConnector/TieringOffloadingSpec P2P
data path: every transfer is staged through its CPU-mmap-backed
offload tier, and NIXL registers only that host memory (DRAM) with
UCX. XPU device memory is never handed to UCX/NIXL directly, unlike
guides/modelexpress-p2p's Intel XPU variant (#2461), which
does register device memory for its weight transfer and genuinely
needs UCX_TLS=tcp,ze_copy.

So for this overlay:
- UCX_TLS=tcp was already the right pin, but the comment overstated
  the risk (implying UCX could still reach device memory here).
- The claim that a missing RDMA overlay is 'blocked' by the upstream
  UCX ze_copy/DMA-BUF bug (openucx/ucx#11902, #11903) doesn't hold for
  this connector: an RDMA transport here would still only move
  CPU-to-CPU DRAM, not touch XPU VRAM directly. It just hasn't been
  built/validated yet, for unrelated reasons.
- 'TCP-only side channel' conflated the P2P tier's ZMQ control channel
  with the NIXL/UCX data plane; described them separately.

Reworded the patch-vllm.yaml comment, kustomization.yaml comment, and
README Supported Hardware Backends section accordingly, keeping a
pointer to the real UCX bug and #2461 for readers evaluating direct
XPU-device RDMA elsewhere.

* p2p-kv-cache-sharing: tighten XPU overlay wording

Trim hedging phrasing ('simply because', 'nothing about this path
blocks it', 'anyway') from the README, kustomization.yaml, and
patch-vllm.yaml so the Intel XPU transport description reads as a
final statement of fact rather than a running commentary.

---------

Signed-off-by: Yao, Qing <qing.yao@intel.com>
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread src/ucp/proto/proto_init.c Resolved
Comment thread src/ucp/proto/proto_init.c Resolved
Comment thread test/gtest/ucp/test_ucp_proto.cc Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage gap: test_ucp_proto_ze needs real ZE hardware, and I did not find a gtest job with ZE (or ROCm) memory in buildlib/azure-pipelines*.yml, so this test will always skip in the PR pipeline; the protocol-selection change for rocm-managed/ze-* is not exercised by CI as it stands. The mock framework (test_ucp_proto_mock.cc) cannot fake memory types, so a HW-free equivalent is not readily available.

Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
Eager bcopy protocols set a SHORT memtype operation, but pack through
ucp_dt_contig_pack(), which uses memcpy for CPU-accessible memory and reaches
the memtype endpoint only for non-CPU-accessible memory. Estimating those
copies with the copy interface bandwidth priced eager out of small messages,
so rendezvous was selected from the first byte. Keep ZCOPY operations on the
copy interface estimation, since rendezvous mtype protocols perform a real
memtype endpoint copy.

Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

@yafshar yafshar changed the title UCP/PROTO: Keep direct-access protocols eligible for CPU-accessible memory UCP/PROTO: Fix buffer copy estimation for CPU-accessible memory Sep 23, 2026
Comment thread test/gtest/ucp/test_ucp_proto.cc Resolved
Comment thread src/ucp/proto/proto_init.c Resolved
@svc-ucx

svc-ucx commented Sep 23, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (AddressSanitizer new on worker 1) · commit 96cc0c06

TL;DR: The ASan gtest run failed on exactly one test — shm_ib/test_ucp_am_nbx_seg_size.multi/1 <shm,ib/proto_v1> — which sat for 201.7 s waiting for a multi-fragment eager AM that never completed reassembly, then failed on the receive-counter check; since that variant runs with PROTO_ENABLE=n it cannot be caused by PR #11902's proto-v2 change, so treat it as a hang in the AM long-message reassembly path (re-run the job, don't raise the timeout).

Full analysis

Summary: make test in the "AddressSanitizer new on worker 1" job exited 1 because 1 of 8589 gtests failed: shm_ib/test_ucp_am_nbx_seg_size.multi/1, which took 201772 ms (vs ~1.1 s for the equivalent rcx/...multi/1).

Root cause: A receive hang, not a slow test. test_ucp_am_nbx_seg_size.multi sends seg_size()*2 bytes (so the message is split into a first + middle eager fragment) from a freshly created entity whose IB/MM/SCOPY/TCP_SEG_SIZE differs from the receiver's, and then blocks in wait_receives() → wait_for_value(&m_recv_counter, m_send_counter) (test/gtest/ucp/test_ucp_am.cc:390-393, 509-543). The ~202 s duration is exactly the ASan-scaled wait_for_value deadline, after which EXPECT_EQ(m_recv_counter, m_send_counter) failed — i.e. the AM callback was never invoked because the receiver never considered the message fully assembled in ucp_am_handle_unfinished(): ucs_interval_tree_is_equal_range(frag_tree, {payload_offset, payload_offset + total_size - 1}) never became true ("not all fragments arrived yet" → return), so a fragment was lost/dropped or the fragment interval bookkeeping never coalesced to a single range. All neighbouring tests (including rcx/test_ucp_am_nbx_seg_size.single|multi/1 and the shm,ib AM DTS tests) passed, and no crash/ASan report is present — consistent with a dropped fragment / reassembly-completion bug rather than memory corruption.

Notably this is the proto_v1 variant (test_ucp_am_base sets PROTO_ENABLE=n for variant value 1, test/gtest/ucp/test_ucp_am.cc:41-54), while PR #11902 ("Fix buffer copy estimation for CPU-accessible memory") only affects proto-v2 protocol selection — so the branch under test is very unlikely to be the trigger.

Implicated commit: unknown (not PR #11902). Most recent changes touching the implicated reassembly machinery: 0385f633 "UCS/DATASTRUCT: Extract red-black tree core from interval tree (#11944)" — tomerg-nvidia, 2026-09-18, five days before this build, and the interval tree is what gates AM fragment completion; earlier suspects 2bafbb02 (Evgeny Leksikov, resend flag / partial-message eviction) and bcc7d08f (zero-length interval insert protection).

File: src/ucp/core/ucp_am.c:1440-1477 (ucp_am_handle_unfinished, completion check) and src/ucp/core/ucp_am.c:1413-1424 (ucp_am_copy_data_fragment); test: test/gtest/ucp/test_ucp_am.cc:1710.

Suggested fix: Do not change the time limit and do not modify PR #11902 — re-run the ASan job to confirm the test is flaky on the target branch as well (ideally also run the test standalone: GTEST_FILTER='shm_ib/test_ucp_am_nbx_seg_size.multi/1' UCX_LOG_LEVEL=debug ./gtest --gtest_repeat=50 with a fixed GTEST_RANDOM_SEED to catch the dropped fragment). For the product code, two concrete hardening items in the reassembly path: (1) in ucp_am_handle_unfinished, the loop over ep_ext->am.started_ams returns on the first incomplete message instead of continue-ing, so a completed message behind an incomplete one is never delivered (head-of-line stall) — change to continue; (2) ucp_am_copy_data_fragment inserts {offset, offset + length - 1} with no zero-length guard, which underflows the range for a 0-byte fragment (the protection added in #11179 is no longer present) — skip the insert when length == 0. Adding a debug print of the frag-tree node count/range when the assembly deadline expires would make this failure self-diagnosing next time.

Related: PR #11902 (branch under test), #11944 (interval tree → rbtree extraction), #11452 (AM resend flag / partial message eviction), #11179 (zero-length interval tree insert protection).

Replace ucp_proto_buffer_copy_is_memcpy() with a condition derived from the
factor selected by ucp_proto_buffer_copy_factor_id(), so the operation
classification lives in a single place rather than being duplicated. The
derived condition preserves host/host ZCOPY as memcpy while keeping non-host
ZCOPY on the memtype copy factor. Preserve the UCT_EP_OP_LAST assertion.

The CPU-accessible protocol selection checks only build a select_param and
never allocate a payload buffer, so drop the hardware support and copy
transport gates and run them over plain rc. This covers ze-host, ze-managed,
and rocm-managed without GPU hardware. Keep the ze-device negative path in
a separate fixture because it requires the copy transport.

Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread src/ucp/proto/proto_init.c Resolved
@svc-ucx

svc-ucx commented Sep 28, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Tests roce on worker 2) · commit 3e19741e

TL;DR: ucx_perftest hung for ~89 minutes on the very first case (ucp_contig_tag_lat/16384, UCX_TLS=rc_verbs,rc_x, mlx5_1:1) until the Azure agent was recycled; the PR's new memcpy short-circuit in ucp_proto_init_add_buffer_copy_time() bypasses the worker->mem_type_ep[]/UCT_EP_OP_LAST "unsupported" checks for host↔host copies, so memtype-copy (rndv mtype/ppln) protocols become eligible for host memory and stall at runtime. Restrict the short-circuit to blocking CPU copies (PUT_SHORT/GET_SHORT/UCT_EP_OP_LAST) instead of all host↔host cases.

Full analysis

Summary: "Tests roce on worker 2" (Azure build 137315) was killed by agent shutdown after ucx_perftest hung indefinitely in the first UCP tag-latency test on mlx5_1:1.

Root cause: This is a hang, not a slow test. The last application output is at 18:24:27.348 (the two UCX_TCP_PORT_RANGE unused-env warnings, immediately after the +ucp_contig_tag_lat/16384 banner); the next line is at 19:53:43 — an 89-minute silence covering essentially the whole runtime. At kill time the orphan-process cleanup still lists mpirun (915911) and both ucx_perftest ranks (915925, 915926), so the processes were alive and wedged; zero iterations were ever reported for the 16 KB tag-latency case (i.e. the rendezvous path with rc_verbs,rc_x).

The branch under test rewrites protocol-cost estimation. In src/ucp/proto/proto_init.c:341-350 a new early return was added:

  • ucp_proto_buffer_copy_factor_id() (line 283-291) already maps any host↔host copy to the CPU factor, including memtype_op == UCT_EP_OP_GET_ZCOPY/PUT_ZCOPY (the async rndv-mtype staging copies).
  • The new block therefore fires for those protocols too, returning an optimistic 1/bcopy_bw memcpy estimate and UCS_OK.
  • That skips the two guards below it that previously disabled exactly these protocols for host memory: the worker->mem_type_ep[local/remote] availability check (lines 352-361, added by [REDACTED:Hex High Entropy String] "Disable protocols that need memory type copy") and case UCT_EP_OP_LAST: return UCS_ERR_UNSUPPORTED (line 377-378).

Result: memtype-copy/pipeline rendezvous protocols are now advertised as very cheap for plain host buffers even though worker->mem_type_ep[UCS_MEMORY_TYPE_HOST] is NULL, get selected for the 16 KB rendezvous message, and then never complete — the observed hang.

Implicated commit: 96cc0c06 "UCP/PROTO: Cost CPU-accessible SHORT copies as memcpy" (Yaser Afshar), refined by c816c26d and 501ee9e7; branch head 3e19741e. Related enabling change: 71fac44b "Keep direct access protocols eligible for CPU-accessible memory".

File: src/ucp/proto/proto_init.c:337-350 (early memcpy return), with src/ucp/proto/proto_init.c:278-309 (ucp_proto_buffer_copy_factor_id) as the contributing classifier.

Suggested fix: Gate the memcpy short-circuit on the copy actually being a CPU copy, not merely on the memory being CPU-accessible — e.g. only take it when memtype_op is UCT_EP_OP_PUT_SHORT, UCT_EP_OP_GET_SHORT, or UCT_EP_OP_LAST, and let UCT_EP_OP_{PUT,GET}_ZCOPY fall through to the existing worker->mem_type_ep[] lookup so it still returns UCS_ERR_UNSUPPORTED when no memtype endpoint exists:

if ((memtype_op == UCT_EP_OP_PUT_SHORT) || (memtype_op == UCT_EP_OP_GET_SHORT) ||
    (memtype_op == UCT_EP_OP_LAST)) {
    if ((buffer_copy_factor_id == ucp_proto_buffer_copy_cpu_factor_id(local)) &&
        UCP_MEM_IS_ACCESSIBLE_FROM_CPU(local_mem_type) &&
        UCP_MEM_IS_ACCESSIBLE_FROM_CPU(remote_mem_type)) {
        /* memcpy estimation */
    }
}

Alternatively, keep the mem_type_ep == NULL rejection ahead of the short-circuit. To confirm before/after, re-run ucx_perftest -b test_types_short_ucp -b msg_pow2_short with UCX_NET_DEVICES=mlx5_1:1 UCX_TLS=rc_verbs,rc_x UCX_PROTO_INFO=y and diff the selected protocol for 16 KB tag send against master — the hung config should show an mtype/ppln rndv protocol that master does not select. Adding a timeout wrapper around the perftest loop in contrib/test_jenkins.sh would also turn this 90-minute agent kill into a fast, attributable failure.

Related: #11902 (the PR under test); prior art for the bypassed guard: commit [REDACTED:Hex High Entropy String] "UCP/PROTO: Disable protocols that need memory type copy".

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 4c1c6838-db9e-4cb8-870d-595d2c7e36de in the triage console for the audit trail.

…essible-memtype-eligibility

Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

@yafshar

yafshar commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Update after merging master (b03aa88): all CI checks pass, including the roce jobs that hung on build 137315.

The triage comment above attributes that hang to this PR, but those jobs used host memory only, and this PR doesn't change the host↔host path: master already returns the memcpy estimate for host↔host before the mem_type_ep check. UCX_PROTO_INFO tables for host memory are identical with and without the PR.

@tvegas1 @brminich @evgeny-leksikov, could one of you review this when you have time?

Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread src/ucp/proto/proto_init.c Resolved
UCP_INSTANTIATE_TEST_CASE_TLS(test_ucp_proto_cuda_async_non_reg, rcv,
"rc_v,cuda_copy")

class test_ucp_proto_cpu_accessible : public test_ucp_proto {

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.

maybe we can reduce the new tests to a single check against host memory?

CPU-accessible memory is packed by memcpy, so at 1 byte it has to select the same protocol as host. This catches both issues fixed here: the UCT_EP_OP_LAST assert, and SHORT copies costed through the memtype ep, which drops or prices out eager. It only runs protocol selection, so it needs no ZE/ROCm HW, and since it does not hard-code a protocol name it should not depend on the transport and can use UCP_INSTANTIATE_TEST_CASE, not only rc. (not compiled)

class test_ucp_proto_cpu_accessible : public test_ucp_proto {
};

/* CPU-accessible memory is packed by memcpy, so small messages have to select
 * the same protocol as host memory */
UCS_TEST_P(test_ucp_proto_cpu_accessible, same_proto_as_host)
{
    const ucp_proto_threshold_elem_t *thresh;
    const char *host_proto_name;
    unsigned mem_type;

    thresh = select_tag_send_protocol(UCS_MEMORY_TYPE_HOST, 1);
    ASSERT_NE(nullptr, thresh);
    host_proto_name = thresh->proto_config.proto->name;

    ucs_for_each_bit(mem_type, UCS_MEMORY_TYPES_CPU_ACCESSIBLE &
                               ~UCS_BIT(UCS_MEMORY_TYPE_HOST)) {
        thresh = select_tag_send_protocol(
                static_cast<ucs_memory_type_t>(mem_type), 1);
        ASSERT_NE(nullptr, thresh);
        EXPECT_STREQ(host_proto_name, thresh->proto_config.proto->name)
                << ucs_memory_type_names[mem_type];
    }
}

UCP_INSTANTIATE_TEST_CASE(test_ucp_proto_cpu_accessible)

With this, pls remove:

  • the current test_ucp_proto_cpu_accessible fixture: the get_test_variants() override, cpu_accessible_mem_types(), check_direct_proto_eligible(), check_eager_proto_selected()
  • the direct_proto_eligible and eager_costed_as_memcpy tests and the rc instantiation

Also maybe drop the test_ucp_proto_ze_device fixture, the device_memory_not_costed_as_memcpy test and the rc_ze instantiation? It is meaningful only with real ZE HW: without ze_copy there is no memtype ep, so eager is rejected even without the fix. It also adds a helper only for itself. If it goes, pls also remove:

  • require_rndv_reg_lane() in test_ucp_proto
  • #include <ucp/core/ucp_ep.inl>, only needed by require_rndv_reg_lane()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, with one change.

Comparing with the host protocol name fails on tcp: there a one-byte send from host memory selects egr/single/zcopy, while ze-host, ze-managed and rocm-managed select egr/short, because tcp zero-copy accesses only host memory. Both choices are right, so the test now checks that a one-byte send selects an eager protocol (small_msg_eager).

It passes on the nine UCP_INSTANTIATE_TEST_CASE instantiations available on an Intel B70 node and on an NVIDIA H200 node (srd and ugni are not). With master's proto_init.c it hits the UCT_EP_OP_LAST assertion; with the LAST handling but without the memcpy condition, every transport selects reconfig.

Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
Co-authored-by: Thomas Vegas <125344591+tvegas1@users.noreply.github.com>
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread test/gtest/ucp/test_ucp_proto.cc Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage gap: the change also widens the memcpy model for UCT_EP_OP_GET_SHORT/UCT_EP_OP_PUT_SHORT with CPU-accessible non-host memory (e.g. egr/single/bcopy, egr/multi/bcopy, get/am, put/am, amo*/mtype), switching those from the memtype-ep estimate to bcopy_bw. The new test only exercises 1-byte sends, where egr/short (memtype_op == UCT_EP_OP_LAST) wins, so the *_SHORT half of the model change is not asserted anywhere. It is also only observable on real ROCm/ZE hardware, which I could not confirm is covered by any gtest job; a mock-based check via has_protocol_candidate()/expect_protocol_candidates() in test_ucp_proto_mock.cc would close this without hardware, but I would not block the PR on it.

@yafshar

yafshar commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Residual coverage gap: the change also widens the memcpy model for UCT_EP_OP_GET_SHORT/UCT_EP_OP_PUT_SHORT with CPU-accessible non-host memory

Agreed that the SHORT costing is only covered indirectly: without the CPU-accessible memcpy condition every transport selects reconfig at one byte, but no test asserts a SHORT-costed protocol in its own size range. Like the GET/PUT_ZCOPY gap in the description, a direct check would need a mocked memtype endpoint; I'd leave it out of this PR.

@svc-ucx

svc-ucx commented Oct 29, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Coverity coverity devel on coverity_rh7) · commit f2fd86fe

TL;DR: The Coverity stage failed with exactly 1 new defect — an OVERRUN (out-of-bounds read) on ucs_memory_type_names[mem_type] in the new test_ucp_proto_cpu_accessible.small_msg_eager gtest, because ucs_for_each_bit lets Coverity assume mem_type can reach 63 while the names array has only 12 entries; make the loop bound explicit (mem_type < UCS_MEMORY_TYPE_LAST) to silence it.

Full analysis

Summary: Azure job "Coverity coverity devel on coverity_rh7" failed at ##[error]Coverity found 1 issues: — /test/gtest/ucp/test_ucp_proto.cc:1147 Type: Out-of-bounds read (OVERRUN). The build and cov-analyze ran to completion (14m29s, continuous progress, no hang); the gate failed only on the defect count.

Root cause: In the new test added by this PR:

unsigned mem_type;
ucs_for_each_bit(mem_type, UCS_MEMORY_TYPES_CPU_ACCESSIBLE &
                           ~UCS_BIT(UCS_MEMORY_TYPE_HOST)) {
    ...
    EXPECT_EQ(0, strncmp("egr/", thresh->proto_config.proto->name, 4))
            << ucs_memory_type_names[mem_type] << ": " ...

ucs_for_each_bit expands to a loop whose only bound is mem_type < 64 (Coverity trace step 11/12: "Checking mem_type < 64U implies that mem_type may be up to 63"). Coverity does not propagate the fact that the iterated mask is the compile-time constant 336 (bits 4, 6, 8 only), so on the EXPECT-failure path it concludes ucs_memory_type_names[63] is read — step 18: "Overrunning array of 12 8-byte elements at element index 63 (byte offset 511)". ucs_memory_type_names[] has UCS_MEMORY_TYPE_LAST (12) entries, so the index is only provably safe to the human reader, not to the checker. It is a false positive in practice, but the Coverity job gates on nerrors > 0, so it fails CI.

Implicated commit: [REDACTED:Hex High Entropy String] — Yaser Afshar, "UCP/PROTO: Address review comments on CPU-accessible memcpy estimation" (the test_ucp_proto_cpu_accessible test class/loop is introduced by this PR branch)

File: test/gtest/ucp/test_ucp_proto.cc:1142-1149 (defect reported at :1147, the array read is on :1148)

Suggested fix: Give Coverity an explicit upper bound on the index. Replace the ucs_for_each_bit loop with a bounded iteration:

const uint64_t mem_types = UCS_MEMORY_TYPES_CPU_ACCESSIBLE &
                           ~UCS_BIT(UCS_MEMORY_TYPE_HOST);

for (unsigned mem_type = 0; mem_type < UCS_MEMORY_TYPE_LAST; ++mem_type) {
    if (!(mem_types & UCS_BIT(mem_type))) {
        continue;
    }

    thresh = select_tag_send_protocol(
            static_cast<ucs_memory_type_t>(mem_type), 1);
    ASSERT_NE(nullptr, thresh);
    EXPECT_EQ(0, strncmp("egr/", thresh->proto_config.proto->name, 4))
            << ucs_memory_type_names[mem_type] << ": "
            << thresh->proto_config.proto->name;
}

The mem_type < UCS_MEMORY_TYPE_LAST condition makes the index provably in range and clears the OVERRUN. (A minimal alternative is ASSERT_LT(mem_type, UCS_MEMORY_TYPE_LAST); as the first statement in the existing loop body, but the bounded for is more robust than relying on Coverity modelling the gtest fatal-assert return.) Keep ucs_memory_type_names indexing as-is otherwise; no product-code change is needed.

Related: PR #11902 (fix/proto-cpu-accessible-memtype-eligibility); no pre-existing issue found for this Coverity signature.

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 9994f182-7ab5-4d52-9e81-0496f20e2358 in the triage console for the audit trail.

Signed-off-by: Yaser Afshar <yaser.afshar@intel.com>
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread test/gtest/ucp/test_ucp_proto.cc Resolved
Comment thread test/gtest/ucp/test_ucp_proto.cc Resolved
@yafshar

yafshar commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 92f1e81: the loop now uses ucs_memory_type_for_each with a mask check, so the index is bounded by UCS_MEMORY_TYPE_LAST. Same memory types tested; the Coverity job passes.

@svc-ucx

svc-ucx commented Oct 29, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (AddressSanitizer roce on worker 1) · commit 92f1e810

TL;DR: The ASAN gtest shard didn't fail a test — it hung: rc/test_ucp_sockaddr_wireup_fail_try_next_cm.connect_and_fail_wireup_next_cm_rdmacm2tcp_set_ep_failed_on_client/3 <rc_v/tag,sa_data_v1,mt> threw UCS_TEST_SKIP while its client EP was CM-connected but not wired up, and teardown's worker-flush/EP-close never completed, so entity::close_all_eps() busy-spun (no deadline on its inner loop) until the 900 s gtest watchdog SIGTERM'd the process. Bound that inner loop with the existing deadline and force-close the EP before skipping in that test.

Full analysis

Summary: make -C test/gtest test (shard 2/4, AddressSanitizer, roce worker 1) aborted with signal 6 after a 900-second hang in the teardown of one UCP sockaddr CM wireup-failure test; make: *** [Makefile:4971: test] Aborted (core dumped).

Root cause: Timestamp analysis shows a hang, not slowness. Last meaningful line is at 20:49:22.768 — [ SKIP ] (trying the next CM callback wasn't scheduled) — then 676 s of total silence until 21:00:39.418. That gap is the whole remaining runtime, so the process was stuck:

  1. The skip is thrown from test_ucp_sockaddr_wireup_fail_try_next_cm::test_all_ep_flags() (test_ucp_sockaddr.cc:1767), which is called from inside connect_and_fail_wireup()'s wait loop — i.e. after client_ep_connect() and, because this variant passes wait_cm_failure=true, without wait_for_server_ep(). The exception escapes leaving a client EP that is CM-connected but with wireup/server EP not established, and no forced close.
  2. Teardown runs ucp_test::cleanup() → disconnect() → flush_worker() → request_wait(). ucs::get_deadline() under ASAN = min(900*0.75, 180*20) = 675 s (test_helpers.cc:342), which matches the 676 s gap exactly, ending in ucp_test.cc:300 UCX ERROR request 0x62e000022420 did not complete on time. The worker flush never completed.
  3. Then entity::close_all_eps() runs. Its inner loop has no timeout:
    while (!is_request_completed(req)) { test.progress(worker_idx); } (ucp_test.cc:926). With a close request that never completes this spins forever in ucp_test::progress() → sched_yield() (ucp_test.cc:173) — exactly the reported backtrace (frame 5 __sched_yield, frames 6-9 in the gtest binary).
  4. At 21:04:22.772 = skip time + exactly 900 s, the watchdog (watchdog_timeout = 900., test_helpers.cc:31) fired: ADD_FAILURE() << strerror(ETIMEDOUT) << " - abort testing" at test_helpers.cc:57 → Connection timed out - abort testing → pthread_kill(SIGTERM) → signal 6 / core dump.

So the "Failure / Connection timed out" and signal 6 are symptoms; the root cause is the never-completing graceful ucp_worker_flush / ucp_ep_close on a partially-wired-up CM endpoint, amplified into a 900 s shard-killing hang by the unbounded busy-wait in the test harness. Nothing in the log ties this to PR #11902 (proto buffer-copy estimation for CPU-accessible memory): this test transfers no data and never reaches protocol selection, so it is most likely a pre-existing flaky hang rather than a regression from the commit.

Implicated commit: unknown — no commit in the log or in recent history of the implicated files corresponds to this hang; 92f1e81 (PR #11902) does not touch the CM wireup/flush/close path exercised here.

File: test/gtest/ucp/ucp_test.cc:923-935 (unbounded inner loop in close_all_eps, line 926) and test/gtest/ucp/test_ucp_sockaddr.cc:1766-1768 (skip thrown mid-wireup)

Suggested fix:

  1. Bound the inner wait in ucp_test_base::entity::close_all_eps() with the already-computed deadline, e.g. while (!is_request_completed(req) && (ucs_get_time() < deadline)) { test.progress(worker_idx); }, and ADD_FAILURE() if it expires. This converts a stuck close into a fast, attributable test failure instead of a 900 s watchdog SIGTERM that destroys the whole 4-way shard.
  2. In test_ucp_sockaddr_wireup_fail_try_next_cm::test_all_ep_flags(), force-close the client EP (one_sided_disconnect(e, UCP_EP_CLOSE_FLAG_FORCE)) before UCS_TEST_SKIP_R("trying the next CM callback wasn't scheduled"), or evaluate the skip condition before client_ep_connect(), so teardown never attempts a graceful flush/close of a half-wired-up CM endpoint.
  3. Re-run the job to confirm this is flaky rather than a regression; if it reproduces on this branch only, investigate why ucp_worker_flush_nb does not complete for a CM-connected EP whose wireup never finished.

Related: PR #11902 (the PR under test, "UCP/PROTO: Fix buffer copy estimation for CPU-accessible memory"); no existing issue found for this test hanging — worth opening one for the unbounded close_all_eps wait.

@tvegas1
tvegas1 enabled auto-merge (squash) October 30, 2026 08:44
@tvegas1
tvegas1 merged commit 4d40898 into openucx:master Oct 30, 2026
167 checks passed
@yafshar
yafshar deleted the fix/proto-cpu-accessible-memtype-eligibility branch October 30, 2026 15:14
william-gallagher-nv pushed a commit to william-gallagher-nv/ucx that referenced this pull request Nov 2, 2026
keendev3 added a commit to keendev3/CNCF-LLM that referenced this pull request Nov 9, 2026
* feat(p2p-kv-cache-sharing): add Intel XPU (TCP-only) variant

Add modelserver/xpu/vllm/base/ mirroring the GPU OffloadingConnector
P2P-tier setup, adapted for Intel XPU:

- DRA ResourceClaimTemplate (gpu.intel.com), 1 XPU per pod, matching
  the pattern used by precise-prefix-cache-routing and
  tiered-prefix-cache's Intel XPU overlays, instead of the GPU
  overlay's nvidia.com/gpu device-plugin request.
- CI-sized functional check: 2 replicas (1 source + 1 receiver) of
  Qwen/Qwen3-0.6B instead of the GPU overlay's 16x gpt-oss-120b -
  validates the same P2P pull mechanism without requiring 24GB+ of
  device memory per pod or reproducing the GPU benchmark's scale.
  cpu_bytes_to_use and the shm tier are sized down to match.
- Same routing-sidecar (patch-sidecar.yaml) and P2P/kv-events port
  layout as the GPU overlay - both are accelerator-agnostic.

No RDMA overlay (xpu/vllm/rdma) is added. Direct RDMA over Intel XPU
device memory currently hits an upstream UCX ze_copy/DMA-BUF
data-correctness bug (silently wrong bytes, reported success) that
guides/modelexpress-p2p's Intel XPU PR (#2461) already ran into and
documented; tracked at openucx/ucx#11902 and #11903. The TCP-only
side channel here does not depend on that fix and is safe to ship now.

README changes:
- Supported Hardware Backends: document the Intel XPU variant, its
  scope (functional check, not a benchmark), and why RDMA is deferred.
- Step 3 (Deploy the Model Server): ACCELERATOR_TYPE now documents
  xpu, and TRANSPORT=base is called out as the only option for xpu.

Verified guides/p2p-kv-cache-sharing/modelserver/xpu/vllm/base renders
cleanly with 'kubectl kustomize' (ServiceAccount, Deployment with
sidecar + engine container merged correctly, port 8000->8200 renamed,
ResourceClaimTemplate name-referenced correctly). Not yet deployed to
a live cluster.

* p2p-kv-cache-sharing: document XPU cluster verification results

Tested the xpu/vllm/base overlay on XPU-8xB60-817225 (real Intel Arc Pro
B60 hardware). DRA allocation, sidecar init, and vLLM boot with
OffloadingConnector + NIXL/UCX + P2P secondary tier all verified working.

However, the P2P pull itself is not yet verified: the pinned XPU image
(llm-d-xpu:v0.9.0, vLLM 0.26.0) has no remote_kv_source handling in its
OffloadingConnector (only max_offload_tokens), unlike the GPU overlay's
vllm-openai:v0.27.1. Documented this version-gap limitation in the guide
README.

* p2p-kv-cache-sharing: confirm XPU P2P pull works with nightly vLLM image

Manual pull test on real Intel Arc Pro B60 hardware (XPU-8xB60-817225)
confirms the P2P pull mechanism itself works correctly once the pinned
vLLM version carries vllm/v1/kv_offload/tiering/p2p/. Swapping the test
deployment's image from ghcr.io/llm-d/llm-d-xpu:v0.9.0 (vLLM 0.26.0, no
remote_kv_source support) to docker.io/vllm/vllm-openai-xpu:nightly
(vLLM 0.29.1rc1) made a 4096-token prefix pull succeed end-to-end
(external_prefix_cache_hits_total incremented by exactly 4096,
reproduced twice).

Updates the README's Intel XPU warning to reflect this: the gap is
purely the pinned image's vLLM version, not the manifests or the pull
mechanism, with a workaround (temporarily point the xpu-vllm component
at nightly) documented until ghcr.io/llm-d/llm-d-xpu is rebuilt against
a newer vLLM release.

* p2p-kv-cache-sharing: default XPU overlay to nightly xpu-vllm image

ghcr.io/llm-d/llm-d-xpu:v0.9.0 (vLLM 0.26.0) has no remote_kv_source
handling in its OffloadingConnector, so the P2P pull this guide exists
to demonstrate cannot work on it. Point the overlay at the existing
xpu-vllm/nightly component (vLLM main) instead, which was verified
end-to-end on real Intel Arc Pro B60 hardware, rather than shipping an
overlay that starts cleanly but can't do the one thing the guide is
about. Switch back to the llm-d component once ghcr.io/llm-d/llm-d-xpu
is rebuilt against a vLLM release carrying
vllm/v1/kv_offload/tiering/p2p/.

Also trims the README's Intel XPU warning now that this is the
default rather than a documented manual workaround.

Signed-off-by: Yao, Qing <qing.yao@intel.com>

* p2p-kv-cache-sharing: fix XPU review findings

- Add UCX_TLS=tcp to the XPU overlay's vLLM env, matching the
  pd-disaggregation XPU precedent, so this TCP-only overlay can't
  silently fall back to the buggy ze_copy/DMA-BUF transport.
- Stop citing guides/modelexpress-p2p's README as documenting the
  Intel XPU UCX bug: that content is still an unmerged draft
  (llm-d/llm-d#2461), not on main. Reference the draft PR directly.
- Scope the '16 replicas, TP=1' summary to the GPU overlay; the XPU
  overlay is 2 replicas of a different model.
- Note that this guide's router values hard-code modelName:
  openai/gpt-oss-120b, and must be changed to Qwen/Qwen3-0.6B before
  installing the router when deploying the XPU overlay, or the render
  Service and every downstream verification command target a model
  the XPU pods never load.

All four issues were raised by automated review on the upstream PR;
verified against the actual repo state before fixing.

* p2p-kv-cache-sharing: correct UCX bug attribution for XPU overlay

Traced the actual vLLM OffloadingConnector/TieringOffloadingSpec P2P
data path: every transfer is staged through its CPU-mmap-backed
offload tier, and NIXL registers only that host memory (DRAM) with
UCX. XPU device memory is never handed to UCX/NIXL directly, unlike
guides/modelexpress-p2p's Intel XPU variant (llm-d/llm-d#2461), which
does register device memory for its weight transfer and genuinely
needs UCX_TLS=tcp,ze_copy.

So for this overlay:
- UCX_TLS=tcp was already the right pin, but the comment overstated
  the risk (implying UCX could still reach device memory here).
- The claim that a missing RDMA overlay is 'blocked' by the upstream
  UCX ze_copy/DMA-BUF bug (openucx/ucx#11902, #11903) doesn't hold for
  this connector: an RDMA transport here would still only move
  CPU-to-CPU DRAM, not touch XPU VRAM directly. It just hasn't been
  built/validated yet, for unrelated reasons.
- 'TCP-only side channel' conflated the P2P tier's ZMQ control channel
  with the NIXL/UCX data plane; described them separately.

Reworded the patch-vllm.yaml comment, kustomization.yaml comment, and
README Supported Hardware Backends section accordingly, keeping a
pointer to the real UCX bug and #2461 for readers evaluating direct
XPU-device RDMA elsewhere.

* p2p-kv-cache-sharing: tighten XPU overlay wording

Trim hedging phrasing ('simply because', 'nothing about this path
blocks it', 'anyway') from the README, kustomization.yaml, and
patch-vllm.yaml so the Intel XPU transport description reads as a
final statement of fact rather than a running commentary.

---------

Signed-off-by: Yao, Qing <qing.yao@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants