Repository navigation
UCT/IB: Integrate RC plugin hooks - #12162
Conversation
|
🤖 Starting review — findings will be posted here when done. |
|
🤖 CI Triage Agent — TL;DR: The Full analysisSummary: Root cause: This PR added a new capability flag with a doxygen cross-reference: Implicated commit: File: 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 Related: PR #12162 (this change); #7020 (original PR that introduced |
| 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 || \ |
There was a problem hiding this comment.
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.
| /* 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)); |
There was a problem hiding this comment.
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?
|
|
||
| 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); |
There was a problem hiding this comment.
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.
| return status; | ||
| } | ||
|
|
||
| context = ucs_malloc(sizeof(*context) + |
There was a problem hiding this comment.
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.
| */ | ||
| typedef struct uct_rc_mlx5_base_ep { | ||
| uct_rc_ep_t super; | ||
| void *ext_ctx; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
|
|
||
| err_destroy_tm_qp: | ||
| uct_ib_mlx5_destroy_qp(md, &self->tm_qp); | ||
| if (UCT_RC_MLX5_TM_ENABLED(iface)) { |
There was a problem hiding this comment.
minor: why is this condition needed? The label is only reachable after tm_qp was created, i.e. with TM enabled.
| [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", |
There was a problem hiding this comment.
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.
| } | ||
| }; | ||
|
|
||
| UCS_TEST_F(test_rc_extension, registration) |
There was a problem hiding this comment.
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.
| } | ||
| #endif | ||
|
|
||
| class test_rc_sgl_api : public ucs::test { |
There was a problem hiding this comment.
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).
|
blocker: this is ~1100 added lines and bundles at least six independent changes: endpoint-aware UCT async events + Residual coverage gaps I could not verify: whether
No secrets or credential-like content found in the diff. Note: |
|
🤖 CI Triage Agent — TL;DR: The Full analysisSummary: Root cause: The log shows the exact failure:
#define UCT_IFACE_FLAG_EP_QUERY_BW UCS_BIT(57) /**< @ref uct_ep_query can report
endpoint bandwidth */However Implicated commit: File: Suggested fix: Drop the #define UCT_IFACE_FLAG_EP_QUERY_BW UCS_BIT(57) /**< uct_ep_query() can report
endpoint bandwidth */(or Related: PR #12162 "[WIP-DNM] UCT/IB/RC: Add existing-path bandwidth monitoring integration" (#12162) |
|
🤖 Starting review — findings will be posted here when done. |
| 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; |
There was a problem hiding this comment.
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:
| UCT_IFACE_FLAG_EVENT_PATH_SPEED_CHANGE; | |
| iface_attr->cap.event_flags |= | |
| UCT_IFACE_FLAG_EVENT_PATH_SPEED_CHANGE; |
| NULL); | ||
| } | ||
|
|
||
| void uct_iface_set_async_ep_event_params(const uct_iface_params_t *params, |
There was a problem hiding this comment.
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.
| 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 || \ |
There was a problem hiding this comment.
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).
| 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( |
There was a problem hiding this comment.
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.
| 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", |
There was a problem hiding this comment.
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.
| if HAVE_TL_RC | ||
| noinst_HEADERS += \ | ||
| rc/rc_mlx5.h \ | ||
| rc/rc_mlx5_ext.h \ |
There was a problem hiding this comment.
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.
|
Residual coverage gaps: no test exercises the |
| 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); |
There was a problem hiding this comment.
we can ignore that
|
🤖 Starting review — findings will be posted here when done. |
| 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 | |
There was a problem hiding this comment.
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).
| return status; | ||
| } | ||
|
|
||
| context = ucs_malloc(sizeof(*context) + |
There was a problem hiding this comment.
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.
| /* 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)); |
There was a problem hiding this comment.
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?
| 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) { |
There was a problem hiding this comment.
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.
| */ | ||
| typedef struct uct_rc_mlx5_base_ep { | ||
| uct_rc_ep_t super; | ||
| void *ext_ctx; |
There was a problem hiding this comment.
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").
| 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)) { |
There was a problem hiding this comment.
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.
| 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); |
There was a problem hiding this comment.
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.
| NULL); | ||
| } | ||
|
|
||
| void uct_iface_set_async_ep_event_params(const uct_iface_params_t *params, |
There was a problem hiding this comment.
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.
| 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", |
There was a problem hiding this comment.
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).
|
🤖 CI Triage Agent — TL;DR: The Full analysisSummary: Azure job "build_x86_64 debian130" failed in the first base test ( Root cause: Log line: Implicated commit: [REDACTED:Hex High Entropy String] (PR #12162 head, branch 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 Related: PR #12162 (#12162) — the failing PR itself; no pre-existing issue found for this doxygen reference error.
|
|
🤖 Starting review — findings will be posted here when done. |
| 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 || \ |
There was a problem hiding this comment.
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.
| (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 == |
There was a problem hiding this comment.
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)?
| continue; | ||
| } | ||
|
|
||
| ucs_info("dlb_ucp_path_sample ep %p lane %u bandwidth " |
There was a problem hiding this comment.
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).
| 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]. |
There was a problem hiding this comment.
pls remove this dlb_ucp_weights log - it is leftover instrumentation and it adds a per-lane branch to protocol initialization.
| goto err_deref_perf_node; | ||
| } | ||
|
|
||
| measured_bandwidth = params->super.ep_config_key->lanes[lane].path_bandwidth; |
There was a problem hiding this comment.
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?
| return NULL; | ||
| } | ||
|
|
||
| enum { |
There was a problem hiding this comment.
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.
| return status; | ||
| } | ||
|
|
||
| if (self->super.tx.cqe_timestamp) { |
There was a problem hiding this comment.
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.
| uct_rc_mlx5_iface_common_t super; | ||
| } uct_rc_mlx5_iface_t; | ||
|
|
||
| static ucs_status_t uct_rc_mlx5_iface_init_base( |
There was a problem hiding this comment.
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.
| uint32_t flush_rkey_hi; | ||
| ucs_status_t status; | ||
|
|
||
| addr_length = UCS_PARAM_VALUE( |
There was a problem hiding this comment.
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?
|
Residual coverage gap: no test covers repeated samples on the same endpoint, which is where the Residual coverage gap: the |
|
🤖 Starting review — findings will be posted here when done. |
| 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]. |
There was a problem hiding this comment.
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.
| } | ||
|
|
||
| if (!ucp_ep_config_is_equal(&key, &ucp_ep_config(ep)->key)) { | ||
| ++worker->epoch; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
| uint32_t flush_rkey_hi; | ||
| ucs_status_t status; | ||
|
|
||
| addr_length = UCS_PARAM_VALUE( |
There was a problem hiding this comment.
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.
| return NULL; | ||
| } | ||
|
|
||
| enum { |
There was a problem hiding this comment.
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.
| 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 */ |
There was a problem hiding this comment.
minor: field name is off the column used by the rest of the struct (docs/CodeStyle.md: "indent structure fields on column").
| uct_ppn_bandwidth_t path_bandwidth; /* Cached destination/lane sample */ | |
| uct_ppn_bandwidth_t path_bandwidth; /* Cached destination/lane sample */ |
|
🤖 Starting review — findings will be posted here when done. |
| } | ||
|
|
||
| if (!ucp_ep_config_is_equal(&key, &ucp_ep_config(ep)->key)) { | ||
| ++worker->epoch; |
There was a problem hiding this comment.
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.
| continue; | ||
| } | ||
|
|
||
| ucs_info("dlb_ucp_path_sample ep %p lane %u bandwidth " |
There was a problem hiding this comment.
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.
| 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]. |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
| uint32_t flush_rkey_hi; | ||
| ucs_status_t status; | ||
|
|
||
| addr_length = UCS_PARAM_VALUE( |
There was a problem hiding this comment.
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?
| [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", |
There was a problem hiding this comment.
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.
| uct_rc_mlx5_iface_common_t super; | ||
| } uct_rc_mlx5_iface_t; | ||
|
|
||
| static ucs_status_t uct_rc_mlx5_iface_init_base( |
There was a problem hiding this comment.
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.
| 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; |
There was a problem hiding this comment.
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.
| * initialization. | ||
| */ | ||
| uint64_t features; | ||
|
|
There was a problem hiding this comment.
minor: pls drop the stray blank line and the UCT_EVENT_SPEED_CHANGE comment reword — unrelated edits in the public header.
|
Residual coverage gaps: Residual coverage gap: No test covers legacy Residual coverage gap: No test asserts that a per-endpoint bandwidth sample does not invalidate protocol selection for unrelated endpoints/rkey configs ( Note on submission: |
|
🤖 Starting review — findings will be posted here when done. |
| 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 */ |
There was a problem hiding this comment.
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?
| 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) |
There was a problem hiding this comment.
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.
| 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) |
There was a problem hiding this comment.
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.
| 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 ? |
There was a problem hiding this comment.
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?
| double ratio; | ||
|
|
||
| /* A measured path rate already includes sharing with other paths. */ | ||
| if ((params->ep_config_key->lanes[lane].path_bandwidth.dedicated + |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
| 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.
| 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 + |
There was a problem hiding this comment.
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.
| /* 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) |
There was a problem hiding this comment.
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?
| * @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( |
There was a problem hiding this comment.
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.
| return uct_rc_mlx5_iface_progress(arg, UCT_IB_MLX5_POLL_FLAG_HAS_EP); | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
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.
|
Residual coverage gaps: No test for the UCT pieces ( The |
|
🤖 Starting review — findings will be posted here when done. |
|
🤖 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), |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
| uct_invoke_completion(op->user_comp, UCS_ERR_CANCELED); | |
| uct_invoke_completion(op->user_comp, status); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
| 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); |
There was a problem hiding this comment.
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.
| tl_md, worker, params, &config->super.super, | ||
| &config->rc_mlx5_common, &init_attr); | ||
|
|
||
| self->super.ext_ops = ext_ops; |
There was a problem hiding this comment.
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).
|
|
||
| err_destroy_tm_qp: | ||
| uct_ib_mlx5_destroy_qp(md, &self->tm_qp); | ||
| if (UCT_RC_MLX5_TM_ENABLED(iface)) { |
There was a problem hiding this comment.
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.
| if (UCT_RC_MLX5_TM_ENABLED(iface)) { | |
| uct_ib_mlx5_destroy_qp(md, &self->tm_qp); |
| 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; |
There was a problem hiding this comment.
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.
| 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 */ |
| 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 & |
There was a problem hiding this comment.
Use the existing param macro: minor — pls use UCS_PARAM_VALUE() here, like the other optional-param accessors in this file.
| 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); |
|
Residual coverage gap: Residual coverage gap: |
|
🤖 Starting review — findings will be posted here when done. |
| } | ||
|
|
||
| if (!delivered) { | ||
| if (!delivered && !uct_rc_mlx5_ep_is_cancel_on_purge_wqe(ep, pi)) { |
There was a problem hiding this comment.
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.
| tl_md, worker, params, &config->super.super, | ||
| &config->rc_mlx5_common, &init_attr); | ||
|
|
||
| self->super.ext_ops = ext_ops; |
There was a problem hiding this comment.
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) && |
There was a problem hiding this comment.
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.
|
|
||
| err_destroy_tm_qp: | ||
| uct_ib_mlx5_destroy_qp(md, &self->tm_qp); | ||
| if (UCT_RC_MLX5_TM_ENABLED(iface)) { |
There was a problem hiding this comment.
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?
| 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); |
There was a problem hiding this comment.
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.
| 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; |
There was a problem hiding this comment.
| 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.
|
🤖 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) { |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
| */ | ||
| typedef struct uct_rc_mlx5_base_ep { | ||
| uct_rc_ep_t super; | ||
| void *ext_ctx; |
There was a problem hiding this comment.
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.
| 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); |
There was a problem hiding this comment.
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.
| /* 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), |
There was a problem hiding this comment.
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.
| 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; |
There was a problem hiding this comment.
minor: pls document and align these like the neighbouring fields; also better placed after err_handler_flags, so the err_handler* fields stay together.
| 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 */ |
|
|
||
| ucs_trace_func("async_cb for iface=%p flags=%u", wiface->iface, flags); | ||
|
|
||
| if (flags & UCT_EVENT_PROGRESS) { |
There was a problem hiding this comment.
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.
|
Residual coverage gaps: there is still no in-tree producer of |
|
🤖 Starting review — findings will be posted here when done. |
| ucs_trace_func("async_cb for iface=%p flags=%u", wiface->iface, flags); | ||
|
|
||
| if (flags & UCT_EVENT_PROGRESS) { | ||
| ucp_worker_signal_internal(wiface->worker); |
There was a problem hiding this comment.
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?
| 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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
| /* 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), |
There was a problem hiding this comment.
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 */ |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
minor: this breaks the = alignment of the rest of the ops table.
|
Residual coverage gap: there is still no in-tree producer of The The |
|
🤖 CI Triage Agent — TL;DR: The ASAN/roce gtest run failed on a single test, Full analysisSummary: Root cause: Evidence from the log: the only failure is 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, 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 Related: PR #12162 (this PR), PR #12265 (atomic MR offset without flush mkey — last change to the DM/atomic-key path)
|
| { | ||
| uct_base_iface_t *iface = ucs_derived_of(tl_iface, uct_base_iface_t); | ||
|
|
||
| iface->ep_event_cb = params->cb; |
There was a problem hiding this comment.
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)
| 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; |
There was a problem hiding this comment.
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?
|
🤖 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, |
There was a problem hiding this comment.
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.
| ucs_trace_func("async_cb for iface=%p flags=%u", wiface->iface, flags); | ||
|
|
||
| if (flags & UCT_EVENT_PROGRESS) { | ||
| ucp_worker_signal_internal(wiface->worker); |
There was a problem hiding this comment.
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?
| 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); |
There was a problem hiding this comment.
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 */ |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
good to go, and we discussed that comments of bot could be addressed in the folow-up PR
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.