Skip to content

UCT/IB/MLX5: Save the transmit range inside outstanding purge - #12033

Merged
gleon99 merged 9 commits into
openucx:masterfrom
evgeny-leksikov:uct_tf_purge_live_ep
Oct 14, 2026
Merged

gleon99 merged 9 commits into
openucx:masterfrom
evgeny-leksikov:uct_tf_purge_live_ep

Conversation

@evgeny-leksikov

Copy link
Copy Markdown
Contributor

What?

Save the transmit range inside outstanding purge on live EP and invalidate

Why?

Simplify token based failover state machine in UCP

How?

Purge moves the queue pair to error and records the outstanding range before walking it, so a later completion does not finish those operations again. An idle queue returns success.

@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 Resolved
Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Resolved
Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Resolved
Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Resolved
Comment thread src/uct/api/v2/uct_v2.h Resolved
Comment thread NEWS Resolved
Comment thread test/gtest/uct/test_peer_failure.cc Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

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

@evgeny-leksikov
evgeny-leksikov marked this pull request as draft October 6, 2026 13:39
Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Resolved
Comment thread src/uct/ib/mlx5/rc/rc_mlx5_iface.c Resolved
Comment thread NEWS Resolved
Comment thread src/uct/api/v2/uct_v2.h Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage gap: there is no test for purge-before-error after TX completions have landed but not been polled (exactly the case in finding 1), and no pre-error coverage for am_short/put_bcopy; only put_zcopy is exercised.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Purge moves the queue pair to error and records the outstanding range before walking it, so a later completion does not finish those operations again. An idle queue returns success.
A live outstanding purge was releasing every credit up to the last posted work request, so a success completion still on the queue moved the counter backward. Leave those credits for the completion poll, which applies an earlier success before the error completion.
@svc-nvidia-pr-review

Copy link
Copy Markdown

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

@evgeny-leksikov
evgeny-leksikov marked this pull request as ready for review October 6, 2026 16:53
@svc-ucx

svc-ucx commented Oct 6, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Tests roce on worker 0) · commit 1681e65b

TL;DR: The roce on worker 0 gtest run failed on a single unrelated test, ib/test_md.alloc/1 (mlx5_1), which is a device-memory allocation stress test that trips an EXPECT_LT(... < 0.5) "Too many OUT_OF_RESOURCE failures" / allocation-status assertion under resource pressure — it is not touched by PR #12033's RC/mlx5 purge changes, so this is environmental/flaky and should be re-run (and the test's failure accounting fixed).

Full analysis

Summary: make test in the gtest stage exited with code 2 because 1 of 8874 tests failed: ib/test_md.alloc/1, where GetParam() = mlx5_1. All other tests passed.

Root cause: Evidence from the log: the entire suite passed except ib/test_md.alloc/1, and the failure report appears only in the gtest tear-down summary ([ FAILED ] 1 test, listed below: ib/test_md.alloc/1) with no crash, no timeout, and no sanitizer/assert output anywhere else. test_md.alloc (test/gtest/uct/test_md.cc:413-496) is a 300-iteration randomized allocation loop over every bit in md_attr().alloc_mem_types. For an mlx5 MD this includes device memory (MEMIC/DM) in addition to host, and the loop is tolerant of UCS_ERR_NO_MEMORY only up to a 50% failure ratio (EXPECT_LT((double)num_alloc_failures / iterations, 0.5), line 493). Two structural weaknesses make this test flaky on a shared CI worker: (1) num_alloc_failures is declared outside the ucs_for_each_bit(mem_type, ...) loop (line 418) and is never reset per memory type, so failures from the scarce device-memory pass accumulate and are re-checked against every subsequent memory type; (2) device memory on the HCA is a small, globally shared resource — concurrent gtest workers on the same mlx5_1 device exhaust it, and any status other than UCS_ERR_NO_MEMORY (e.g. UCS_ERR_NO_RESOURCE/UCS_ERR_NO_DEVICE from a DM allocation) skips the tolerance branch at line 465 entirely and falls straight into EXPECT_GT(mem.length, 0ul) / ASSERT_UCS_OK(status) on an uninitialized mem. Nothing in PR #12033 (UCT/IB/MLX5: Save the transmit range inside outstanding purge, plus commit 1681e65 Apply transmit credits in completion order) touches the memory-domain allocation or mkey-pack path — those commits only modify src/uct/ib/mlx5/rc/rc_mlx5_ep.c TX/purge logic, which test_md never exercises (it opens an MD directly and never creates an endpoint).

Implicated commit: none — the PR head commits are 1681e65 (Evgeny Leksikov, UCT/IB/MLX5: Apply transmit credits in completion order) and 1f0a1dd (Evgeny Leksikov, Save the transmit range inside outstanding purge), both confined to rc_mlx5_ep.c TX/purge code and unrelated to the failing MD allocation test. The flakiness predates this PR.

