Skip to content

test(rccl): add host-only unit tests for gin.cc and wqe_lat_mon.{cc,h} - #13980

Merged
dhanavikram merged 20 commits into
users/dhanavikram/net-ib-resiliency-host-testsfrom
users/dhanavikram/net-ib-gin-wqe-lat-host-tests
Nov 1, 2026
Merged

dhanavikram merged 20 commits into
users/dhanavikram/net-ib-resiliency-host-testsfrom
users/dhanavikram/net-ib-gin-wqe-lat-host-tests

Conversation

@dhanavikram

@dhanavikram dhanavikram commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

src/transport/net_ib/gin.cc, wqe_lat_mon.cc, and wqe_lat_mon.h implement the host-side IB GIN proxy backend and per-QP WQE post-to-poll latency monitor. They had no host-only microtest coverage, so collective setup, RMA batching, completion behavior, latency state transitions, and failure paths required the larger runtime or RDMA hardware.

This PR is stacked directly on PR 13973.

Technical Details

Extends the existing rccl-UnitTestsMicroTransport binary and mirrors both production units under test/host/transport/net_ib/.

NetIbGinMicrotest covers:

  • GDR capability gating, proxy initialization/finalization, properties, and backend vtable wiring
  • ring all-gather retry/completion behavior, all-to-all extraction, barrier, connect retry, and teardown
  • context creation, traffic class, rank stride, WR batch clamping, symmetric MR registration, and cleanup
  • QP-switch/capacity batching and exact IPut, IGet, IPutSignal, Test, and IFlush WR contracts
  • request/sequence completion, poll/error propagation, unconnected peers, local-rank flush keys, and signaling flags

NetIbWqeLatMonMicrotest covers:

  • process-isolated initialization, scripted monotonic time, signaled-WR stamping, backlog tracking, and completion windows
  • strict slow/stall thresholds, one-second report limiters, opcode filtering, shared CQ timestamps, and failover scanning
  • Welford mean/stddev/max and exact P² percentiles for small, ascending, descending, mixed, 10k uniform, and bimodal distributions
  • slow/stall/summary report output and every summary enable/null/empty guard

