Repository navigation
Conversation
|
🤖 Starting review — findings will be posted here when done. |
| { | ||
| ucp_request_t *req = ucs_container_of(self, ucp_request_t, send.uct); | ||
|
|
||
| if (ucs_unlikely(ucp_ep_config(req->send.ep)->key.err_mode == |
There was a problem hiding this comment.
put/sgl/offload is not probed at all when err_mode is FAILOVER: ucp_proto_multi_check_params() → ucp_proto_common_init_check_err_handling() requires UCP_PROTO_COMMON_INIT_FLAG_FAILOVER, and ucp_proto_put_sgl_offload_probe() passes extra_flags=0, so this branch is dead and SGL puts keep falling back to put/sgl/contig. pls add the flag in the probe and pick the repost send_func there, instead of re-checking err_mode on every progress call.
| ucp_request_invoke_uct_completion_success, | ||
| ucp_proto_request_zcopy_completion); | ||
| } | ||
| static ucs_status_t ucp_proto_put_sgl_offload_progress(uct_pending_req_t *self) |
There was a problem hiding this comment.
minor: 1 blank line between functions (docs/CodeStyle.md).
| static ucs_status_t ucp_proto_put_sgl_offload_progress(uct_pending_req_t *self) | |
| static ucs_status_t ucp_proto_put_sgl_offload_progress(uct_pending_req_t *self) |
| ucs_mpool_params_t params; | ||
| ucs_status_t status; | ||
|
|
||
| if (ucs_unlikely(!(worker->flags & |
There was a problem hiding this comment.
pls init this mpool in ucp_worker_init_mpools() next to reg_mp/rkey_mp; lazy init from the send path is inconsistent with the other worker pools and adds a check on every post.
| /* Keep logical element identity until a native SGL batch is completed. | ||
| * NULL indices denotes consecutive elements starting at the iterator offset; | ||
| * otherwise count is at most UCP_MAX_IOV and indices is copied. */ | ||
| uct_completion_t *ucp_proto_repost_sgl_completion(ucp_request_t *origin, |
There was a problem hiding this comment.
outside proto_repost.c these two are used only by gtest — can we keep them static and cover the batch through ucp_proto_repost_submit()? docs/CodeStyle.md requires static for single-file functions.
| batch = ucs_container_of(comp, ucp_proto_repost_sgl_t, comp); | ||
| if (!(info->field_mask & UCT_EP_OP_INFO_FIELD_SGL_INDEX) || | ||
| (info->sgl_index >= batch->count)) { | ||
| return UCS_ERR_INVALID_PARAM; |
There was a problem hiding this comment.
pls log the reason before returning UCS_ERR_INVALID_PARAM here (and in the other reject paths); otherwise a replay mismatch fails the user's RMA with no trace.
| select_param.mem_type = UCS_MEMORY_TYPE_HOST; | ||
| select_param.sg_count = 1; | ||
| ucp_memory_info_set_host(&mem_info); | ||
| ucp_proto_select_param_init(&select_param, UCP_OP_ID_REPOST, 0, 0, |
There was a problem hiding this comment.
minor: this hunk is unrelated to SGL repost and changes the selection key (sys_dev becomes UNKNOWN, mem_flags gets REGISTRABLE) — pls move it to a separate PR.
| if (status == UCS_OK) { | ||
| if (sgl_op != NULL) { | ||
| info.field_mask |= UCT_EP_OP_INFO_FIELD_SGL_INDEX; | ||
| info.sgl_index = (uint16_t)(pi - sgl_op->sn); |
There was a problem hiding this comment.
pi - sgl_op->sn is a WQE/BB delta; it equals the element index only because every SGL element WQE is exactly one BB. pls add an assert (or a comment) so a future WQE layout change does not silently shift the index.
| UCP_INSTANTIATE_TEST_CASE_TLS_GPU_AWARE(test_ucp_rma_sgl_data, tcp, "tcp") | ||
|
|
||
| /* Exercise replay independently of SGL failover protocol selection. */ | ||
| class test_ucp_rma_sgl_repost : public test_ucp_rma_sgl { |
There was a problem hiding this comment.
this class patches global iface->ops/internal_ops, fabricates ucp_request_t on the stack and clears memh/rkey md_map for ~20 internal cases, so it breaks on any refactor of the repost internals. pls keep the cases reachable through the real failover flow (like test_ucp_rma_sgl_failover) and drop the white-box ones.
|
PR-level (REQUEST_CHANGES): ~1300 added lines spanning the UCT purge API, rc_mlx5 purge parsing, the UCP repost protocol and two large gtest suites — above the 500-line limit, pls split (UCT Residual coverage gap: nothing exercises the new Residual coverage gap: GET SGL purge support is added in rc_mlx5 but there is no UCP Residual coverage gap: the mid-batch/ |
|
🤖 CI Triage Agent — TL;DR: The gtest Full analysisSummary: Azure job "althca on worker 2" (build 146558) failed: Root cause: Re-entrant pending purge during pending dispatch. The backtrace shows a single nested call chain:
At step 3 Implicated commit: unknown — not conclusively attributable from the log; the counter logic is pre-existing. Most recent change to this accounting is File: src/ucp/wireup/wireup_ep.c:224 (assert); real defect at src/ucp/wireup/wireup_ep.c:114-127 ( Suggested fix: Make the proxy-request accounting valid across re-entrancy:
This test is a flaky-but-real abort; rerunning will hide it, so it should be fixed rather than retried. Related: none found (no existing issue/PR matches this assertion); nearest context PRs: #11988, #12360, #12274. |
|
🤖 Starting review — findings will be posted here when done. |
| } | ||
|
|
||
| rkey = ucp_proto_repost_origin_rkey(origin); | ||
| if (origin->send.state.dt_iter.dt_class == UCP_DATATYPE_SGL) { |
There was a problem hiding this comment.
ucp_proto_repost_tl_rkey() is also called for PUT_SHORT/PUT_BCOPY/GET_BCOPY, but ucp_proto_repost_sgl_index()/ucp_proto_repost_sgl_contains() read info->rma.payload.zcopy.iov unconditionally, which is a different member of the rma.payload union for those ops. pls also require info->operation to be PUT_ZCOPY/GET_ZCOPY before taking this branch, so it cannot dereference a garbage iov if an SGL origin ever reports a non-zcopy fragment.
| { | ||
| ucp_request_t *req = ucs_container_of(self, ucp_request_t, send.uct); | ||
|
|
||
| if (ucs_unlikely(ucp_ep_config(req->send.ep)->key.err_mode == |
There was a problem hiding this comment.
err_mode is part of ep_config_key and is already resolved at probe time for every other protocol (ucp_proto_common_init_check_err_handling). why not register the repost variant as its own proto (or store the send func in the priv) instead of branching on err_mode in every progress call?
| status = uct_rc_mlx5_op_info_fill(iface, ep, txwq, pi, sgl_op, ctrl, | ||
| wqe_size, &callback_data, &info); | ||
| if (status == UCS_OK) { | ||
| if (sgl_op != NULL) { |
There was a problem hiding this comment.
minor: two adjacent checks of the same condition.
| if (sgl_op != NULL) { | |
| if (sgl_op != NULL) { | |
| /* Each SGL element occupies one BB. Preserve this contract | |
| * when changing the batch WQE layout. */ | |
| ucs_assert(wqe_size <= MLX5_SEND_WQE_BB); | |
| info.field_mask |= UCT_EP_OP_INFO_FIELD_SGL_INDEX; | |
| info.sgl_index = (uint16_t)(pi - sgl_op->sn); | |
| /* The original reference keeps the SGL alive even when a | |
| * replay callback completes a fragment synchronously. */ | |
| if (sgl_op->user_comp != NULL) { | |
| ++sgl_op->user_comp->count; | |
| } | |
| } |
| } | ||
| } | ||
|
|
||
| unsigned m_errors = 0; |
There was a problem hiding this comment.
m_errors hides ucs::test_base::m_errors (the captured error-message vector used by num_errors() and by other tests in this file), pls rename to avoid the collision.
| unsigned m_errors = 0; | |
| unsigned m_num_ep_errors = 0; |
| } atomic; | ||
| }; | ||
|
|
||
| /** |
There was a problem hiding this comment.
minor: pls use @ref UCT_EP_OP_INFO_FIELD_SGL_INDEX like the neighbouring fields, and add this field to the per-operation field list above (PUT_ZCOPY and GET_ZCOPY: ...) — otherwise there is no indication in the API docs that a transport may report it.
| const ucp_proto_repost_priv_t *rpriv = req->send.proto_config->priv; | ||
| const uct_ep_op_info_t *info = req->send.repost.info; | ||
| uct_rkey_t tl_rkey = UCT_INVALID_RKEY; | ||
| size_t sgl_index = 0; |
There was a problem hiding this comment.
minor: = should align with the lines above (docs/CodeStyle.md: "the longest left-hand side gets one space before =, others align to it"); same for the &sgl_index continuation line at 662, which is one column past the opening paren.
| size_t sgl_index = 0; | |
| size_t sgl_index = 0; |
|
Notes on what I checked and did not report:
|
|
🤖 Starting review — findings will be posted here when done. |
| }; | ||
|
|
||
| virtual const char *get_protos() const { | ||
| return "put/sgl/offload,reconfig"; |
There was a problem hiding this comment.
blocker: PROTOS is an allow-list, so this disables the repost protocol and ucp_proto_repost_submit() fails with UCS_ERR_UNREACHABLE — token-mode replay can never succeed here.
| return "put/sgl/offload,reconfig"; | |
| return "put/sgl/offload,repost,reconfig"; |
| if (sgl_op != NULL) { | ||
| /* Each SGL element occupies one BB. Preserve this contract | ||
| * when changing the batch WQE layout. */ | ||
| ucs_assert(wqe_size <= MLX5_SEND_WQE_BB); |
There was a problem hiding this comment.
pls use ucs_assertv_always() like the other WQE-parsing invariants in this file; in a release build a layout change would silently map sgl_index to the wrong element and replay it to the wrong remote address.
| ucs_assert(wqe_size <= MLX5_SEND_WQE_BB); | |
| ucs_assertv_always(wqe_size <= MLX5_SEND_WQE_BB, | |
| "wqe_size=%zu", wqe_size); |
| * - PUT_ZCOPY and GET_ZCOPY: @ref UCT_EP_OP_INFO_FIELD_RMA with @a rma.field_mask = | ||
| * @ref UCT_EP_OP_INFO_RMA_FIELD_REMOTE_ADDR | | ||
| * @ref UCT_EP_OP_INFO_RMA_FIELD_RKEY | @ref UCT_EP_OP_INFO_RMA_FIELD_PAYLOAD_ZCOPY. | ||
| * @ref UCT_EP_OP_INFO_FIELD_SGL_INDEX optionally identifies the element |
There was a problem hiding this comment.
pls also document the completion ownership here: with an SGL batch the callback gets one reference on @a comp per reported element and the transport releases its own. A consumer that completes @a comp once per batch, as it would for a single operation, leaves the count unbalanced.
| return UCS_ERR_INVALID_PARAM; | ||
| } | ||
| index = (batch->first_index != SIZE_MAX) ? | ||
| batch->first_index + info->sgl_index : |
There was a problem hiding this comment.
how can we be sure sgl_index holds the correct value? uct, psn?
There was a problem hiding this comment.
maybe repost the whole sgl?
| @@ -2415,6 +2416,11 @@ static ucs_status_t ucp_worker_init_mpools(ucp_worker_h worker) | |||
| goto err_rkey_mp_cleanup; | |||
| } | |||
|
|
|||
| status = ucp_proto_repost_init_mpool(worker); | |||
There was a problem hiding this comment.
why do we need an mpool here? is it reg'ed? maybe malloc?
|
🤖 CI Triage Agent — TL;DR: The ASAN GPU gtest run failed because two of the PR's own new tests — Full analysisSummary: Root cause: From the job log:
Implicated commit: File: Suggested fix:
Related: PR #12404 (this PR); related SGL/failover work: #12379, #12191, #11871. |
|
🤖 Starting review — findings will be posted here when done. |
|
|
||
| ucp_trace_req(req, "flush restart"); | ||
| ucs_assert(req->send.flush.sw_state == UCP_FLUSH_SW_STATE_RESTART_PENDING); | ||
| if (ucp_ep_flush_defer_recovery(req)) { |
There was a problem hiding this comment.
this re-arms the oneshot and signals the worker on every progress iteration until recovery ends, so a worker blocked in ucp_worker_wait() spins for the whole recovery (up to RECOVERY_RETRIES × keepalive interval). ucp_ep_flush_defer_recovery() calls ucp_ep_flush_schedule_restart(), which re-adds the one-shot callback and calls ucp_worker_signal_internal(); the pre-existing ucp_ep_flush_request_resched() pattern re-arms but does not signal. Can we schedule the restart once from the recovery completion path, or at least skip ucp_worker_signal_internal() when only re-deferring?
| { | ||
| if ((req->flags & UCP_REQUEST_FLAG_PROTO_INITIALIZED) && | ||
| (req->send.state.uct_comp.count != 0) && | ||
| ucp_ep_err_mode_eq(req->send.ep, UCP_ERR_HANDLING_MODE_FAILOVER)) { |
There was a problem hiding this comment.
why is the deferral restricted to failover mode? the wireup replay path (ucp_wireup_replay_pending_requests() → ucp_proto_request_restart()) restarts pending requests in other modes too (CM lane / UCX_PROTO_REQUEST_RESET=y), and there the ucp_ep_err_mode_eq() guard makes the function fall through to ucp_proto_offload_zcopy_reset(), which deregisters the SGL memory and rewinds dt_iter while posted batches may still reference it.
| /* Model a posted batch whose completion arrives after recovery. */ | ||
| ++req->send.state.uct_comp.count; | ||
| auto *memhs = req->send.state.dt_iter.type.sgl.memhs; | ||
| uct_ep_pending_purge(ucp_ep_get_lane(ep, req->send.lane), |
There was a problem hiding this comment.
pls assert the request is really pending before this, e.g. ASSERT_NE(UCP_NULL_LANE, req->send.lane); otherwise ucp_ep_get_lane() reads out of the lanes array when the request was fully posted. ucp_proto_multi_request_init() sets req->send.lane = UCP_NULL_LANE under ENABLE_ASSERT, so a fully posted request hits ucs_assertv(lane_index < UCP_MAX_LANES) in debug and reads out of bounds in release.
| auto lanes = get_lanes(TEST_OP_PUT); | ||
| auto mem_type = static_cast<ucs_memory_type_t>(get_variant_value(1)); | ||
| sgl_ctx ctx; | ||
| std::vector<size_t> sizes = pending ? std::vector<size_t>(2048, 4096) : |
There was a problem hiding this comment.
minor: 2048 elements means ~4k buffer allocations + registrations per instance (plus rkey pack/unpack per element, for 3 of the 4 scenarios, and also for CUDA). a few hundred elements should already exceed the QP length and leave the request pending.
| unsigned ep_init_flags, | ||
| ucp_worker_cfg_index_t *cfg_index_p); | ||
|
|
||
| ucs_status_t ucp_worker_reconfigure_rkey(ucp_worker_h worker, |
There was a problem hiding this comment.
minor: continuation lines are off by one space — indented to column 40 instead of 41, i.e. not aligned on the open parenthesis as required by docs/CodeStyle.md ("Indent function arguments on column"):
| ucs_status_t ucp_worker_reconfigure_rkey(ucp_worker_h worker, | |
| ucs_status_t ucp_worker_reconfigure_rkey(ucp_worker_h worker, | |
| ucp_worker_cfg_index_t rkey_cfg_index, | |
| ucp_worker_cfg_index_t ep_cfg_index, | |
| ucp_worker_cfg_index_t *new_cfg_index); |
same for the definition in ucp_worker.c (and pls keep a single blank line between functions there).
|
Residual coverage gaps: the early-return path of |
|
🤖 CI Triage Agent — TL;DR: The BlueField gtest shard aborted on a debug assertion in Full analysisSummary: Root cause: The test performs Implicated commit: [REDACTED:Hex High Entropy String] — Leonid Genkin, "UCP/RMA: Restart the original SGL request on failover" (PR #12404); invariant originally added in 7561177 / 15c3ed9 (Evgeny Leksikov) File: src/ucp/rma/flush.c:428-440 (assert fires at src/ucp/rma/flush.c:431); triggered from src/ucp/wireup/wireup.c:2059 and src/ucp/wireup/wireup.c:2068 Suggested fix: Make the failover mode take the relaxed path in if (ucp_ep_err_mode_eq(ep, UCP_ERR_HANDLING_MODE_FAILOVER)) {
/* Recovery switches lanes one at a time, so a flush may already be
* started on the remaining live lanes. */
ucs_assertv(!(UCS_BIT(req->send.lane) & req->send.flush.started_lanes),
"req=%p lane=%d started_lanes=0x%" PRIx64, req,
req->send.lane, req->send.flush.started_lanes);
ucp_ep_flush_assert_started_p2p(ep, req);
} else if (ucp_ep_has_cm_lane(ep) || (...proto_request_reset...)) {
ucs_assertv(!req->send.flush.started_lanes, ...);
} else {
...
}This is exactly what PR #12389 does; rebase this PR on it (or cherry-pick it) and re-run the BlueField job. Keep the Related: #12389 (fix: "UCP/FLUSH: Allow started lanes on failover resched with request reset"), #12404 (this PR), #11210, #12274
|
|
🤖 Starting review — findings will be posted here when done. |
| static ucs_status_t ucp_proto_put_sgl_offload_reset(ucp_request_t *req) | ||
| { | ||
| if ((req->flags & UCP_REQUEST_FLAG_PROTO_INITIALIZED) && | ||
| (req->send.state.uct_comp.count != 0)) { |
There was a problem hiding this comment.
how do we know the posting reference is still held here? count != 0 is also true after the last fragment was posted (the extra ref is dropped by ucp_request_invoke_uct_completion_success()), and in that state this drops a reference we don't own and would complete the request while batches are still in flight. pls add an assertion for this invariant.
|
|
||
| static void ucp_ep_flush_schedule_restart(ucp_request_t *req) | ||
| { | ||
| int signal = req->send.flush.sw_state != UCP_FLUSH_SW_STATE_RESTART_PENDING; |
There was a problem hiding this comment.
when we re-arm from ucp_ep_flush_failover_oneshot_cb() the state is already RESTART_PENDING, so no wakeup is sent. what wakes a worker blocked in ucp_worker_wait() to run the re-armed callback?
| UCP_DT_LOCAL_SGL_FIELD_BUFFERS); | ||
| sgl.lengths = sgl_array(ctx.lengths, ctx.null_local_arrays, | ||
| UCP_DT_LOCAL_SGL_FIELD_LENGTHS); | ||
| sgl.memhs = sgl_array(ctx.memhs, ctx.null_local_arrays, |
There was a problem hiding this comment.
minor: the moved helper sets memhs even when UCP_DT_LOCAL_SGL_FIELD_MEMHS is not in field_mask (the original had that guard), so tests that clear the flag no longer pass NULL. pls keep the guard.
| remote_addr, rkey, clear_param_mask, | ||
| null_remote, remote_count); | ||
| } | ||
|
|
There was a problem hiding this comment.
minor: pls remove the extra blank lines.
| }; |
|
Residual coverage gap: nothing exercises |
|
🤖 CI Triage Agent — TL;DR: The gtest Full analysisSummary: Root cause: Backtrace: Implicated commit: 2740aca "UCP/RMA: Harden SGL restart and CUDA failover coverage" (Leonid Genkin) adds the exposing test; the faulty assertion comes from the failover flush work on File: src/ucp/rma/flush.c:435 (triggered via src/ucp/wireup/wireup.c:2059, test at test/gtest/ucp/test_ucp_fault_tolerance.cc:1795/1694) Suggested fix: Make the |
Preserve original element identity across native SGL batch purge and
replay. Resolve its rkey and memory handle on the surviving MDs and
reconstruct the logical remote address from the fragment offset.
Add failing-then-passing regressions for incorrect element keys, stale
memory handles, overlapping ranges and transport-adjusted addresses.
Verify host and CUDA replay with actual QP failures.