File: test/gtest/uct/test_md.cc:418 (un-reset num_alloc_failures) and test/gtest/uct/test_md.cc:465 (only UCS_ERR_NO_MEMORY is tolerated)

Suggested fix: Re-trigger the roce on worker 0 job — this failure is not caused by the PR. To stop the recurring flake, harden test_md.alloc: (1) move unsigned num_alloc_failures = 0; inside the ucs_for_each_bit(mem_type, ...) loop so the ratio check at line 493 is per-memory-type rather than cumulative; (2) broaden the tolerance branch at line 465 to also accept UCS_ERR_NO_RESOURCE and UCS_ERR_NO_DEVICE (e.g. if (UCS_STATUS_IS_ERR(status) && (status == UCS_ERR_NO_MEMORY || status == UCS_ERR_NO_RESOURCE))) and continue before touching mem, since mem is left uninitialized on any failure yet is read at line 471 before ASSERT_UCS_OK(status) at line 475 — reorder those two lines so the status is asserted first. Optionally skip the device-memory (UCS_MEMORY_TYPE_RDMA) pass when another worker may hold the HCA's DM, as device memory is a tiny shared resource on mlx5_1.

Related: PR #12033 (this PR); the ignore_alloc_failure_log_handler added at test_md.cc:394 already suppresses "failed to allocate"/"exceeds maximal supported size" logs, confirming allocation failure is a known, expected condition in this test.

Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Resolved
Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Resolved
Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Resolved
A rejected token must leave the endpoint usable.
Posted pending requests stay scheduled and must be removed first.
@svc-ucx

svc-ucx commented Oct 9, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR · commit 49c097d6

TL;DR: The build failed on a single unrelated gtest, mt/test_profile.log/0 (8748/8749 passed); this UCS profiling test is inherently racy when other threads in the gtest process emit profile records while UCX_PROFILE_MODE is globally enabled, and it has nothing to do with the PR's UCT purge changes — re-run the job, and harden the test to validate only its own thread IDs.

Full analysis

Summary: make test in the Run ./contrib/test_jenkins.sh step exited with code 2 because exactly one test failed: mt/test_profile.log/0 (GetParam() = 2, i.e. 2 threads, log profile mode). All other 8748 tests passed.

Root cause: Evidence from the log: the test binary ran the full 8749-test suite to completion (3393515 ms total) with continuous activity and no hang/timeout; the only failure is mt/test_profile.log/0. The PR branch (uct_tf_purge_live_ep, PR #12033) touches UCT transport endpoint-purge code, which test/gtest/ucs/test_profile.cc does not exercise at all — it only calls locally defined profile_test_func1/2 helpers. src/ucs/profile/profile.c and test_profile.cc have not been modified since commit 5bf3df83 (Mar 2023), so this is not a regression from the PR.

The test itself is structurally fragile in its mt instantiations. scoped_profile enables profiling process-wide on ucs_profile_default_ctx (test_profile.cc:32-35), and ucs_profile_record() lazily registers a new thread context for any thread in the process that hits a UCS_PROFILE_*_ALWAYS instrumentation point (profile.c:594-597 → ucs_profile_thread_init). The gtest process is long-lived and shares state with previously run suites that spawn background progress/async threads (e.g. ud/test_ucp_tag_mt.send_recv, visible in the TOP-20 list). If any such thread is still alive and records even once during the window, the dumped file contains an extra thread block, which breaks the test's strict equalities: EXPECT_EQ(exp_num_records, thread_hdr->num_records) (test_profile.cc:265), EXPECT_EQ(num_threads(), profiled_threads) (:403), and EXPECT_EQ(&data[data.size()], ptr) (:407). Only the mt/ variants (which assume an exact thread count) are exposed to this; st/ is not.

Note: the fetched console tail is truncated before the individual EXPECT_* failure line, so the exact failing assertion is not visible — the diagnosis above is based on the single-test failure pattern, the test's design, and the absence of any related code change in this PR.

Implicated commit: unknown — not attributable to [REDACTED:Hex High Entropy String]; the profiling test/code was last touched by 5bf3df83 (Roie Danino, 2023-03-08), long before this PR.

File: test/gtest/ucs/test_profile.cc:403 (and :265, :407)

Suggested fix: Re-run the CI job — this failure is unrelated to PR #12033 and should not block it. To stop the recurring flakiness, make test_profile::do_test() tolerant of foreign thread contexts instead of assuming the file contains exactly num_threads() blocks: iterate all thread blocks in hdr->threads, skip any whose thread_hdr->tid is not in m_tids, and only apply the exp_num_records / exp_count / nesting checks to the test's own TIDs. Replace EXPECT_EQ(num_threads(), profiled_threads) with EXPECT_GE(...) (or compare against the count of matched TIDs) and relax the EXPECT_EQ(&data[data.size()], ptr) end-of-file check accordingly. Alternatively, run test_profile in an isolated gtest process (as is done for other process-global-state tests) so no leftover progress threads can pollute the dump.

Related: PR #12033 (this build); no existing issue found tracking test_profile mt flakiness — worth opening one.

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 84be55a1-56e0-4592-b06c-341f182d2a23 in the triage console for the audit trail.

Keep live outstanding purge ordering together with the RDMA_READ delivery check.
@svc-nvidia-pr-review

Copy link
Copy Markdown

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

@svc-ucx

svc-ucx commented Oct 9, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Tests roce on worker 0) · commit f6b7b187