The tests reuse the existing transport binary and the generic NCCL and socket fakes. The GIN data path posts and polls on an IbVerbsScene, the unit's ncclIbMalloc/ncclCalloc/free go through HostAllocLedger.h (which gains a page-aligned Malloc and a fail-on-Nth-call knob), and its GDR, PeerMem and DMA-BUF probes rename onto transport/net_ib/NetIbSupportSeams.h. Hooks are ScopedHooks; HookOf, the member form, moves into ScopedHook.h. TU-local seams isolate only dependencies whose real definitions are already owned by sibling transport tests. clock_gettime goes through develop's g_clockGettime seam (#13835) in fakes/libc_seam.h, which net-ib-cast-scheduler-test.cc now uses in place of its own TU-local seam. Runner, category, and coverage-object registration come from PR #13858 because this uses the same rccl-UnitTestsMicroTransport binary; like the other host-only microtests it stays out of ci-precheckin.json after #14381.

Production defects discovered by these tests are preserved as disabled forward specifications and tracked only under AICOMRCCL-2397, the designated host-only incidental-findings epic.

Issue Tracking

JIRA ID: AICOMRCCL-2811

Test Plan

  • run_host_tests.sh all on the PR 13973 head.
  • Standalone and in-tree rccl-UnitTestsMicroTransport builds.
  • Transport binary with --gtest_shuffle --gtest_repeat=100.
  • Five shuffled repetitions under ASan/UBSan/LSan.
  • One shuffled run under host-only ThreadSanitizer.
  • Eighteen focused production mutations covering WQE backlog/threshold/report guards, the summary count and gates, the exact-percentile path, and GIN ring, batching, addressing, atomic, flush, peer-selection, and device-bound behavior.
  • 33 more production mutations for the second review round, one or more per new assertion.
  • Explicit execution of all 12 disabled forward specifications.

Test Result

  • All host binaries and guards pass; Transport: 477 tests.
  • New suites: 71 enabled tests; 12 disabled production-defect reproducers fail as intended.
  • 18 of 18 focused mutations caught.
  • Review follow-up: 16 of 16 mutations caught (GIN handle, traffic-class, listen, batch-clamp, peer/stride and flush-QP; WQE slow/stall reports, interleaved layout, summary gates and empty-QP guard).
  • Second review round: 33 of 33 caught (GIN closes, barriers, stride 0, connect TC and handle slot, published context, all-gather comms, all-to-all size, flush gate and drain, signal lkey, ledger frees; WQE targets, report param, P² markers, summary order, zero-device scan, limiter, outputs, opcodes, Init).
  • ASan/UBSan/LSan and TSan report no issues.
  • Scoped line coverage: 98.85% for gin.cc, 96.93% for wqe_lat_mon.cc, 98.23% combined.

Submission Checklist

JIRA ID: AICOMRCCL-2811

Adds deterministic host-only coverage for the net_ib GIN proxy backend and WQE post-to-poll latency monitor to rccl-UnitTestsMicroTransport. The suites cover GDR gating, ring collectives, connect/context/MR lifecycle, RMA batching and WR construction, completion/flush behavior, WQE tracking, thresholds, reporting, and P2/Welford statistics.

Reuses the existing transport binary and shared fakes, with TU-local seams only where sibling real definitions require isolation. Production findings are pinned as disabled forward specifications under AICOMRCCL-2397 children AICOMRCCL-3094 and AICOMRCCL-3131.

Co-authored-by: Cursor <cursoragent@cursor.com>
@dhanavikram
dhanavikram requested review from a team as code owners October 21, 2026 21:09
@dhanavikram
dhanavikram added this pull request to stack #13866 October 21, 2026 21:10
@therock-pr-bot

therock-pr-bot Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/rccl/test/host/HostAllocLedger.h, projects/rccl/test/host/IbVerbsWorld.h, projects/rccl/test/host/ScopedHook.h, projects/rccl/test/host/diag-p2p-test.cc, projects/rccl/test/host/net-ib-cast-scheduler-test.cc (+3 more); no test file found
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ARGUS

Findings

5 more finding(s), not posted inline
  • projects/rccl/test/host/transport/net_ib/gin-test.cc:390 (Low) DevIsMlx5 out-of-range member check passes even without the phys &gt;= ncclNIbDevs bound (ncclIbDevs[2] is zero, i.e. IB_PROVIDER_NONE)
  • projects/rccl/test/host/transport/net_ib/wqe-lat-mon-test.cc:421 (Low) Snapshot test pins p99/p99.9 == 300 (the median) at n=5 while max is 500, locking in the P2 warm-up discontinuity as correct
  • projects/rccl/test/host/transport/net_ib/wqe-lat-mon-test.cc:631 (Low) Error-returning g_ncclSocketGetAddr stub in the gate-disabled test hides a gate bypass that the fail-loud default would catch
  • projects/rccl/test/host/transport/net_ib/gin-test.cc:106 (Low) Default gin hook lambdas are written twice: at declaration (92-106, 128-146) and again in ResetGinHooks (179-205), which SetUp already calls
  • projects/rccl/test/host/transport/net_ib/wqe-lat-mon-test.cc:107 (Low) tracking/trackedPostNs/inflight arming is hand-written at ~10 sites; an ArmTracking helper shared with RecordSample would remove ~20 lines

This PR changes 2,227 lines across 4 files. A change this size is hard to review
well, for a person and for this bot alike: reviewers lose the thread, defects hide in the
volume, and the feedback arrives too late to be cheap to act on. Splitting it into a
stacked pull request
gives each piece a reviewable diff and keeps the history. This review covers the whole change
regardless.

Bottom line: LGTM once the "n=1" check at wqe-lat-mon-test.cc:682 is tightened so it cannot match qpn=100.

Comment @argus review to re-run, or @argus re-review after pushing.

dhanavikram and others added 2 commits October 22, 2026 10:57
Anchor the latency summary check on its count field so qpn=100 cannot satisfy it, let the gate-disabled summary test reach the fail-loud socket fake, and check only percentile ordering at the five-sample P2 switch while a new test pins the exact path below it. Give DevIsMlx5's out-of-range member an mlx5 provider so only the device bound rejects it.

Share one default for the gin hooks between their declarations and ResetGinHooks, and arm WQE tracking through one ArmTracking helper.

Co-authored-by: Cursor <cursoragent@cursor.com>
@dhanavikram

Copy link
Copy Markdown
Contributor Author

Addressed the ARGUS review in cd9cda2:

  • DevIsMlx5: the out-of-range member now points at an mlx5 device (ncclIbDevs[2]), so only the phys >= ncclNIbDevs bound rejects it. Dropping the bound fails the test.
  • Snapshot percentiles: the five-sample test now checks p50 == 300 and percentile ordering at the P2 switch instead of pinning p99/p99.9 to the median. The new Snapshot_FewerThanFiveSamplesReportExactPercentiles pins the exact path below it.
  • Gate-disabled summary: the error-returning g_ncclSocketGetAddr stub is gone, so a gate bypass reaches the fail-loud default. Dropping either gate now aborts the test.
  • GIN hook defaults: the declarations and ResetGinHooks share one kGinHookFails / kGinHookNoOp default.
  • WQE arming: an ArmTracking helper replaces the ten hand-written tracking blocks and backs RecordSample.

Six targeted mutants are killed, and the transport binary now has 456 tests. The branch also merges the updated #13973 head.

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ARGUS

This PR changes 2,212 lines across 4 files. A change this size is hard to review
well, for a person and for this bot alike: reviewers lose the thread, defects hide in the
volume, and the feedback arrives too late to be cheap to act on. Splitting it into a
stacked pull request
gives each piece a reviewable diff and keeps the history. This review covers the whole change
regardless.

Bottom line: LGTM.

Comment @argus review to re-run, or @argus re-review after pushing.

dhanavikram and others added 2 commits October 22, 2026 13:47
Replace the GIN suite's local post_send/poll_cq recorder with fakes/ibv_ops_fakes, which the other net_ib suites in this binary now share.

Co-authored-by: Cursor <cursoragent@cursor.com>

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ARGUS

This PR changes 2,161 lines across 4 files. A change this size is hard to review
well, for a person and for this bot alike: reviewers lose the thread, defects hide in the
volume, and the feedback arrives too late to be cheap to act on. Splitting it into a
stacked pull request
gives each piece a reviewable diff and keeps the history. This review covers the whole change
regardless.

Bottom line: LGTM.

Comment @argus review to re-run, or @argus re-review after pushing.

@github-actions

This comment was marked as off-topic.

@github-actions

This comment was marked as off-topic.

- AllGather checks the send and receive registrations each post uses.
- Connect runs with GIN_IB_TC both unset and set.
- CreateContext moves onto a shared scene: the single-rank test counts the
  listen and traffic-class calls and covers both batch-size clamps, and a
  six-rank, stride-2 case checks the handle each connect gets and the slot
  each accept fills.
- IFlush counts the flush-QP creation.
- GinDataScene gains PostPut and QueueCompletion for the put tests.
- InitType reads its context as develop's ncclIbNetCtx.
…k seam

- The slow, stall and summary tests count ncclSocketGetAddr calls, which
  every report makes through getPeerInfo, instead of matching log text.
  socket_fakes' GetAddr default returns an error rather than aborting, so
  the count is what shows a summary that slipped past a guard.
- The stall scan runs on four QPs, so device 1's interleaved QPs (1 and 3)
  differ from a blocked layout's (2 and 3).
- The ascending and descending snapshot tests are one loop over both orders.
- libc_seam.h maps clock_gettime to a g_clockGettime hook in libc_fakes
  (default: the real clock). This test and net-ib-cast-scheduler-test.cc
  now share it instead of their TU-local seams.

@aduforest aduforest left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ARGUS

This PR changes 2,242 lines across 9 files. A change this size is hard to review
well, for a person and for this bot alike: reviewers lose the thread, defects hide in the
volume, and the feedback arrives too late to be cheap to act on. Splitting it into a
stacked pull request
gives each piece a reviewable diff and keeps the history. This review covers the whole change
regardless.

Bottom line: LGTM.

Comment @argus review to re-run, or @argus re-review after pushing.

…3755, #13835 and #14381, one verbs recorder

#13835 landed the same clock_gettime seam (g_clockGettime,
micro_clock_gettime) on develop, so the four libc hunks here go and the
scheduler and wqe_lat_mon tests use develop's. #13918 folded
fakes/ibv_ops_fakes into IbVerbsScene.h, so GinDataScene builds on a scene:
its data and flush QPs, CQ and PD are the scene's, and the recorder checks
read scene.verbs.
…atency checks

- gin: hooks are ScopedHooks, or HookOf members of GinCreateContextScene;
  HookOf moves into ScopedHook.h from IbVerbsWorld.h and diag-p2p-test.cc.
  HostAllocLedger gains Malloc (ncclIbMalloc) and a fail-on-Nth-call knob,
  and replaces the file's own allocation tracker. The GDR, PeerMem and
  DMA-BUF probes rename onto NetIbSupportSeams.h, which gains PeerMem, and
  the fixture resets through NetIbResetGlobals().
- gin: DestroyContext closes every peer of every context; CreateContext runs
  a ring barrier per peer, treats stride 0 as every rank, connects with
  GIN_IB_TC over IB_TC and listens into its own handle slot; Connect
  publishes dev, allGather and allToAll; the all-gather sends and receives
  on the right comms; all-to-all gathers nranks * len; a disabled flush
  returns no request and an enabled one drains the batch first; the signal
  SGE carries the scratchpad lkey. Two duplicate halves go.
- wqe_lat_mon: percentile targets are written out; Init follows
  IB_WQE_LATENCY_REPORT; P^2 estimates are pinned exactly; the summary pins
  its mean/std/percentile order; a zero-device stall scan reads no clock.
- wqe_lat_mon: develop's NetIbWqeLatMonUnitTests.cpp goes, with its CMake
  line and runner entry; its exact pins, 10k-sample checks, pipelined walk
  and extra field checks move here.
Restores test/transport/NetIbMPI/NetIbWqeLatMonUnitTests.cpp, its line in
test/CMakeLists.txt and the net_ib_wqe_lat_unit entry in
tools/scripts/test_runner/configs/net_ib_transport.json exactly as they are
on develop, and drops the README sentence that described their removal.
This PR changes host tests only; the checks wqe-lat-mon-test.cc gained stay.

@amd-argus amd-argus Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ARGUS

This PR changes 2,357 lines across 10 files. A change this size is hard to review
well, for a person and for this bot alike: reviewers lose the thread, defects hide in the
volume, and the feedback arrives too late to be cheap to act on. Splitting it into a
stacked pull request
gives each piece a reviewable diff and keeps the history. This review covers the whole change
regardless.

Bottom line: LGTM.

Comment @argus review to re-run, or @argus re-review after pushing.

@dhanavikram
dhanavikram requested a review from pvallem October 28, 2026 22:00
cursoragent and others added 3 commits October 29, 2026 11:32
Co-authored-by: Dhanavikram Sekar <dhanavikram@users.noreply.github.com>
Co-authored-by: Dhanavikram Sekar <dhanavikram@users.noreply.github.com>
@dhanavikram
dhanavikram merged commit 8915864 into develop Nov 1, 2026
62 of 65 checks passed
@dhanavikram
dhanavikram deleted the users/dhanavikram/net-ib-gin-wqe-lat-host-tests branch November 1, 2026 05:36
@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants