Skip to content

UCT/IB/MLX5: Fix put_sgl_zcopy completion - #11893

Merged
evgeny-leksikov merged 2 commits into
openucx:masterfrom
jeynmann:sgl_zcopy_last_wqe_comp
Sep 7, 2026
Merged

evgeny-leksikov merged 2 commits into
openucx:masterfrom
jeynmann:sgl_zcopy_last_wqe_comp

Conversation

@jeynmann

@jeynmann jeynmann commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

What?

Associate the completion with the last WQE in an SGL PUT so partial recovery cannot complete the operation prematurely.

Why?

During FT, comp could called before all WQEs consumed, since it's associated with 1st WQE.

How?

Remove the unrelated RDMA read resource check from the PUT path.

Associate the completion with the last WQE in an SGL PUT so partial recovery cannot complete the operation prematurely. Remove the unrelated RDMA read resource check from the PUT path.
@svc-nvidia-pr-review

Copy link
Copy Markdown

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

uct_rc_ep_send_op_completion_handler, comp, sn,
UCT_RC_IFACE_SEND_OP_FLAG_ZCOPY, NULL, 0, total);
uct_rc_ep_send_op_completion_handler, comp,
txwq->sig_pi, UCT_RC_IFACE_SEND_OP_FLAG_ZCOPY,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Change 1 — sn → txwq->sig_pi in uct_rc_txqp_add_send_comp: Correct and an improvement. Only the last WQE in the batch carries MLX5_WQE_CTRL_CQ_UPDATE, and its completion reports hw_ci = ntohs(cqe->wqe_counter) equal to that WQE's first BB index (prev_sw_pi after the loop). txwq->sig_pi is set to exactly txwq->prev_sw_pi, so UCS_CIRCULAR_COMPARE16(sig_pi, <=, hw_ci) matches on the right CQE. This aligns the SGL path with the signaled-PI convention used by uct_rc_mlx5_common_post_send, _flush, and _post_check. Removing the now-unused sn local is clean.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage note: there is no test change in the diff. Since this touches completion-PI matching and a resource-check removal, confirm existing put_sgl_zcopy coverage (the extended/plugin path plus any RC mlx5 SGL tests) exercises multi-element batches and the no-resource path; if not, a focused regression test on multi-element completion and the pending/ordering case would be warranted.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Resolved
@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_ep.c Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage note: The diff contains no test change. This is a completion-PI semantics change on the SGL zcopy path. Existing coverage exists in test/gtest/uct/v2/test_uct_sgl.cc (and the cuda_ipc device test), which exercise uct_ep_put_sgl_zcopy. Worth confirming those tests run multi-element batches with completion callbacks against the RC mlx5 path so the sig_pi-based completion is actually exercised; if the gtest only covers single-element or the plugin/ext path, the base multi-WQE completion change would be untested.

@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_ep.c Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Completion PI change looks correct: switching the completion sn from sw_pi (start-of-batch PI) to txwq->sig_pi (the PI of the last, signaled WQE, S + count - 1) matches the canonical convention already used by the flush and DC paths, and it is the value the CQE's wqe_counter reports for the batch's single signaled WQE, so the completion fires exactly on that CQE. sig_pi is copied by value into op->sn, so a later post overwriting txwq->sig_pi cannot affect an already-queued op. No issue here.

Residual coverage note: the diff contains no test change. This is a completion-PI semantics change plus a resource-check edit on the multi-WQE put_sgl_zcopy path. Existing coverage in test/gtest/uct/v2/test_uct_sgl.cc (and the cuda_ipc device test) exercises uct_ep_put_sgl_zcopy; it is worth confirming those tests run multi-element batches with a completion callback against the RC mlx5 base path so the sig_pi-based completion is actually exercised end to end. If the gtest only covers single-element or the plugin/ext path, the multi-WQE completion change stays untested.

@jeynmann
jeynmann force-pushed the sgl_zcopy_last_wqe_comp branch from bf497a0 to 022ed4a Compare September 4, 2026 04:20
@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_ep.c Resolved
Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage note (already raised previously): the diff still contains no test change for the multi-WQE sig_pi completion path.

@jeynmann
jeynmann force-pushed the sgl_zcopy_last_wqe_comp branch from 022ed4a to 48aa836 Compare September 4, 2026 04:23
@jeynmann
jeynmann force-pushed the sgl_zcopy_last_wqe_comp branch from 48aa836 to cec4aa2 Compare September 4, 2026 04:25
@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

🤖 Review complete — no issues found.

@evgeny-leksikov
evgeny-leksikov merged commit 1a08384 into openucx:master Sep 7, 2026
162 checks passed
@jeynmann
jeynmann deleted the sgl_zcopy_last_wqe_comp branch September 7, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants