Skip to content

UCT/IB: Integrate RC plugin hooks - #12162

Merged
roiedanino merged 7 commits into
openucx:masterfrom
roiedanino:feature/dlb-sgl-path-performance
Nov 13, 2026
Merged

roiedanino merged 7 commits into
openucx:masterfrom
roiedanino:feature/dlb-sgl-path-performance

Conversation

@roiedanino

@roiedanino roiedanino commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What?

Connect RC plugin providers to interface and endpoint lifecycle hooks, cached bandwidth queries, and endpoint events using the merged extension APIs.

Why?

Allow a provider to monitor existing RC paths without creating additional transport resources or exchanging provider-specific addresses.

How?

Reuse the existing RC QPs and CQs. Notify queued progress through the existing interface async callback and cancel marked internal operations during purge. Include the generic UCP progress-notification consumer so the integration is usable independently.

Endpoint bandwidth handling and reconfiguration are stacked separately in roiedanino#15.

@roiedanino roiedanino added the WIP-DNM Work in progress / Do not review label Oct 26, 2026
@svc-nvidia-pr-review

Copy link
Copy Markdown

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

@svc-ucx

svc-ucx commented Oct 26, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Build build_x86_64 ctyunos2507) · commit 595da0ac

TL;DR: The build_docs step of the x86_64 build failed because the new UCT_IFACE_FLAG_EP_QUERY_BW doc comment in src/uct/api/uct.h:442 contains @ref uct_ep_query, a symbol that lives in src/uct/api/v2/uct_v2.h which doxygen does not parse — with warnings-as-errors this aborts the docs build. Replace the @ref with plain text (uct_ep_query()), or add uct_v2.h to the doxygen INPUT/FILE_PATTERNS.

Full analysis

Summary: make V=1 docs (build_docs, first of the 8 build tests) aborted: src/uct/api/uct.h:442: error: unable to resolve reference to 'uct_ep_query' for \ref command (warning treated as error, aborting now) → make: *** [Makefile:1338: docs/doxygen-doc/ucx.tag] Error 1 → Bash exited with code '2'.

Root cause: This PR added a new capability flag with a doxygen cross-reference:
#define UCT_IFACE_FLAG_EP_QUERY_BW UCS_BIT(57) /**< @ref uct_ep_query can report endpoint bandwidth */ (uct.h:442).
uct_ep_query / struct uct_ep_attr are declared in src/uct/api/v2/uct_v2.h (see uct_v2.h:406-440, where the PR also added the new bandwidth field). Doxygen's config (docs/doxygen/ucxdox) has INPUT = .../src/uct/api/ with RECURSIVE = NO and FILE_PATTERNS limited to uct.h/uct_def.h (confirmed by the log: only uct.h and uct_def.h were parsed from src/uct/api). So uct_v2.h is never documented, the \ref target cannot be resolved, and because the docs build runs with warnings treated as errors (WARNINGS = YES plus WARN_AS_ERROR in the doxygen invocation), the warning kills the build. This is purely a documentation-reference bug, not a compile or runtime problem.

Implicated commit: 7327bccf — "UCT: Add endpoint path performance notifications and timestamps", Roie Danino (the only recent commit touching src/uct/api/uct.h, dated 2026-10-26, same day as the build)

File: src/uct/api/uct.h:442 (related: src/uct/api/v2/uct_v2.h:406-440, docs/doxygen/ucxdox:765-810)

Suggested fix: Drop the unresolvable link in the macro comment, e.g.:

#define UCT_IFACE_FLAG_EP_QUERY_BW     UCS_BIT(57) /**< uct_ep_query() can report
                                                        endpoint bandwidth */

(Any other new @ref added by this PR that points into uct_v2.h from uct.h/ucp.h must be de-linked too.) Alternatively, if a real link is wanted, add uct_v2.h to FILE_PATTERNS and $(SRCDIR)/src/uct/api/v2/ to INPUT in docs/doxygen/ucxdox — but that will surface additional undocumented-symbol warnings in that header and is a larger change. Reproduce locally with ./contrib/configure-release --with-docs-only && make docs.

Related: PR #12162 (this change); #7020 (original PR that introduced uct_ep_query in the v2 API); #11849 (previous UCT/API doc-clarification change)

Comment thread src/uct/ib/mlx5/ib_mlx5.c Outdated
uct_ib_mlx5_cq_t *mlx5_cq, int preferred_cpu, size_t inl)
{
ucs_status_t status = UCS_OK;
#if !HAVE_DECL_MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE || \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

blocker: this if becomes the first statement of the function, before dev/cq_attr/dv_attr/cq are declared in the #if HAVE_DECL_MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE block below. On a system where MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE exists but IBV_WC_EX_WITH_COMPLETION_TIMESTAMP does not, this fails to build with -Werror=declaration-after-statement (added in config/m4/compiler.m4). Pls move the check after the declarations.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Outdated
/* Legacy connect has no remote length and requires symmetric providers. */
addr_length = UCS_PARAM_VALUE(
UCT_EP_CONNECT_TO_EP_PARAM_FIELD, params, ep_addr_length,
EP_ADDR_LENGTH, uct_rc_mlx5_iface_get_ep_address_len(iface));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

blocker: the old default (sizeof(uct_rc_mlx5_ep_address_t)) was deliberately the minimal address, because the v1 uct_ep_connect_to_ep() path (uct_base_ep_connect_to_ep, field_mask = 0) has no remote length. Using the local length means that when the local iface has flush_rkey enabled and the peer packed only uct_rc_mlx5_ep_address_t, we now read ext_addr->flags past the end of the remote address buffer. Can we keep the minimal default for the legacy path?

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_iface.c Outdated

return count + uct_rc_mlx5_iface_poll_tx(iface, flags);
if (uct_rc_iface_poll_tx(&iface->super, count)) {
count += uct_rc_mlx5_iface_poll_tx_with_info(iface, flags);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the TX CQ is created with completion timestamps only when requirements & UCT_RC_MLX5_EXT_REQ_TX_CQE_TIMESTAMP, but this uses poll_tx_with_info for any non-NULL ext_ops. For a provider without that requirement cqe->timestamp is not a timestamp and gets reported as a valid one. Pls gate on the requirement bit.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Outdated
return status;
}

context = ucs_malloc(sizeof(*context) +

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

docs/OptimizationStyle.md requires no malloc/free even for large-message flows — pls allocate the checkpoint context from a memory pool (e.g. alongside iface->tx.send_op_mp) instead of per operation.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5.h Outdated
*/
typedef struct uct_rc_mlx5_base_ep {
uct_rc_ep_t super;
void *ext_ctx;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

docs/OptimizationStyle.md: "avoid at all costs of enlarging the endpoint structure". This adds 8 bytes to every RC/DC mlx5 ep even when no provider is registered, and inserting it before tx shifts tx.wq in the hot path. Can the provider keep its per-ep state in its own table keyed by QP number?

}
}

if (ep_attr->field_mask & UCT_EP_ATTR_FIELD_BANDWIDTH) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: tx_token was already written when this returns UCS_ERR_UNSUPPORTED; docs/CodeStyle.md says to set output parameters only after success. Pls validate the requested fields before filling any of them.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Outdated

err_destroy_tm_qp:
uct_ib_mlx5_destroy_qp(md, &self->tm_qp);
if (UCT_RC_MLX5_TM_ENABLED(iface)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: why is this condition needed? The label is only reachable after tm_qp was created, i.e. with TM enabled.

Comment thread src/ucp/wireup/select.c Outdated
[ucs_ilog2(UCT_IFACE_FLAG_EVENT_RECV)] = "tag or active message event",
[ucs_ilog2(UCT_IFACE_FLAG_EVENT_RECV_SIG)] = "signaled message event"
[ucs_ilog2(UCT_IFACE_FLAG_EVENT_RECV_SIG)] = "signaled message event",
[ucs_ilog2(UCT_IFACE_FLAG_EVENT_ASYNC_CB)] = "async callback event",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: adding index 4 and 5 leaves index 3 (UCT_IFACE_FLAG_EVENT_FD) as a NULL hole, which ucp_wireup_get_missing_flag_desc() would pass straight to %s. Pls add the event fd name too.

Comment thread test/gtest/uct/ib/test_rc.cc Outdated
}
};

UCS_TEST_F(test_rc_extension, registration)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

uct_rc_mlx5_ext_register() mutates process-global state and there is no cleanup()/teardown, so if any ASSERT_* fires mid-test the provider stays registered and leaks into every later rc_mlx5 test (changing CQ creation and ep init). Pls unregister from a teardown, e.g. with a scoped guard.

Comment thread test/gtest/uct/ib/test_rc.cc Outdated
}
#endif