TL;DR: The build was killed mid-compile because the Azure DevOps agent (agent-08) received a shutdown signal — an infrastructure/agent-lifecycle abort, not a test or code failure. Just re-run the pipeline; no source change is needed.

Full analysis

Summary: The "Tests roce on worker 0" job for PR #12033 was cancelled during ./contrib/test_jenkins.sh while still in the build phase (compiling test/apps/iodemo/io_demo.cc); it never reached the roce test execution.

Root cause: Infrastructure, not code. The log shows continuous compile activity with no gaps larger than a few seconds right up to the kill:

  • 11:59:38.52 – entering test/apps/iodemo, g++ compiling ucx_wrapper.cc / io_demo.cc
  • 11:59:33.31 – ##[error]The agent has received a shutdown signal. This can happen when the agent service is stopped, or a manually started agent is canceled.
  • 11:59:33.37 – ##[error]The Operation will be canceled. The next steps may not contain expected logs.
  • 11:59:43.43 – ##[error]The operation was canceled. followed by Start cleaning up orphan processes killing live make/g++/cc1plus (pids 3797798/3797802/3797809)

Because the orphan cleanup shows a cc1plus still actively compiling at termination, the process was making progress — this is not a hang and not a timeout. The agent host /scrap/azure/agent-08 was taken down (agent service stopped, VM reclaimed, or the run superseded/cancelled externally). There is zero compiler error, zero test output, and no UCX diagnostic in the log; nothing in the build itself failed.

Notably, the failure happened well before any uct/ucp gtest ran, so it cannot be attributed to the PR's branch content (uct_tf_purge_live_ep, commit [REDACTED:Hex High Entropy String]) — that code compiled cleanly (libucp.so, libuct.so, ucx_perftest, ucx_info all linked successfully).

Implicated commit: unknown — no code is implicated; the abort is external to the build.

File: n/a (last file being compiled when killed: test/apps/iodemo/io_demo.cc)

Suggested fix:

  1. Re-trigger the "UCX PR" pipeline for PR UCT/IB/MLX5: Save the transmit range inside outstanding purge #12033. This is a retryable infrastructure failure.
  2. If this recurs on the same host, have infra check agent-08's health — specifically whether the agent service is being restarted or the node is being reclaimed/preempted while jobs are in flight (disk pressure on /scrap/azure/agent-08 is a common trigger for agent restarts on these builders).
  3. Optionally, consider marking "agent received a shutdown signal" results as retry rather than failure in the pipeline's retry policy (retryCountOnTaskFailure) so agent churn doesn't surface as a red PR check.
  4. No source or time-limit change is warranted — do not raise the job timeout; the log shows uninterrupted progress until the agent died.

Related: none — the issue search for this signature returned only unrelated PRs (#11932, #11923, #11948, #11859, #11970), i.e. there's no existing tracked issue for this agent shutdown.

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 77e7918c-1d35-462b-ad4d-5e442efa391c in the triage console for the audit trail.

Comment thread test/gtest/uct/test_peer_failure.cc Resolved
Comment thread src/uct/ib/mlx5/rc/rc_mlx5_iface.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
Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Resolved
Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Resolved
Comment thread src/uct/api/v2/uct_v2.h Resolved
Comment thread src/uct/ib/mlx5/rc/rc_mlx5_ep.c Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

test/gtest/uct/test_peer_failure.cc

Residual coverage gap: the new put_zcopy_before_error test only covers the live-purge path with a valid rx token; there is no coverage for a live purge racing with the error CQE, for the no-rx-token live purge, or for a live purge on an endpoint with a non-empty pending queue.

@gleon99

gleon99 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

@evgeny-leksikov please resolve all comments (fix/close).

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

@evgeny-leksikov

Copy link
Copy Markdown
Contributor Author

@evgeny-leksikov please resolve all comments (fix/close).

done

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

@svc-ucx

svc-ucx commented Oct 14, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Tests gpu on worker 1) · commit 38a1c920

TL;DR: The gpu-worker gtest run failed on a single unrelated UCP protocol-selection test, shm_ib/test_ucp_proto_am_rndv.am_explicit_scheme_disables_force_provenance/0; the test forces RNDV_SCHEME=get_zcopy for a 1 MB CUDA AM send but only guards on require_cuda_rndv_support(), so on a host where no network MD can register CUDA memory am/rndv is not selected and the EXPECT_STREQ("am/rndv", ...) check fails. Fix: tighten the guard to require_cuda_net_md() (as the sibling force-path tests do) and re-run CI — PR #12033's UCT/IB change is not implicated.

Full analysis

Summary: make test in the "Tests gpu on worker 1" job exited non-zero because 1 of 10459 gtests failed: shm_ib/test_ucp_proto_am_rndv.am_explicit_scheme_disables_force_provenance/0 (GetParam() = shm,ib,cuda_copy,rocm_copy). All 10438 other tests passed, no hangs (the run completed normally, make: *** [Makefile:4926: test] Error 1).

Root cause: The test (test/gtest/ucp/test_ucp_proto.cc:829-837) runs with RNDV_PIPELINE_SHM_CUDA_STAGING_FORCE=y and RNDV_SCHEME=get_zcopy, then calls check_am_rndv_remote_proto_config(0, 0) → select_am_rndv_remote_proto_config(), which asserts that the protocol chosen for a 1 MB UCP_OP_ID_AM_SEND on CUDA memory is am/rndv (EXPECT_STREQ("am/rndv", thresh->proto_config.proto->name), line 439). With an explicit RNDV_SCHEME, ucp_proto_rndv_cfg_thresh() (src/ucp/rndv/proto_rndv.inl:132-150) returns UCS_MEMUNITS_INF for every rendezvous mode except the requested one, so am/rndv survives only if the get_zcopy rendezvous path is actually viable for CUDA memory on that host. The test's guard, require_cuda_rndv_support() (lines 106-112), only checks that CUDA memory and RNDV exist — it does not check that a network MD can register CUDA memory, unlike the sibling force-path tests which use require_cuda_net_md() (lines 98-104, used at lines 656 and 717). On this worker the environment is degraded for CUDA device paths (e.g. cuda_cpy/test_another_thread.detect_mem_type_cuda_fabric SKIP: "failed to allocate CUDA VMM memory", cuda_ipc/test_md.mem_type_detect_mds SKIP), so the selection falls back to another protocol and the hard EXPECT_STREQ trips. The two sibling tests that differ only by not setting RNDV_SCHEME=get_zcopy (am_default_remote_model_preserves_legacy_key, am_force_remote_model_remains_untagged) both passed, which isolates the explicit-scheme restriction as the trigger.

This is host/topology-dependent, not caused by the PR: the branch uct_tf_purge_live_ep / PR #12033 ("UCT/IB/MLX5: Save the transmit range inside outstanding purge") touches UCT IB/MLX5 outstanding-purge code, which has no interaction with UCP rendezvous protocol selection. The same test name shows up as a CI failure on unrelated PRs (#11977, #11990) and in the protocol-selection diagnostic PRs #11858/#11861/#11864, confirming a pre-existing flaky/env-dependent test.

Implicated commit: Not the PR under test. The test and its guard were introduced by the CUDA-staging-force series — 9cc08081 / d9c844ae (Nathan Bellalou, "UCP/RNDV: use tag-only signal for CUDA staging force") with later edits in b60d87b0 (jeffnvidia, "UCP/RKEY: Keep configurations at stable addresses", #11676).

File: test/gtest/ucp/test_ucp_proto.cc:829 (test body), assertion at test/gtest/ucp/test_ucp_proto.cc:439; guard definitions at test/gtest/ucp/test_ucp_proto.cc:98-112; threshold logic at src/ucp/rndv/proto_rndv.inl:132-150.

Suggested fix: Replace require_cuda_rndv_support() with require_cuda_net_md() in am_explicit_scheme_disables_force_provenance (and for consistency in rma_explicit_scheme_disables_force_provenance at line 801), so the test skips on hosts where no network memory domain can register CUDA memory. Alternatively, make select_am_rndv_remote_proto_config() issue UCS_TEST_SKIP_R instead of EXPECT_STREQ/ADD_FAILURE when the selected protocol is not am/rndv under an explicit RNDV_SCHEME. Then re-trigger the gpu worker job for PR #12033; the failure should not be treated as a regression from this PR.

Related: PR #12033 (build under test), prior occurrences of the same test failing on unrelated changes: #11977, #11990; protocol-selection flakiness diagnostics: #11858, #11861, #11864; test origin #11676.

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