class test_rc_sgl_api : public ucs::test {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the new tests only cover parameter validation. The risky part of this PR is the checkpoint data path — multiple signaled WQEs per SGL post, sig_pi/CQ-credit accounting, uct_rc_mlx5_ep_is_sgl_checkpoint_wqe() during outstanding purge, and the with_info op path in uct_rc_txqp_purge_outstanding(). Pls add a test that actually posts uct_ep_put_sgl_zcopy_v2() with checkpoints and verifies the per-element callbacks (including the cancel/purge case).

@svc-nvidia-pr-review

Copy link
Copy Markdown

blocker: this is ~1100 added lines and bundles at least six independent changes: endpoint-aware UCT async events + UCT_EVENT_PATH_SPEED_CHANGE, uct_ep_query bandwidth, the SGL zcopy v2 checkpoint API + its mlx5 implementation, IB CQ completion timestamps, the rc_mlx5 external extension registry, and the rc_mlx5 ep QP cleanup refactor. REVIEW.md caps a PR at 500 added lines — pls split these into separate PRs.

Residual coverage gaps I could not verify: whether mlx5dv_create_cq() with IBV_WC_EX_WITH_COMPLETION_TIMESTAMP actually makes the raw mlx5_cqe64::timestamp field valid for UCX's direct CQ polling — needs HW validation.

IBV_WC_EX_WITH_COMPLETION_TIMESTAMP is added to configure.m4 but no build job exercises the "declaration absent" configuration (see REVIEW.md build/CI expectations).

No secrets or credential-like content found in the diff.

Note: gh is not available in this environment, so prior PR comments/reviews could not be fetched. Per the duplicate-detection rule, these findings should not be submitted as-is until the inline/issue/review comment history is fetched and compared.

@svc-ucx

svc-ucx commented Oct 26, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Build build_aarch64 ctyunos2507_aarch64) · commit 0828a3aa

TL;DR: The build_docs step of the aarch64 build failed because doxygen (with WARN_AS_ERROR = YES) cannot resolve the new @ref uct_ep_query in src/uct/api/uct.h:442 — uct_ep_query is declared in uct_v2.h, which is not part of the doxygen INPUT set. Replace the @ref with plain text (or add uct_v2.h to the doxygen input).

Full analysis

Summary: make V=1 docs (first sub-test build_docs of the aarch64 build job) aborted with Error 1 from doxygen.

Root cause: The log shows the exact failure:

/__w/15/s/src/uct/api/uct.h:442: error: unable to resolve reference to 'uct_ep_query'
for \ref command (warning treated as error, aborting now)
make: *** [Makefile:1338: docs/doxygen-doc/ucx.tag] Error 1

src/uct/api/uct.h:442-443 (added on this branch) documents the new capability flag as:

#define UCT_IFACE_FLAG_EP_QUERY_BW UCS_BIT(57) /**< @ref uct_ep_query can report
                                                    endpoint bandwidth */

However uct_ep_query() is declared in src/uct/api/v2/uct_v2.h:1361, and docs/doxygen/ucxdox has RECURSIVE = NO with INPUT = .../src/uct/api/ and FILE_PATTERNS limited to uct.h uct_def.h — so uct_v2.h is never parsed and the symbol is unknown to doxygen. Since WARN_AS_ERROR = YES (docs/doxygen/ucxdox:2398), the unresolvable \ref is fatal. This is a deterministic, platform-independent docs failure (the aarch64/ctyunos job just happens to run build_docs first); it is not an infra or timing issue.

Implicated commit: 7327bccf — "UCT: Add endpoint path performance notifications and timestamps", Roie Danino (top commit on src/uct/api/uct.h, part of PR #12162)

File: src/uct/api/uct.h:442 (config: docs/doxygen/ucxdox:765-810, 2398)

Suggested fix: Drop the @ref on the cross-header symbol in uct.h:

#define UCT_IFACE_FLAG_EP_QUERY_BW UCS_BIT(57) /**< uct_ep_query() can report
                                                    endpoint bandwidth */

(or @a uct_ep_query). Note the surrounding v1 header already uses this plain-text style for symbols it cannot link to. If a real hyperlink is desired, instead add uct_v2.h to FILE_PATTERNS and $(SRCDIR)/src/uct/api/v2/ to INPUT in docs/doxygen/ucxdox — but that will pull the whole v2 API into the generated docs and may surface additional unresolved refs, so the one-line doc-comment change is the low-risk fix. Also double-check the other new doc text added by this commit (e.g. the UCT_IFACE_FLAG_EP_QUERY_BW reference in uct_v2.h:435 is fine since that file isn't parsed) and re-run make docs locally before pushing.

Related: PR #12162 "[WIP-DNM] UCT/IB/RC: Add existing-path bandwidth monitoring integration" (#12162)

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_iface.c Outdated
if (iface->ext_ops->event_flags &
UCT_IFACE_FLAG_EVENT_PATH_SPEED_CHANGE) {
iface_attr->cap.event_flags |= UCT_IFACE_FLAG_EVENT_ASYNC_CB |
UCT_IFACE_FLAG_EVENT_PATH_SPEED_CHANGE;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

blocker: advertising UCT_IFACE_FLAG_EVENT_ASYNC_CB here breaks UCP wakeup — ucp_worker_iface_use_event_fd() returns 0 once ASYNC_CB is set (ucp_worker.c:379), so rc_mlx5's event fd is no longer added to the epoll set, but uct_ib_iface only ever fires async_ctx->cb for UCT_EVENT_SPEED_CHANGE (ib_iface.c:1748), never for RECV/SEND_COMP, so ucp_worker_wait() can block forever. Suggested fix:

Suggested change
UCT_IFACE_FLAG_EVENT_PATH_SPEED_CHANGE;
iface_attr->cap.event_flags |=
UCT_IFACE_FLAG_EVENT_PATH_SPEED_CHANGE;

Comment thread src/uct/base/uct_iface.c Outdated
NULL);
}

void uct_iface_set_async_ep_event_params(const uct_iface_params_t *params,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nothing calls this and no transport stores or invokes async_ep_event_cb, so UCT_EVENT_PATH_SPEED_CHANGE can never actually be delivered and the new UCP handler is unreachable. Pls either wire it up in rc_mlx5 or drop it until the producer lands.

Comment thread src/uct/ib/mlx5/ib_mlx5.c Outdated
uct_ib_mlx5_cq_t *mlx5_cq, int preferred_cpu, size_t inl)
{
ucs_status_t status = UCS_OK;
#if !HAVE_DECL_MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE || \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pls move this check below the declarations; with HAVE_DECL_MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE=1 and HAVE_DECL_IBV_WC_EX_WITH_COMPLETION_TIMESTAMP=0 the if precedes uct_ib_device_t *dev = ..., which fails under -Werror=declaration-after-statement (config/m4/compiler.m4:636).

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Outdated
ep_addr_length, EP_ADDR_LENGTH,
sizeof(uct_rc_mlx5_ep_address_t));
/* Legacy connect has no remote length and requires symmetric providers. */
addr_length = UCS_PARAM_VALUE(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In uct_rc_mlx5_ep_connect_to_ep_v2: this changes the legacy uct_ep_connect_to_ep() path, which passes field_mask = 0 (uct_iface.c:1119) and therefore gets this default: previously it treated the peer address as the base struct and left flush_rkey invalid, now it parses flags/flush_rkey/ext payload from a buffer whose real length is unknown. Was that intended? If the peer packed only the base address we read past it.

Comment thread src/ucp/core/ucp_worker.c Outdated
ep_attr.field_mask = UCT_EP_ATTR_FIELD_BANDWIDTH;
status = uct_ep_query(uct_ep, &ep_attr);
if (status == UCS_OK) {
ucs_info("ep %p to %s lane[%d]: path bandwidth %.2f MiB/s",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In ucp_worker_iface_async_ep_event_cb: the handler only logs the queried bandwidth and nothing in UCP acts on it — what is the intended consumer? Also ucs_info is not one of the documented levels in docs/LoggingStyle.md; ucs_debug fits a per-event message better.

Comment thread src/uct/ib/mlx5/Makefile.am Outdated
if HAVE_TL_RC
noinst_HEADERS += \
rc/rc_mlx5.h \
rc/rc_mlx5_ext.h \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The new rc_mlx5_ext.h reads like an out-of-tree plugin ABI (struct_size/api_version negotiation, "export one marker across DSOs", a process-global registry with refcounting), but the header is noinst_HEADERS so it is never installed and the only registrant in-tree is gtest. Who is the provider? If it is meant to be loadable out-of-tree it needs to be an installed, versioned interface; otherwise this machinery has no consumer.

@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage gaps: no test exercises the UCT_EVENT_PATH_SPEED_CHANGE delivery path end to end (there is no producer), and the verbs-CQ fallback for UCT_IB_CQ_COMPLETION_TIMESTAMP on a DEVX-capable MD (rc_mlx5_common.c:1216) pairs a verbs TX CQ with a DEVX QP — I could not verify that combination without hardware.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ext.h Outdated
uct_ep_attr_t *ep_attr);

/** Optional hook after stock RC progress; NULL adds no provider call. */
unsigned (*progress)(uct_iface_h iface, void *iface_ctx);

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.

we can ignore that

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_iface.c Outdated
iface_attr->cap.flags |= UCT_IFACE_FLAG_EP_QUERY_BW;
if (iface->ext_ops->event_flags &
UCT_IFACE_FLAG_EVENT_PATH_SPEED_CHANGE) {
iface_attr->cap.event_flags |= UCT_IFACE_FLAG_EVENT_ASYNC_CB |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

blocker: advertising UCT_IFACE_FLAG_EVENT_ASYNC_CB makes ucp_worker_iface_use_event_fd() return 0, so UCP stops registering the iface event fd (ucp_worker.c:1649) and expects RECV/SEND_COMP notifications through the async callback, which rc_mlx5 never delivers — ucp_worker_wait() would never wake up. pls advertise only UCT_IFACE_FLAG_EVENT_PATH_SPEED_CHANGE (src/uct/AGENTS.md: advertised capability flags must match the operations actually wired).

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Outdated
return status;
}

context = ucs_malloc(sizeof(*context) +

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls allocate the checkpoint context from a memory pool instead of ucs_malloc/ucs_free per post — docs/OptimizationStyle.md forbids malloc/free on the data path, including large-message flows.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Outdated
/* Legacy connect has no remote length and requires symmetric providers. */
addr_length = UCS_PARAM_VALUE(
UCT_EP_CONNECT_TO_EP_PARAM_FIELD, params, ep_addr_length,
EP_ADDR_LENGTH, uct_rc_mlx5_iface_get_ep_address_len(iface));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this changes the legacy (v1) connect default from the minimal address size to the local full length, so uct_ep_connect_to_ep() now parses ext_addr->flags/flush rkey out of a peer address that may be shorter. can we keep sizeof(uct_rc_mlx5_ep_address_t) as the default and only fail when ext_ops != NULL?

Comment thread src/uct/ib/mlx5/ib_mlx5.c Outdated
ucs_status_t status = UCS_OK;
#if !HAVE_DECL_MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE || \
!HAVE_DECL_IBV_WC_EX_WITH_COMPLETION_TIMESTAMP
if (init_attr->flags & UCT_IB_CQ_COMPLETION_TIMESTAMP) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

blocker: when MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE is declared but IBV_WC_EX_WITH_COMPLETION_TIMESTAMP is not, this if precedes the dev/cq_attr declarations and fails -Werror=declaration-after-statement (config/m4/compiler.m4); pls move the check after the declarations.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5.h Outdated
*/
typedef struct uct_rc_mlx5_base_ep {
uct_rc_ep_t super;
void *ext_ctx;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ext_ctx is used only by the extension path — can we keep it in uct_rc_mlx5_ep_t, or at least after tx? Here it grows every RC/GGA endpoint and shifts the hot tx.wq offset (docs/OptimizationStyle.md: "Avoid at all costs of enlarging the endpoint structure").

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_iface.c Outdated
count = uct_rc_mlx5_iface_common_poll_rx(iface, flags);
if (!uct_rc_iface_poll_tx(&iface->super, count)) {
return count;
if (ucs_likely(iface->ext_ops == NULL)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this duplicates the poll_tx sequence and adds two dependent dereferences (ext_ops, ext_ops->requirements) to every progress call. pls resolve the timestamp mode once at iface init into a field and keep a single uct_rc_iface_poll_tx() path — docs/OptimizationStyle.md prefers setup-time selection over hot-path conditionals.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ext.h Outdated
uint64_t event_flags;
} uct_rc_mlx5_ext_ops_t;

ucs_status_t uct_rc_mlx5_ext_register(const uct_rc_mlx5_ext_ops_t *ops);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

how is a provider supposed to reach uct_rc_mlx5_ext_register()? The header is in noinst_HEADERS and libuct_ib_mlx5 is a dlopened module, so there is no supported way for an out-of-tree provider to include/link it, and nothing in-tree registers a provider — all of the ext/SGL-checkpoint/bandwidth code is reachable only from gtest.

Comment thread src/uct/base/uct_iface.c Outdated
NULL);
}

void uct_iface_set_async_ep_event_params(const uct_iface_params_t *params,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

uct_iface_set_async_ep_event_params() has no caller — no transport reads async_ep_event_cb, so the endpoint event callback can never fire. pls drop it until a transport uses it.

Comment thread src/ucp/core/ucp_worker.c Outdated
ep_attr.field_mask = UCT_EP_ATTR_FIELD_BANDWIDTH;
status = uct_ep_query(uct_ep, &ep_attr);
if (status == UCS_OK) {
ucs_info("ep %p to %s lane[%d]: path bandwidth %.2f MiB/s",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: pls use ucs_debug — the failure branch below and ucp_worker_iface_handle_port_speed_event() both log at debug, and this fires per event per ep (docs/LoggingStyle.md).

@svc-ucx

svc-ucx commented Oct 28, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Build build_x86_64 debian130) · commit 961a7494

TL;DR: The build_docs step of the debian130 x86_64 build failed because doxygen (run with WARN_AS_ERROR = YES) can't resolve the new @ref uct_ep_query in src/uct/api/uct.h:442 — uct_ep_query is declared in src/uct/api/v2/uct_v2.h, which is not part of the doxygen INPUT. Replace the @ref with plain text (or add uct_v2.h to the doxygen input/file patterns).

Full analysis

Summary: Azure job "build_x86_64 debian130" failed in the first base test (build_docs): make V=1 docs aborted with Makefile:1338: docs/doxygen-doc/ucx.tag Error 1.

Root cause: Log line: /__w/1/s/src/uct/api/uct.h:442: error: unable to resolve reference to 'uct_ep_query' for \ref command (warning treated as error, aborting now). The PR added the new capability flag
#define UCT_IFACE_FLAG_EP_QUERY_BW UCS_BIT(57) /**< @ref uct_ep_query can report endpoint bandwidth */ (src/uct/api/uct.h:442-443). uct_ep_query() is declared only in src/uct/api/v2/uct_v2.h:1361, and docs/doxygen/ucxdox scans only src/uct/api/ with RECURSIVE = NO and a FILE_PATTERNS list containing just uct.h/uct_def.h — so the v2 header (and hence the uct_ep_query symbol) is invisible to doxygen. With WARN_AS_ERROR = YES (docs/doxygen/ucxdox:2398) the unresolved \ref is fatal. This is a doc-only problem in the PR, not a flaky infra failure (build is deterministic, no timeouts/gaps in the log).

Implicated commit: [REDACTED:Hex High Entropy String] (PR #12162 head, branch feature/dlb-sgl-path-performance); the surrounding UCT API work is 7327bcc "UCT: Add endpoint path performance notifications and timestamps" — Roie Danino

File: src/uct/api/uct.h:442 (doxygen config: docs/doxygen/ucxdox:765-810, 2398)

Suggested fix: Easiest and consistent with existing style: don't @ref a v2-only symbol from uct.h. Change the comment to plain text, e.g.
#define UCT_IFACE_FLAG_EP_QUERY_BW UCS_BIT(57) /**< uct_ep_query() can report endpoint bandwidth */
Also check the other new v2-referencing docs added by this PR (e.g. uct_ep_attr::bandwidth comment referencing UCT_IFACE_FLAG_EP_QUERY_BW is fine since it stays inside uct_v2.h, which isn't scanned). Alternatively, if cross-referencing is desired, add $(SRCDIR)/src/uct/api/v2/ to INPUT and uct_v2.h to FILE_PATTERNS in docs/doxygen/ucxdox — but that will surface additional undocumented-symbol warnings and should be done as a separate change. Re-run the build_docs stage locally with ./contrib/configure-release --with-docs-only && make docs to verify.

Related: PR #12162 (#12162) — the failing PR itself; no pre-existing issue found for this doxygen reference error.

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 7d7a39aa-c24a-46b2-98e8-9e153748dec1 in the triage console for the audit trail.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/uct/ib/mlx5/ib_mlx5.c Outdated
uct_ib_mlx5_cq_t *mlx5_cq, int preferred_cpu, size_t inl)
{
ucs_status_t status = UCS_OK;
#if !HAVE_DECL_MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE || \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

blocker: this statement is placed before the declarations in the #if HAVE_DECL_MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE block below, so when MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE exists but IBV_WC_EX_WITH_COMPLETION_TIMESTAMP does not, the build fails on -Werror=declaration-after-statement (config/m4/compiler.m4). pls move the check after the declarations; then the inner #if at line 157 can go away too.

Comment thread src/ucp/core/ucp_ep.c Outdated
(config_lane1->dst_sys_dev == config_lane2->dst_sys_dev) &&
(config_lane1->lane_types == config_lane2->lane_types) &&
(config_lane1->port_speed == config_lane2->port_speed) &&
(config_lane1->path_bandwidth.dedicated ==

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

blocker: making the raw measured bandwidth part of the config key means every distinct sample creates a new entry in worker->ep_config, which is append-only and capped at UCP_WORKER_MAX_EP_CONFIG (ucp_worker.c:2309), so after 255 samples reconfiguration fails permanently; each change also bumps worker->epoch and invalidates all proto_select caches. port_speed is quantized to 4 bits for exactly this reason - can we quantize path_bandwidth the same way (or keep it out of the key)?

Comment thread src/ucp/core/ucp_ep.c Outdated
continue;
}

ucs_info("dlb_ucp_path_sample ep %p lane %u bandwidth "

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls drop this log (or use ucs_debug without the dlb_ucp_path_sample tag) - it looks like leftover instrumentation, and info is not a level we use for per-sample messages (docs/LoggingStyle.md).

Comment thread src/ucp/proto/proto_multi.c Outdated
perf->bandwidth);
ucs_assert(lpriv->weight > 0);
ucs_assert(lpriv->weight <= UCP_PROTO_MULTI_WEIGHT_MAX);
if ((params->super.super.ep_config_key->lanes[lane].

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls remove this dlb_ucp_weights log - it is leftover instrumentation and it adds a per-lane branch to protocol initialization.

Comment thread src/ucp/proto/proto_common.c Outdated
goto err_deref_perf_node;
}

measured_bandwidth = params->super.ep_config_key->lanes[lane].path_bandwidth;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

measured_bandwidth is validated non-zero, but perf_attr.bandwidth is not, so path_ratio can become inf/nan here. since tl_perf->path_ratio below is already path_bandwidth/bandwidth, can we just override tl_perf->bandwidth after it is computed, instead of rescaling perf_attr to keep the ratio?

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_iface.c Outdated
return NULL;
}

enum {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls define this next to the UCT_IB_MLX5_POLL_FLAG_* enum in ib_mlx5.h (last one is UCS_BIT(4)) - these flags are passed down to uct_ib_mlx5_poll_cq(), so a new common flag on bit 5 would silently collide with this one.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_iface.c Outdated
return status;
}

if (self->super.tx.cqe_timestamp) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

instead of matching the progress function pointer here, can we select the timestamp variant in uct_rc_mlx5_iface_init_rx() where progress is already chosen (line 597-620)? otherwise a new progress function silently falls back to the cyclic_timestamp variant.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_iface.c Outdated
uct_rc_mlx5_iface_common_t super;
} uct_rc_mlx5_iface_t;

static ucs_status_t uct_rc_mlx5_iface_init_base(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

maybe keep UCS_CLASS_CALL_SUPER_INIT in the class init function? the wrapper adds nothing and relies on the undocumented _myclass/_init_count parameter names of UCS_CLASS_INIT_FUNC.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Outdated
uint32_t flush_rkey_hi;
ucs_status_t status;

addr_length = UCS_PARAM_VALUE(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this changes legacy uct_ep_connect_to_ep (no EP_ADDR_LENGTH): the default was sizeof(uct_rc_mlx5_ep_address_t), so flags/flush_rkey were never parsed, and now they are parsed from a peer address that may have been packed in the short form. is that intended?

@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage gap: no test covers repeated samples on the same endpoint, which is where the ucp_worker_get_ep_config limit is hit.

Residual coverage gap: the A && !B rdma-core combination that breaks uct_ib_mlx5_create_cq compilation is not exercised by any build job (consistent with the earlier note about IBV_WC_EX_WITH_COMPLETION_TIMESTAMP lacking CI coverage).

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/ucp/proto/proto_multi.c Outdated
perf->bandwidth);
ucs_assert(lpriv->weight > 0);
ucs_assert(lpriv->weight <= UCP_PROTO_MULTI_WEIGHT_MAX);
if ((params->super.super.ep_config_key->lanes[lane].

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls drop this block - it is pure dlb_ucp_* debug instrumentation, and info is not a level in docs/LoggingStyle.md. Same for dlb_ucp_path_sample / dlb_ucp_rebalance in ucp_ep.c; if the traces are needed, use ucs_debug() without the dlb_ tag.

Comment thread src/ucp/core/ucp_ep.c Outdated
}

if (!ucp_ep_config_is_equal(&key, &ucp_ep_config(ep)->key)) {
++worker->epoch;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why bump worker->epoch here? path_bandwidth is part of the config key, so the new cfg_index already gets a fresh proto_select. Bumping the epoch makes ucp_proto_request_send_op_rma() (proto_common.inl:353) rebuild the rkey config and re-run protocol selection for every endpoint and rkey in the worker on each per-lane sample.

* Interface attachment policy flags; see
* @ref UCT_RC_MLX5_EXT_FLAG_REQUIRE_IFACE_ATTACH.
*/
uint64_t flags;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

flags/UCT_RC_MLX5_EXT_FLAG_REQUIRE_IFACE_ATTACH (and the enum at :44-52) is documented but never read: unmet requirements silently attach the provider without timestamps, and iface_init failure always aborts iface creation. pls implement the policy or remove the field until it is used.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Outdated
uint32_t flush_rkey_hi;
ucs_status_t status;

addr_length = UCS_PARAM_VALUE(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this changes the legacy (no ep_addr_length) default from sizeof(uct_rc_mlx5_ep_address_t) to the local address length, so uct_ep_connect_to_ep() now parses ext_addr->flags/flush_rkey out of the remote address based on local config. A peer with flush_rkey disabled sends a shorter address - don't we read past its buffer and pick up a bogus flush_rkey? Previously this path was conservative.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_iface.c Outdated
return NULL;
}

enum {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: this flag shares the bit space of UCT_IB_MLX5_POLL_FLAG_* (ib_mlx5.h:241-245) and is passed into uct_ib_mlx5_poll_cq(). pls define it next to them, or add a static assert, so a future UCS_BIT(5) there does not silently collide.

Comment thread src/ucp/core/ucp_ep.h Outdated
ucp_lane_type_mask_t lane_types; /* Which types of operations this lane
was selected for */
uint8_t port_speed; /* Quantized port speed */
uct_ppn_bandwidth_t path_bandwidth; /* Cached destination/lane sample */

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: field name is off the column used by the rest of the struct (docs/CodeStyle.md: "indent structure fields on column").

Suggested change
uct_ppn_bandwidth_t path_bandwidth; /* Cached destination/lane sample */
uct_ppn_bandwidth_t path_bandwidth; /* Cached destination/lane sample */

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/ucp/core/ucp_ep.c Outdated
}

if (!ucp_ep_config_is_equal(&key, &ucp_ep_config(ep)->key)) {
++worker->epoch;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why bump the global epoch here? path_bandwidth is part of ucp_ep_config_key_t, so this ep gets a new cfg_index with a freshly initialized proto_select, and its rkey configs are already refreshed by the key.ep_cfg_index != ep->cfg_index check in ucp_proto_request_send_op_rma(). Incrementing worker->epoch additionally forces proto re-selection for every other endpoint and rkey config on the worker on each sample.

Comment thread src/ucp/core/ucp_ep.c Outdated
continue;
}

ucs_info("dlb_ucp_path_sample ep %p lane %u bandwidth "

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls remove the dlb_ucp_path_sample / dlb_ucp_rebalance traces (or demote to ucs_debug) — the dlb_ prefix is not a UCX convention and info is not in the level table in docs/LoggingStyle.md; these would print on every sample with the default-ish UCX_LOG_LEVEL=info.

Comment thread src/ucp/proto/proto_multi.c Outdated
perf->bandwidth);
ucs_assert(lpriv->weight > 0);
ucs_assert(lpriv->weight <= UCP_PROTO_MULTI_WEIGHT_MAX);
if ((params->super.super.ep_config_key->lanes[lane].

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls drop this block — it exists only to emit a leftover dlb_ instrumentation message, inside the per-lane protocol init loop.

* Interface attachment policy flags; see
* @ref UCT_RC_MLX5_EXT_FLAG_REQUIRE_IFACE_ATTACH.
*/
uint64_t flags;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

flags/UCT_RC_MLX5_EXT_FLAG_REQUIRE_IFACE_ATTACH is never read: uct_rc_mlx5_iface_t_init() always fails interface creation when iface_init fails, and an unmet UCT_RC_MLX5_EXT_REQ_TX_CQE_TIMESTAMP is silently ignored instead of aborting. pls either implement the documented policy or remove the field.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Outdated
uint32_t flush_rkey_hi;
ucs_status_t status;

addr_length = UCS_PARAM_VALUE(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this changes the default for legacy uct_ep_connect_to_ep() (which passes field_mask = 0) from sizeof(uct_rc_mlx5_ep_address_t) to the local full address length. With flush_remote enabled locally and a peer that packed only the 7-byte base address, we now read ext_addr->flags and the flush-rkey bytes past the end of the supplied buffer, and silently start consuming the remote flush rkey where it was previously forced to UCT_IB_MD_INVALID_FLUSH_RKEY. is the change to the no-length path intended, or should the provider payload require the v2 length?

Comment thread src/ucp/wireup/select.c Outdated
[ucs_ilog2(UCT_IFACE_FLAG_EVENT_RECV)] = "tag or active message event",
[ucs_ilog2(UCT_IFACE_FLAG_EVENT_RECV_SIG)] = "signaled message event"
[ucs_ilog2(UCT_IFACE_FLAG_EVENT_RECV_SIG)] = "signaled message event",
[ucs_ilog2(UCT_IFACE_FLAG_EVENT_ASYNC_CB)] = "async callback event",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls drop this (and the comma-only change above) — unrelated to the PR, and the entry is unreachable because criteria->local_event_flags only ever holds UCP_WIREUP_UCT_EVENT_CAP_FLAGS (bits 0-1), while it leaves a NULL hole at index 3 for UCT_IFACE_FLAG_EVENT_FD.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_iface.c Outdated
uct_rc_mlx5_iface_common_t super;
} uct_rc_mlx5_iface_t;

static ucs_status_t uct_rc_mlx5_iface_init_base(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why is this wrapper needed? UCS_CLASS_CALL_SUPER_INIT already returns on error, so the new post-init code can follow the direct call as uct_rc_init_fc_thresh() does today. Passing _myclass/_init_count explicitly only works because the macro happens to reference those parameter names.

Comment thread src/uct/base/uct_iface.h Outdated
uct_am_tracer_t am_tracer; /* Active message tracer */
void *am_tracer_arg; /* Tracer argument */
uct_error_handler_t err_handler; /* Error handler */
uct_ep_event_cb_t ep_event_cb;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: pls move these after err_handler_flags and add trailing comments — as placed they split the err_handler/err_handler_arg/err_handler_flags group and are the only uncommented members here.

Comment thread src/uct/api/uct.h Outdated
* initialization.
*/
uint64_t features;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: pls drop the stray blank line and the UCT_EVENT_SPEED_CHANGE comment reword — unrelated edits in the public header.

@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage gaps: UCT_RC_MLX5_EXT_FLAG_REQUIRE_IFACE_ATTACH has no test, consistent with it not being implemented.

Residual coverage gap: No test covers legacy uct_ep_connect_to_ep() (no ep_addr_length) against a peer with a shorter packed EP address, which is the path changed in rc_mlx5_ep.c:2423.

Residual coverage gap: No test asserts that a per-endpoint bandwidth sample does not invalidate protocol selection for unrelated endpoints/rkey configs (worker->epoch).

Note on submission: gh is not available in this environment, so the paginated inline/issue/review comment history for PR #12162 could not be fetched. Per the duplicate-detection rule these findings should be diffed against the full conversation before posting. Suggested review mode: COMMENT (all findings are non-blocking or questions; the scope/size blocker was already raised). No secrets or credential-like content found in the diff.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/ucp/core/ucp_ep.h Outdated
ucp_lane_type_mask_t lane_types; /* Which types of operations this lane
was selected for */
uint8_t port_speed; /* Quantized port speed */
uct_ppn_bandwidth_t path_bandwidth; /* Cached destination/lane sample */

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

UCP_MAX_LANES is 64, so this adds 1 KB to every ucp_ep_config_key_t — stack copies in reconfig/wireup, the per-worker config array, and every ucp_ep_path_bw_model_t::key. Can the measured samples live in ucp_ep_path_bw_model_t (indexed by lane) instead of in the shared key type, which is otherwise purely structural?

Comment thread src/ucp/core/ucp_ep.c Outdated
static ucs_status_t
ucp_ep_reconfig_internal(ucp_ep_h ep, ucp_lane_map_t failed_lanes)
ucp_ep_reconfig_key(ucp_ep_h ep, ucp_lane_map_t failed_lanes,
const ucp_ep_config_key_t *updated_key)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the only caller passes ucp_ep_config(ep)->key, so this parameter and the extra wrapper add no behavior - pls drop them and keep ucp_ep_reconfig_internal as it was.

Comment thread src/ucp/core/ucp_request.h Outdated
UCP_REQUEST_FLAG_RNDV_START_FLUSH = UCS_BIT(29)
UCP_REQUEST_FLAG_RNDV_START_FLUSH = UCS_BIT(29),
UCP_REQUEST_FLAG_PATH_BW_MODEL = UCS_BIT(30),
UCP_REQUEST_FLAG_PATH_BW_RECV_MODEL = UCS_BIT(31)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this flag is only set and released under ENABLE_DEBUG_DATA, but it consumes UCS_BIT(31) - the last bit of req->flags - in all builds. pls gate it like the other debug-only flags so production builds keep the bit.

Comment thread src/ucp/proto/proto_common.c Outdated
tl_perf->recv_overhead = perf_attr.recv_overhead + params->overhead;
tl_perf->bandwidth = ucp_proto_common_iface_bandwidth(
context, &perf_attr.bandwidth);
context, has_measurement ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

with a measurement tl_perf->bandwidth becomes the raw sample, so any positive sample below 1 B/s trips ucs_assert(tl_perf->bandwidth > 1.0) at the end of this function. ucp_ep_path_bw_changed() only rejects negative/NaN - can we also reject samples under some minimum there?

Comment thread src/ucp/proto/proto_multi.c Outdated
double ratio;

/* A measured path rate already includes sharing with other paths. */
if ((params->ep_config_key->lanes[lane].path_bandwidth.dedicated +

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the "has a measured sample" test (dedicated + shared > 0) is now open-coded here, in ucp_proto_multi_init_priv, and in ucp_proto_common_get_lane_perf. pls add one helper (e.g. in ucp_ep.inl) and use it in all three places.

ucs_queue_for_each_extract(op, &ep->super.txqp.outstanding, queue,
UCS_CIRCULAR_COMPARE16(op->sn, <=, pi)) {
if (op->flags & UCT_RC_IFACE_SEND_OP_FLAG_CANCEL_ON_PURGE) {
uct_invoke_completion(op->user_comp, UCS_ERR_CANCELED);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
uct_invoke_completion(op->user_comp, UCS_ERR_CANCELED);
if (op->user_comp != NULL) {
uct_invoke_completion(op->user_comp, UCS_ERR_CANCELED);
}

uct_rc_txqp_purge_outstanding() treats user_comp as optional; without the check a cancel-on-purge op posted without a completion crashes here.

Comment thread src/uct/ib/mlx5/dv/ib_mlx5dv_md.c Outdated
status = uct_ib_mlx5_md_buf_alloc(md, ucs_get_page_size(), 0, &md->zero_buf,
&md->zero_mem, 0, "zero umem");
status = uct_ib_mlx5_md_buf_alloc(
md, ucs_max(ucs_get_page_size(), UCT_IB_MLX5_FLUSH_PROBE_OFFSET +

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this grows zero_buf from one page to 128 KB and registers a 128 KB flush MR for every IB MD, even when no provider uses the probe region. Can the larger region be allocated only when the provider attaches? Also ucs_assert(UCT_IB_MD_FLUSH_REMOTE_LENGTH <= ucs_get_page_size()) above no longer covers the length actually registered.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5.h Outdated
/* atomic key has no offset */
UCT_RC_MLX5_EP_ADDR_FLAG_NO_ATOMIC_OFFSET = UCS_BIT(1)
UCT_RC_MLX5_EP_ADDR_FLAG_NO_ATOMIC_OFFSET = UCS_BIT(1),
UCT_RC_MLX5_EP_ADDR_FLAG_FLUSH_PROBE = UCS_BIT(3)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why UCS_BIT(3) and not UCS_BIT(2)? Also ep->super.flush_probe is written in three places but never read in-tree - is the consumer supposed to come in a follow-up?

Comment thread src/uct/api/v2/uct_v2.h Outdated
* @retval UCS_ERR_INVALID_PARAM A required parameter field is missing.
* @retval UCS_ERR_UNSUPPORTED The interface does not support endpoint events.
*/
ucs_status_t uct_iface_set_ep_event_handler(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

there is no test for the new UCT API. test/gtest/uct/ib/test_rc.cc already calls uct_ep_query() - pls add coverage there for UCT_EP_ATTR_FIELD_BANDWIDTH (unsupported without a provider) and for uct_iface_set_ep_event_handler() register/remove.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_iface.c Outdated
return uct_rc_mlx5_iface_progress(arg, UCT_IB_MLX5_POLL_FLAG_HAS_EP);
}


Copy link
Copy Markdown

Choose a reason for hiding this comment

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

whitespace-only change unrelated to the feature (same in rc_mlx5.h, uct_iface.h and the blank line added to struct uct_iface_params in uct.h). pls drop them to keep the diff reviewable.

@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage gaps: No test for the UCT pieces (uct_iface_set_ep_event_handler, uct_ep_query bandwidth, UCT_RC_MLX5_EXT_FLAG_REQUIRE_IFACE_ATTACH, UCT_RC_IFACE_SEND_OP_FLAG_CANCEL_ON_PURGE); all of them are only reachable through an out-of-tree provider, so they are effectively untested.

The ucp_ep_perf tests drive ucp_ep_path_bw_changed() directly; the ucp_worker_iface_ep_event_cb → uct_ep_query → coalesce path is never exercised end to end.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

/* flags for uct_rc_iface_send_op_t */
enum {
/* Cancel this internal operation on purge instead of exposing it for replay. */
UCT_RC_IFACE_SEND_OP_FLAG_CANCEL_ON_PURGE = UCS_BIT(10),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Flag lifetime is asymmetric: UCT_RC_IFACE_SEND_OP_FLAG_CANCEL_ON_PURGE is cleared only in the new branch in uct_rc_mlx5_ep_outstanding_complete_send_ops(). On the regular completion path (uct_rc_txqp_completion_op()) and in uct_rc_txqp_purge_outstanding() it stays set, and then uct_rc_iface_put_send_op() hits ucs_assertv(op->flags == UCT_RC_IFACE_SEND_OP_FLAG_IFACE). Should it be cleared on those paths too? Impact: debug-build assertion failure when such an op completes normally or is purged from the ep destructor rather than through the new purge branch (rc_ep.c:583, rc_iface.h:540).

op->wqe_end_pi : op->sn,
<=, pi)) {
if (op->flags & UCT_RC_IFACE_SEND_OP_FLAG_CANCEL_ON_PURGE) {
uct_invoke_completion(op->user_comp, UCS_ERR_CANCELED);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Completion status is hard-coded: the status argument of this function is ignored here, so a burst whose WQEs were delivered (caller passes UCS_OK, see rc_mlx5_ep.c:1956) is still completed with UCS_ERR_CANCELED. The existing branch at line 1823 uses status.

Suggested change
uct_invoke_completion(op->user_comp, UCS_ERR_CANCELED);
uct_invoke_completion(op->user_comp, status);

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.

it's intentional, we don't want to replay them on purge

status = iface->ext_ops->ep_query(ep->ext_ctx, &result);
}

if (status == UCS_ERR_UNSUPPORTED) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fallback is too narrow: why fall back to the iface estimate only on UCS_ERR_UNSUPPORTED? ep_query is documented as returning "the latest available cached bandwidth", so a provider with no sample yet returning e.g. UCS_ERR_NO_ELEM makes uct_ep_query() fail even though the iface estimate is available.

Comment thread src/uct/ib/mlx5/ib_mlx5.h
struct uct_rc_mlx5_ext_ops;

/* The common registry selects one RC provider for an interface lifetime. */
const struct uct_rc_mlx5_ext_ops *uct_ib_mlx5_ext_get_rc_provider(void);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Declaration in the wrong header: pls declare this in ib_mlx5_ext.h next to the other uct_ib_mlx5_ext_* prototypes, where uct_rc_mlx5_ext_ops_t is already defined; then the struct uct_rc_mlx5_ext_ops forward declaration and the new #include "ib_mlx5.h" in ib_mlx5_ext.c are not needed.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_iface.c Outdated
tl_md, worker, params, &config->super.super,
&config->rc_mlx5_common, &init_attr);

self->super.ext_ops = ext_ops;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant state: pls set self->super.ext_ops only after the attachment succeeded; then the two ext_ops = NULL resets here are not needed, and the cleanup can test ext_ops != NULL instead of using ext_ops->iface_init != NULL as a proxy for "init ran" (same for the ep_init != NULL test in the ep cleanup).

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Outdated

err_destroy_tm_qp:
uct_ib_mlx5_destroy_qp(md, &self->tm_qp);
if (UCT_RC_MLX5_TM_ENABLED(iface)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Condition is always true: minor — the only goto err_destroy_tm_qp is inside the UCT_RC_MLX5_TM_ENABLED(iface) block at line 2455, so this check never fails.

Suggested change
if (UCT_RC_MLX5_TM_ENABLED(iface)) {
uct_ib_mlx5_destroy_qp(md, &self->tm_qp);

Comment thread src/uct/base/uct_iface.h Outdated
uct_am_tracer_t am_tracer; /* Active message tracer */
void *am_tracer_arg; /* Tracer argument */
uct_error_handler_t err_handler; /* Error handler */
uct_ep_event_cb_t ep_event_cb;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Field placement/alignment: minor — pls align the * on column with the neighbouring fields and add field comments (docs/CodeStyle.md: "Indent structure fields on column"), and move them after err_handler_arg so the error-handler fields stay together. Same alignment issue for the new ext_ctx in rc_mlx5.h:61 and ext_ops/ext_ctx in rc_mlx5_common.h:349-350.

Suggested change
uct_ep_event_cb_t ep_event_cb;
uct_ep_event_cb_t ep_event_cb; /* Endpoint event callback */
void *ep_event_arg; /* Endpoint event argument */

Comment thread src/uct/base/uct_iface.c Outdated
uct_base_iface_t *iface = ucs_derived_of(tl_iface, uct_base_iface_t);

iface->ep_event_cb = params->cb;
iface->ep_event_arg = (params->field_mask &

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use the existing param macro: minor — pls use UCS_PARAM_VALUE() here, like the other optional-param accessors in this file.

Suggested change
iface->ep_event_arg = (params->field_mask &
iface->ep_event_arg = UCS_PARAM_VALUE(UCT_IFACE_SET_EP_EVENT_PARAM_FIELD,
params, arg, ARG, NULL);

@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage gap: UCT_RC_IFACE_SEND_OP_FLAG_CANCEL_ON_PURGE / wqe_end_pi have no in-tree producer, so neither the new extraction predicate nor uct_rc_mlx5_ep_is_cancel_on_purge_wqe() is exercised by CI; the flag-clearing issue above is therefore invisible to the test suite.

Residual coverage gap: uct_rc_mlx5_ext_ops_t has no in-tree implementation, so iface_init/ep_init failure paths, UCT_RC_MLX5_EXT_FLAG_REQUIRE_IFACE_ATTACH, and the ep_query bandwidth path are untested.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

}

if (!delivered) {
if (!delivered && !uct_rc_mlx5_ep_is_cancel_on_purge_wqe(ep, pi)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A multi-WQE cancel-on-purge op now stays at the queue head for its whole range, so for the 2nd and later WQEs of the burst uct_rc_mlx5_ep_is_flush_remote_wqe(ep, pi) (called a few lines above, in the rx_token path) hits ucs_assert(UCS_CIRCULAR_COMPARE16(op->sn, >=, pi)) inside uct_rc_mlx5_ep_outstanding_peek_send_op(). pls skip those WQEs before the head op is peeked.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_iface.c Outdated
tl_md, worker, params, &config->super.super,
&config->rc_mlx5_common, &init_attr);

self->super.ext_ops = ext_ops;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can we assign self->super.ext_ops only after iface_init() succeeds? then both self->super.ext_ops = NULL resets below are not needed.

static UCS_CLASS_CLEANUP_FUNC(uct_rc_mlx5_iface_common_t)
{
uct_rc_iface_cleanup_qps(&self->super);
if ((self->ext_ops != NULL) && (self->ext_ops->iface_init != NULL) &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: why does calling iface_cleanup require iface_init != NULL? a provider that implements only the cleanup hook would silently skip it. Same pattern for ep_init/ep_cleanup in the uct_rc_mlx5_ep_t cleanup.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Outdated

err_destroy_tm_qp:
uct_ib_mlx5_destroy_qp(md, &self->tm_qp);
if (UCT_RC_MLX5_TM_ENABLED(iface)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

err_destroy_tm_qp is only reachable from the UCT_RC_MLX5_TM_ENABLED(iface) branch above, so this check looks redundant - why is it needed?

Comment thread src/uct/ib/mlx5/ib_mlx5.h
struct uct_rc_mlx5_ext_ops;

/* The common registry selects one RC provider for an interface lifetime. */
const struct uct_rc_mlx5_ext_ops *uct_ib_mlx5_ext_get_rc_provider(void);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls declare this in ib_mlx5_ext.h next to uct_rc_mlx5_ext_ops_t instead of forward-declaring the struct here; then ib_mlx5_ext.c also does not need to include ib_mlx5.h.

Comment thread src/uct/base/uct_iface.h Outdated
uct_am_tracer_t am_tracer; /* Active message tracer */
void *am_tracer_arg; /* Tracer argument */
uct_error_handler_t err_handler; /* Error handler */
uct_ep_event_cb_t ep_event_cb;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
uct_ep_event_cb_t ep_event_cb;
void *err_handler_arg; /* Error handler argument */
uct_ep_event_cb_t ep_event_cb; /* Endpoint event callback */
void *ep_event_arg; /* Endpoint event argument */

minor: keeps err_handler/err_handler_arg together and aligns the fields on the column.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

UCT_RC_IFACE_SEND_OP_FLAG_CANCEL_ON_PURGE) ?
op->wqe_end_pi : op->sn,
<=, pi)) {
if (op->flags & UCT_RC_IFACE_SEND_OP_FLAG_CANCEL_ON_PURGE) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls release the op through op->handler() (with op->status and UCT_RC_IFACE_SEND_OP_STATUS set), the way uct_rc_txqp_purge_outstanding() handles ops it does not recognize. As written the provider never gets a chance to release RDMA-read credits or the valgrind op->iov, uct_rc_iface_put_send_op() silently assumes the op came from iface->tx.ops_buffer (its flags == FLAG_IFACE assert is compiled out in release), and the hardcoded UCS_ERR_CANCELED ignores the status argument of this function.


return UCS_OK;

err_ext_ep_init:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

maybe use a dedicated err_ label that undoes only what init did, instead of calling the whole class cleanup from the init path? the current form works only because UCS_CLASS_INIT skips the failed class's own destructor, and it is the only reason the extra ext_initialized state is needed.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5.h Outdated
*/
typedef struct uct_rc_mlx5_base_ep {
uct_rc_ep_t super;
void *ext_ctx;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

docs/OptimizationStyle.md asks to avoid enlarging the endpoint structure — can the provider hold its per-ep context in its own table keyed by the ep? if the pointer must stay, pls move it after tx so the offset of the hot tx.wq does not shift.

Comment thread src/uct/ib/mlx5/ib_mlx5.h
struct uct_rc_mlx5_ext_ops;

/* The common registry selects one RC provider for an interface lifetime. */
const struct uct_rc_mlx5_ext_ops *uct_ib_mlx5_ext_get_rc_provider(void);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls declare this in ib_mlx5_ext.h next to the other uct_ib_mlx5_ext_* prototypes — then the forward declaration here and the new ib_mlx5.h include in ib_mlx5_ext.c are not needed.

Comment thread src/uct/ib/mlx5/ib_mlx5.h
/* Device supports forcing ordering configuration */
UCT_IB_MLX5_MD_FLAG_DP_ORDERING_FORCE = UCS_BIT(18),
/* Device supports dump/fill memory keys */
UCT_IB_MLX5_MD_FLAG_DUMP_FILL_MKEY = UCS_BIT(19),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nothing reads this flag, and it takes the last free bit before UCT_IB_MLX5_MD_FLAG_DEVX_OBJS_SHIFT — pls add it (and the dump_fill_mkey ifc field) together with the code that uses it.

Comment thread src/uct/base/uct_iface.h Outdated
uct_am_tracer_t am_tracer; /* Active message tracer */
void *am_tracer_arg; /* Tracer argument */
uct_error_handler_t err_handler; /* Error handler */
uct_ep_event_cb_t ep_event_cb;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: pls document and align these like the neighbouring fields; also better placed after err_handler_flags, so the err_handler* fields stay together.

Suggested change
uct_ep_event_cb_t ep_event_cb;
uct_ep_event_cb_t ep_event_cb; /* Endpoint event callback */
void *ep_event_arg; /* Endpoint event argument */

Comment thread src/ucp/core/ucp_worker.c

ucs_trace_func("async_cb for iface=%p flags=%u", wiface->iface, flags);

if (flags & UCT_EVENT_PROGRESS) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: can we just return after signaling, like the UCT_EVENT_SPEED_CHANGE branch below? clearing the bit and testing flags == 0 only matters if some transport ORs UCT_EVENT_PROGRESS with other events, which nothing does.

@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage gaps: there is still no in-tree producer of UCT_EVENT_PROGRESS, no in-tree implementation of uct_rc_mlx5_ext_ops_t, and no in-tree writer of UCT_RC_IFACE_SEND_OP_FLAG_CANCEL_ON_PURGE/wqe_end_pi, so uct_iface_set_ep_event_handler(), the ep_query bandwidth path, UCT_RC_MLX5_EXT_FLAG_REQUIRE_IFACE_ATTACH, both new purge predicates, and UCT_IB_MLX5_MD_FLAG_DUMP_FILL_MKEY are exercised by nothing in CI — which is exactly why the op-release issue above is invisible to the test suite. Additionally, the ep_init failure path in uct_rc_mlx5_ep_t (and the full-cleanup-from-init pattern it relies on) has no test.

@roiedanino roiedanino changed the title [WIP-DNM] UCT/IB: Integrate RC plugin hooks UCT/IB: Integrate RC plugin hooks Nov 11, 2026
@roiedanino roiedanino added Ready for Review and removed WIP-DNM Work in progress / Do not review labels Nov 11, 2026
@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/ucp/core/ucp_worker.c
ucs_trace_func("async_cb for iface=%p flags=%u", wiface->iface, flags);

if (flags & UCT_EVENT_PROGRESS) {
ucp_worker_signal_internal(wiface->worker);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ucp_worker_signal_internal() is a no-op unless UCP_FEATURE_WAKEUP is set, and it does not schedule any progress callback. So UCT_EVENT_PROGRESS is silently dropped for workers without wakeup - is that intended, or should it also go through ucp_worker_iface_check_events() like ucp_worker_iface_event_common() does?

Comment thread src/uct/ib/mlx5/ib_mlx5.h
struct uct_rc_mlx5_ext_ops;

/* The common registry selects one RC provider for an interface lifetime. */
const struct uct_rc_mlx5_ext_ops *uct_ib_mlx5_ext_get_rc_provider(void);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls declare this in ib_mlx5_ext.h, next to the other uct_ib_mlx5_ext_* functions, where uct_rc_mlx5_ext_ops_t is already defined. Then the two struct uct_rc_mlx5_ext_ops; forward declarations (here and in rc_mlx5_common.h) and the new #include "ib_mlx5.h" in ib_mlx5_ext.c are not needed.

if (ep_attr->field_mask & UCT_EP_ATTR_FIELD_BANDWIDTH) {
status = UCS_ERR_UNSUPPORTED;
if ((iface->ext_ops != NULL) && (iface->ext_ops->ep_query != NULL)) {
status = iface->ext_ops->ep_query(ep->ext_ctx, &result);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

result is a copy of the full user ep_attr, so the provider hook also sees UCT_EP_ATTR_FIELD_TX_TOKEN in field_mask. A provider that does not support that field may legitimately return UCS_ERR_UNSUPPORTED, and we then silently fall back to the iface estimate and lose its bandwidth sample. pls pass only UCT_EP_ATTR_FIELD_BANDWIDTH to ep_query.

Comment thread src/uct/ib/mlx5/ib_mlx5.h
/* Device supports forcing ordering configuration */
UCT_IB_MLX5_MD_FLAG_DP_ORDERING_FORCE = UCS_BIT(18),
/* Device supports dump/fill memory keys */
UCT_IB_MLX5_MD_FLAG_DUMP_FILL_MKEY = UCS_BIT(19),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this flag has no reader anywhere in the tree. pls drop it and the dump_fill_mkey ifc field from this PR until something consumes them.

unsigned length;
union {
unsigned length;
uint16_t wqe_end_pi; /* cancel-on-purge WQE range */

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

uct_rc_ep_init_send_op() always writes op->length, so wqe_end_pi is only valid if the producer sets it after init; and it cannot be used for ops that also need length (e.g. uct_rc_op_release_reads_get_zcopy()), even though the new clear mask in uct_rc_mlx5_ep_outstanding_complete_send_ops() implies CANCEL_ON_PURGE can be combined with _FLAG_ZCOPY. can we derive the end pi from sn + the WQE count instead of aliasing length?

.ep_get_sgl_zcopy = uct_rc_mlx5_ep_get_sgl_zcopy,
.ep_outstanding_purge = uct_rc_mlx5_ep_outstanding_purge
.ep_outstanding_purge = uct_rc_mlx5_ep_outstanding_purge,
.iface_set_ep_event_handler = uct_base_iface_set_ep_event_handler

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: this breaks the = alignment of the rest of the ops table.

@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage gap: there is still no in-tree producer of UCT_EVENT_PROGRESS, no in-tree implementation of uct_rc_mlx5_ext_ops_t, and no in-tree writer of UCT_RC_IFACE_SEND_OP_FLAG_CANCEL_ON_PURGE/wqe_end_pi. Consequently uct_iface_set_ep_event_handler() (and the new uct_base_iface_t::ep_event_cb/ep_event_arg, which have no reader at all), the ep_query bandwidth path, UCT_RC_MLX5_EXT_FLAG_REQUIRE_IFACE_ATTACH, both new purge predicates, and UCT_IB_MLX5_MD_FLAG_DUMP_FILL_MKEY are exercised by nothing in CI.

The ep_init failure path in UCS_CLASS_INIT_FUNC(uct_rc_mlx5_ep_t) — which relies on calling the class cleanup function directly, because ucs_class_call_cleanup_chain() skips the own-class destructor — has no test. I traced the _init_count/skip arithmetic and it does not double-run the cleanup, but this pattern has no other precedent in the tree.

The HAVE_DECL_IBV_EVENT_DEVICE_SPEED_CHANGE-absent configuration, which is the only configuration the ib_iface.c hunk actually changes behavior for, is not covered by any build job.

@svc-ucx

svc-ucx commented Nov 12, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (AddressSanitizer roce on worker 3) · commit 136331d8

TL;DR: The ASAN/roce gtest run failed on a single test, ib/test_md.alloc/0 (mlx5_0) — the IB MD "alloc" test, which on an ib MD exercises only the DEVX device-memory (ibv_alloc_dm, UCS_MEMORY_TYPE_RDMA) path; nothing in this PR's RC-plugin/DLB changes touches that path, so this is a device-memory resource/path failure (DM is a tiny, HCA-global resource shared by the 4 parallel gtest workers), not a regression from commit 136331d.

Full analysis

Summary: make test in the "roce on worker 3" AddressSanitizer job exited non-zero because 1 of 9028 gtests failed: [ FAILED ] ib/test_md.alloc/0, where GetParam() = mlx5_0 (all other 9027 passed).

Root cause: Evidence from the log: the only failure is ib/test_md.alloc/0; the run otherwise completed cleanly (9028 tests ... PASSED 9027, then make: *** [Makefile:5014: test] Error 1). For the ib component the MD advertises UCT_MD_FLAG_ALLOC only when DEVX device memory + atomic KSM key creation succeed (uct_ib_mlx5dv_check_dm_ksm_reg()), and md_attr.alloc_mem_types is then just UCS_MEMORY_TYPE_RDMA with max_alloc = dev_attr.max_dm_size. So test_md.alloc loops 300 times doing ibv_alloc_dm() + KSM/atomic-key creation + uct_md_mkey_pack_v2(INVALIDATE_RMA|INVALIDATE_AMO) against a few hundred KB of HCA-global device memory. That is exactly the kind of thing that fails when several gtest workers run concurrently against mlx5_0 on the same host (swx-rain04): either uct_mem_alloc() returns UCS_ERR_NO_MEMORY too often and the guard EXPECT_LT(num_alloc_failures/iterations, 0.5) << "Too many OUT_OF_RESOURCE failures" trips (the test deliberately silences the "failed to allocate" / "exceeds maximal supported size" logs emitted by uct_ib_mlx5_devx_device_mem_alloc()), or the on-demand atomic key for the DM memh cannot be created and mkey_pack returns UCS_ERR_INVALID_PARAM ("cannot invalidate AMO without creating an atomic key"). Note: the exact assertion text is in the middle of a ~38-minute log and the Azure log API only returns the tail, so the precise line could not be retrieved; the PR's own commits ([REDACTED:Hex High Entropy String] RC plugin hooks, 5c98fb5a dump-fill mkey caching, 136331d8 provider state/field ordering) do not touch the MD alloc/DM code path. The nearest recent change to that path is e4d1e597 (#12265, "UCT/IB/MLX5: Fix atomic MR offset without a flush memory key", dmitrygx), already on master.

Implicated commit: Not this PR's head (136331d, Roie Danino). Closest relevant change to the failing path: e4d1e59 — dmitrygx, "UCT/IB/MLX5: Fix atomic MR offset without a flush memory key" (#12265).

File: test/gtest/uct/test_md.cc:479-561 (alloc test; guard at :559, mkey_pack assert at :553) and src/uct/ib/mlx5/dv/ib_mlx5dv_md.c:2122-2225 (uct_ib_mlx5_devx_device_mem_alloc, DM size check at :2151)

Suggested fix: 1) Re-run the job / re-trigger CI — this is an isolated, resource-dependent failure in a path untouched by the PR. 2) To diagnose definitively, grab the full gtest log (the per-worker *.log from the build, or run gtest --gtest_filter=ib/test_md.alloc* on swx-rain04) to see which assertion fired. 3) If it reproduces, harden the test for the HCA-global device-memory resource: skip/relax test_md.alloc for UCS_MEMORY_TYPE_RDMA when max_dm_size is contended (treat DM UCS_ERR_NO_MEMORY as a skip rather than counting toward the 50% failure budget), and make the DM atomic-key failure path report UCS_ERR_NO_RESOURCE/skip instead of UCS_ERR_INVALID_PARAM from uct_ib_mlx5_devx_mkey_pack().

Related: PR #12162 (this PR), PR #12265 (atomic MR offset without flush mkey — last change to the DM/atomic-key path)

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id aa25f17b-b9f4-4b56-8d10-2d122fd0c671 in the triage console for the audit trail.

Comment thread src/uct/base/uct_iface.h Resolved
Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Resolved
Comment thread src/uct/base/uct_iface.c
{
uct_base_iface_t *iface = ucs_derived_of(tl_iface, uct_base_iface_t);

iface->ep_event_cb = params->cb;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can the provider deliver this event from a oneshot progress callback instead of calling ep_event_cb directly from its probe completion? The completion runs inside uct_rc_mlx5_iface_poll_tx(), which still uses the ep after uct_rc_mlx5_txqp_process_tx_cqe() returns, so a handler that destroys the ep there causes a use-after-free. E.g. ucs_callbackq_add_oneshot() on the worker progress queue with the ep as the key, and ucs_callbackq_remove_oneshot() in ep_cleanup, like UCT_EVENT_SPEED_CHANGE, which is delivered from the progress callback uct_ib_iface_port_speed_change_progress(). Then the handler may also destroy the ep without no limitations (it is weird that someone wants to do it, but we should be prepared for that)

Comment thread src/ucp/core/ucp_worker.c Resolved
perf_attr.field_mask = UCT_PERF_ATTR_FIELD_PATH_BANDWIDTH;
status = uct_iface_estimate_perf(tl_ep->iface, &perf_attr);
if (status == UCS_OK) {
result.bandwidth = perf_attr.path_bandwidth;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The fallback returns the static estimate in shared, which UCP divides by the number of local processes, while a provider sample goes to dedicated. So with 8 processes a lane without a sample looks up to 8x slower than a lane with one, even on the same kind of link. Can we document in uct_ep_attr::bandwidth which field a sample uses, and whether it is the path bandwidth or this endpoint's share of it?

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

UCS_CIRCULAR_COMPARE16(
(op->flags &
UCT_RC_IFACE_SEND_OP_FLAG_CANCEL_ON_PURGE) ?
op->wqe_end_pi : op->sn,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

keeping a cancel-on-purge op queued past its first WQE breaks the UCS_CIRCULAR_COMPARE16(op->sn, >=, pi) assert in uct_rc_mlx5_ep_outstanding_peek_send_op(): for the 2nd and later WQEs of such a burst the delivered calculation above calls uct_rc_mlx5_ep_is_flush_remote_wqe(ep, pi), which peeks the head op with pi > op->sn.

Comment thread src/ucp/core/ucp_worker.c
ucs_trace_func("async_cb for iface=%p flags=%u", wiface->iface, flags);

if (flags & UCT_EVENT_PROGRESS) {
ucp_worker_signal_internal(wiface->worker);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ucp_worker_signal_internal() does nothing unless UCP_FEATURE_WAKEUP is requested, so without wakeup this progress request is silently dropped - is that enough for the transport asking for progress?

Comment thread src/uct/ib/mlx5/ib_mlx5.h
struct uct_rc_mlx5_ext_ops;

/* The common registry selects one RC provider for an interface lifetime. */
const struct uct_rc_mlx5_ext_ops *uct_ib_mlx5_ext_get_rc_provider(void);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: can we declare this in ib_mlx5_ext.h next to uct_rc_mlx5_ext_ops_t? then the forward declaration here and the new ib_mlx5.h include in ib_mlx5_ext.c are not needed.

unsigned length;
union {
unsigned length;
uint16_t wqe_end_pi; /* cancel-on-purge WQE range */

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: pls document whether wqe_end_pi is the pi of the last WQE of the burst or one past it; both new purge predicates depend on it and there is no in-tree producer to compare with.

@dmitrygx dmitrygx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good to go, and we discussed that comments of bot could be addressed in the folow-up PR

@roiedanino
roiedanino enabled auto-merge (squash) November 12, 2026 23:24
@roiedanino
roiedanino merged commit db230c0 into openucx:master Nov 13, 2026
167 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants