Skip to content

[WIP] [rl] Trainer leaders read large rollout groups by RDMA over torch transport - #6469

Draft
wwwjn wants to merge 1 commit into
wwwjn/data-plane/6-read-aheadfrom
wwwjn/data-plane/6b-rdma-groups
Draft

wwwjn wants to merge 1 commit into
wwwjn/data-plane/6-read-aheadfrom
wwwjn/data-plane/6b-rdma-groups

Conversation

@wwwjn

@wwwjn wwwjn commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Human note: TODO (Jiani)

TLDR: Opt-in BaseRolloutWorker.Config.rdma_min_group_bytes: a training group of at least that many serialized bytes stays in its rollout worker in one registered torch transport (NIXL) buffer, and each trainer DP replica leader reads only its rollouts' byte ranges by RDMA instead of fetching them with a get_rollouts call. Off by default. On one host it saves little for MB-size groups (4K score centering on this head: the read drops 0.29 -> 0.24 s and the first microbatch wait 393 -> 334 ms per step, 277 MB per leader; the 238 s step is unchanged) and costs time for small ones (alphabet sort: 71 -> 116 ms); it targets MB-size groups read across hosts, which is not measured on this head.

# PR Independent? Needs
0 RDMA object for microbatches and prompts (#5862) yes -
1 Rollout workers compute and record each group's rollouts (#6301) yes - (stacked on 0 for merge order only)
2 Split the batcher into a metadata half and a bytes half (#6302) yes 0 (its batcher code)
3 Trainer DP replica leaders read their rollouts from the rollout workers and pack them (#6303) no 1, 2
4 Read the next step's rollout groups during the optimizer step (#6324) no 3
5 Trainer leaders read large rollout groups by RDMA over torch transport (#6469, this PR) no 3 (stacked on 4 for merge order only)
6 Prompt image files share the rollout worker's torch transport pool (#6334) no 5

Merge bottom-up. This path was in #6303 until review split it out: #6303's endpoint fetch stands alone, and this PR carries the RDMA path's own measurements.

Problem

  1. After [WIP] [rl] Trainer DP replica leaders read their rollouts from the rollout workers and pack them #6303, a leader fetches its rollouts with one get_rollouts call per rollout worker: the worker pickles them into the reply and the leader unpickles them.
  2. Groups can be MBs: score centering top-k logprobs (k=32: 17 MB per 16-rollout group at 4K tokens), routed experts, images.
  3. Every byte goes through Monarch's message path, once per leader per step, and the leader reads its whole column before its first microbatch.
  4. Cost on one host at 4K score centering: 0.29 s per step per leader (277 MB). [WIP] [rl] Read the next step's rollout groups during the optimizer step #6324 hides the read only when read-ahead triggers (a trainer-bound off-policy run); on-policy and generation-bound runs (4K: read-ahead never triggers; the controller waits 110 s of a 238 s step for the next plan) still read the whole column before the first microbatch. Across hosts: not measured on this head, so this is headroom.

Solution

  1. A group whose turn arrays and distinct image files hold at least rdma_min_group_bytes bytes (checked before anything is pickled) is serialized once, when its worker keeps it (keep_in_registered_buffer, new transport/rdma_rollout_group.py): one region per rollout (its pickled fields, then each turn's arrays, 64-byte aligned) and one per distinct image file, each with a (group_id, generation) tag on both sides. Alignment padding is written as zeros, so a buffer reused from a larger group keeps none of that group's tags.
  2. Its ref is an RDMARolloutGroupRef (the buffer handle and each region's place); RolloutGroupRef = WorkerRolloutGroupRef | RDMARolloutGroupRef. A leader reads only the regions its column names, all reads in flight together, checks the tags and rebuilds the rollouts (read_rdma_rollout_groups).
  3. Buffers come from each process's RegisteredBufferPool (new transport/torch_transport_rdma.py, used through RDMAByteBuffers). A released buffer is reused, never unregistered: a NIXL reader keeps the metadata of a buffer it has read, and the owner's unregister never reaches it (pytorch#206300).
  4. At setup each leader starts its torch transport and reads every worker's probe in one read (Trainer.check_rdma_probes), so a broken fabric fails setup within one read timeout, not step 1. Each worker's probe stays allocated for the run (one 64 KiB pool buffer). A read that fails or times out leaves its staging buffer registered and unused, since the transfer may still write into it.
  5. BaseRolloutWorker owns the buffers and the store; the actor's endpoints only forward.
  6. Unchanged: with the knob off (the default), [WIP] [rl] Trainer DP replica leaders read their rollouts from the rollout workers and pack them #6303's fetch path. The release after each step's weight pull returns a group's buffer to the pool.
  7. Metric keys added: trainer/rdma_read_bytes/max on the trainer (0 when every group is fetched). With the knob, on the workers: timing/rollout_worker/serialize_group and rollout_worker/pool_{bytes,bytes_in_use,registrations} on the groups kept in registered memory.
fetch (#6303):  leader --get_rollouts--> worker: pickle the rollouts --reply--> leader: unpickle
this PR:        worker: keep -> serialize once into a pooled registered buffer; ref = handle + regions
                leader: one-sided reads of its rollouts' regions -> check tags -> rebuild

Results

Qwen3-0.6B, A100, one host (no ibverbs), medians of steps >= 3.
4K: this PR's production code (as on this head; only #6301 below it moved since) plus the open score-centering
commits: top-k logprobs (k=32), 32 x 16, 4K-token completions,
8 GPUs, trainer FSDP 2 x TP 2, 8 rollout workers, 8 steps, rdma_min_group_bytes = 1 (every group, 17 MB each)
  read_rollout_groups max     0.29 -> 0.24 s (277 MB per leader)
  first microbatch wait       393 -> 334 ms (read-ahead never triggers: generation-bound)
  column send                 14 -> 21 ms
  serialize_group             6.7 ms per group, on the rollout workers when they keep it
  rollout worker RAM          10.29 -> 10.02 GiB, max over workers (pool: 189 MB per worker)
  controller wait for a plan  109.9 -> 112.1 s
  step                        238.2 -> 238.1 s
bitwise, same code, the bitwise recipe with score centering (k=32), TP 2, 10 steps, knob off vs on:
  66/67 tags identical at every step; the other is trainer/rdma_read_bytes/max (0 with the knob off)
T1: alphabet sort, 256 x 4, 4 GPUs, trainer FSDP 2, rdma_min_group_bytes = 1 (every group by RDMA), both on two lanes at once,
measured with this code inside #6303 before the split
  read_rollout_groups max     71 -> 116 ms (2.5 MB per leader)
  column send                 94 -> 139 ms
  first microbatch wait       105 -> 150 ms
  step                        31.0 -> 31.5 s
T1 on this head, every group by RDMA, with #6324's read-ahead on (off-policy, trainer-bound):
  read_rollout_groups max     208 ms, hidden: first microbatch wait 0.9 ms (2.5 MB per leader)
bitwise vs main 076f2e88b (seed 42, deterministic, 10 steps), knob on: 62/62 tags at TP 2, this head

NOTE:

  • Across hosts is not measured on this head. An earlier version of this path ran Qwen3.5-35B-A3B Terminal-Bench on 10 GCP GB300 hosts: the largest leader read was 509 MB per step, over RoCE.
  • Every process with torch transport keeps one CPU core busy: NIXL's progress thread polls without sleeping (0.99 cores while idle, one thread, measured on CPU with the pinned 1.5.0 and with 1.5.2). The 4K run's 8 rollout workers spin 8 cores of a 168-core host; its +2.2 s controller plan wait is noise (the earlier pair went 113.4 -> 112.2 s with the knob on).
  • torch.distributed._transport is a private upstream API (a TODO, as in model_state_dict.py).
  • A worker's pool never shrinks (pytorch#206300); a group takes the smallest free buffer that fits, so it grows only when none is large enough.
  • Monarch RDMABuffer is not used here: it reads a buffer whole, and a leader reads byte ranges of a group (its rollouts).
  • An RDMARolloutGroupRef carries its NIXL buffer descriptor: 256 refs of 4-rollout groups pickle to 166 KiB instead of 6 KiB (5.6 vs 0.9 ms to pickle, 5.1 vs 0.7 ms to unpickle, one CPU process). That is part of the slower column send at T1 (94 -> 139 ms).
  • Another open PR adds a second grow-only torch transport pool, for the batcher's RDMA microbatches. Which pool the RL data plane keeps, and whether that microbatch path still exists after [WIP] [rl] Trainer DP replica leaders read their rollouts from the rollout workers and pack them #6303, is open.
  • No recipe sets the knob yet. The workloads it is for are open upstream: score centering top-k logprobs and routed-expert replay. It stays opt-in until one of them lands and a cross-host run shows the read on the step.

Test plan

  • pytest tests/rl/unit_tests/cpu: 828 passed, 8 skipped, 4 failed, with nixl ([WIP] [rl] Read the next step's rollout groups during the optimizer step #6324: 807 passed). The 4 also fail on main 076f2e88b: recipe tests whose torch_checkpointing.storage.fsspec_storage import fails locally.
  • transport/test_rdma_rollout_group.py (new): a kept group reads back whole from its ref alone; a read of a reused buffer raises naming both tags; a torn region raises; test_a_group_that_fails_to_serialize_returns_its_buffer_to_the_pool fails without the release on error; test_a_kept_group_writes_the_same_bytes_whatever_its_buffer_held fails without the zeroed padding.
  • test_torch_transport_rdma.py (new): the pool reuses the smallest free buffer that fits and keeps released buffers registered; every probe is read in one call and a failed read raises at setup naming the worker hosts; with real NIXL, a reused buffer reads back its new bytes without a new registration; test_a_read_after_a_failed_read_uses_a_new_staging_buffer fails without setting the failed read's staging buffer aside.
  • test_rollout_group_store.py: large groups go by RDMA and small ones are fetched, read in ref order in one call.

@pytorch-bot pytorch-bot Bot added the ciflow/rl label Dec 1, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 1, 2026
@wwwjn
wwwjn added this pull request to stack #6471 December 1, 2026 21:18
@wwwjn
wwwjn force-pushed the wwwjn/data-plane/6b-rdma-groups branch from 130ab06 to fb3ffbd Compare December 1, 2026 21:29
@wwwjn
wwwjn force-pushed the wwwjn/data-plane/6b-rdma-groups branch from fb3ffbd to 5e6da90 Compare December 1, 2026 22:31
@wwwjn
wwwjn force-pushed the wwwjn/data-plane/6b-rdma-groups branch from 5e6da90 to 884df47 Compare December 1, 2026 22:50
@wwwjn wwwjn changed the title [rl] Trainer leaders read large rollout groups by RDMA over torch transport [WIP] [rl] Trainer leaders read large rollout groups by RDMA over torch transport Dec 1, 2026
@wwwjn

wwwjn commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

from claude: Rebased onto #6301's new head 6e2d4ba, where each rollout worker records its own groups (recorder_lines is gone, so nothing here carries recorder lines anymore). Built on the latest heads of this stack. RL CPU suite: same 4 local env failures as before; 10-step bitwise run with one validation: all non-timing TensorBoard tags and the recorded rollouts match #5862. @claude review

@claude

claude Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @wwwjn's task in 4m 37s —— View job


Request changes: the RDMA path's measured gain is small or negative, there is no cross-host number yet, and it duplicates the torch-transport pool in #6163. Review

@claude claude 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.

Verdict: Request changes -- the knob adds ~810 lines of transport code plus ~720 lines of tests, but the measurements show no benefit yet: 30 ms saved in a 238 s step, slower for small groups, the cross-host case unmeasured, and no in-repo workload that needs it. It also duplicates the torch-transport pool that #6163 is building.

What this PR does. With BaseRolloutWorker.Config.rdma_min_group_bytes set, a rollout worker serializes each group above the threshold once into a NIXL-registered pooled buffer. The group's ref becomes an RDMARolloutGroupRef (buffer descriptor plus per-rollout byte regions with tags). Each trainer DP replica leader reads only its rollouts' regions one-sided, checks the tags and rebuilds the rollouts. At setup every leader reads a probe from every worker. With the knob off, the get_rollouts fetch path from #6303 is unchanged.

Example.

4K score centering, 16-rollout group = 17 MB, leader's column = 277 MB/step
before (#6303): leader --get_rollouts--> worker pickles 277 MB --reply--> leader unpickles   0.27 s
after:          worker copies the group into a pooled buffer at keep time; the ref carries
                handle + regions; leader reads its regions by RDMA, checks tags, rebuilds    0.24 s
step time: 238 s either way (one host). T1 alphabet sort, all groups by RDMA: 71 -> 116 ms.

Must fix

  1. Value not shown (gate). The PR's own numbers point the wrong way or sit inside noise: -30 ms of a 238 s step at 4K, +45 ms per step at T1, and the column send is slower (94 -> 139 ms) because each ref carries a NIXL descriptor. The case the knob is for (MB-size groups read across hosts) is "not measured on this head". The workloads that would produce such groups are still open PRs (score centering #6378, router replay #6459), and no recipe sets the knob. Under CONTRIBUTING.md#proof-of-value and rules/config.md ("expose only options a verified recipe uses"), a justification that depends on unlanded features doesn't count. Fix: hold this PR until one of those workloads lands, then show a cross-host end-to-end step-time win on it. If the read turns out not to be on the critical path, drop the PR; #6324's read-ahead already hides it in trainer-bound runs.
  2. torch_transport_rdma.py:84 -- a second grow-only registered torch-transport pool for the same NIXL stale-key problem as #6163 (different upstream issue cited). Coordinate on one pool in rl/transport/ (details inline).

Should consider

  • torch_transport_rdma.py:335 -- probes are read sequentially, each with a 30 s NIXL timeout, against a fixed 60 s controller timeout. With two or more hung workers, the per-host diagnostic is lost.
  • rdma_rollout_group.py:123 -- every group under the threshold is pickled just to measure its size. Gate on array and image bytes before pickling.
  • rollout_group_store.py:103 -- two parameters plus an assert for one optional feature.
  • trainer.py:509 -- trainer/rdma_read_bytes/max is logged every step on the default path, where it is always 0, and it widens the broadcast tuple. Consider emitting it only when the knob is set.
  • test_trainer.py:288 -- this test only checks that to_thread runs on a thread. Delete it.

Questions

  • Every rollout worker process now runs a NIXL progress thread that spins one core. How many workers did the 4K run have, and did rollout throughput change? This cost is on the controller host's CPU pool, which also runs the envs.
  • The _RDMA_PROBE_TIMEOUT_S comment says "~2 s on one host": is that per probe or for the whole check? If per probe, about 30 workers already exceed 60 s on a healthy fabric.
Details

Overlap search. Searched open PRs for "rdma rollout", "torch transport" and "rollout_group_store". Found #6163 (TransportRDMAMicrobatch, grow-only owner pool, nixl#1267), #6334 (images onto this PR's pool), #6378 (score centering), #6459 (router replay) and the rest of this stack (#5862, #6301-#6303, #6324). direction.md has no RL transport entry, so whether the RL data plane standardizes on Monarch RDMAObject or on torch transport is a maintainer call. With #5862 on Monarch and #6163 plus this PR on torch transport, the stack currently goes both ways.

Smallest alternative. None needed today: #6303's fetch path plus #6324's read-ahead. If a cross-host number later justifies the path, it could be smaller: size gate before pickling, one shared pool with #6163, and probes read in one call.

Correctness checked. The release order holds: groups are released after the pull, after every leader's forward_backward returns, and the next step's reads under read-ahead touch different groups. Region and tag offsets, _merged_ranges, _buffer_size_class (multiples 5..8, at most 25% over the request), the staging-buffer handling after a failed read, and select (images trimmed to the kept rollouts) all check out.

Not verified: any multi-host behavior, and whether Monarch's call_one sends at call time (the read_rollout_groups comment "Each call is sent here" relies on it to overlap fetches with the RDMA reads).

Before merge: fill in the human-written summary.

# owner unregisters them (https://github.com/pytorch/pytorch/issues/206300). Today it does not
# (module docstring), so freeing a buffer a reader has read can make a later buffer at the same
# addresses unreadable; that is why this pool never unregisters, and why its memory never shrinks.
class RegisteredBufferPool:

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.

This is the second registered pool over torch.distributed._transport built for the same NIXL stale-registration problem. #6163 (open, updated today) adds a grow-only owner pool in rl/transport/rdma_microbatch.py for batcher microbatches. That pool also never unregisters and also has a free list, but it cites nixl#1267 where this one cites pytorch#206300. #6334 then moves prompt images onto this pool too. Two pools mean two copies of the reuse invariant, two upstream TODOs, and two NIXL progress threads in any process that ends up with both.

Fix: agree with #6163 on one owner pool in rl/transport/ that microbatches, rollout groups and images all use, plus one TODO that links both upstream issues. Also, after #6303 the leaders pack, so it needs deciding whether the batcher's RDMA microbatch path that #6163 migrates still exists in this stack at all.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

from claude: Not changed here: whether the RL data plane keeps this pool or the other torch transport pool PR's (and whether the batcher's RDMA microbatch path still exists after #6303) is for the maintainers and that PR's author to settle. The PR body lists it as open.

instead of mid-step, naming each owner host and this reader's host.
"""
failures = []
for probe in probes:

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.

The probes are read one at a time, and per the read docstring each read can take up to NIXL's 30 s timeout. The controller gives the whole loop 60 s (controller.py:341). So if two or more workers hang, the controller's generic timeout fires first and you lose this function's per-host message, which is the diagnostic the probe is for. A healthy setup also gets slower linearly with the worker count while the 60 s budget stays fixed.

Fix: submit every probe in one buffers.read call, since the reads can be in flight together. Then derive the controller timeout from the transport's timeout (one read plus connection setup) instead of hardcoding 60 s.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

from claude: Every probe is now read in one buffers.read call, so hung reads fail within one NIXL read timeout (30 s), inside the controller's 60 s; a failed read names every worker host. The controller comment now says this instead of the ~2 s estimate. test_a_probe_read_that_fails_raises_at_setup checks one call for two probes. a034714

pickled_turns.append(pickled_turn)
rollout_layout.append(tuple(turn_layout))
rollout_arrays.append(arrays)
pickled = pickle.dumps(

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.

Every rollout gets pickled before allocate decides whether the group crosses the threshold. A group under rdma_min_group_bytes is therefore pickled once on the worker's event loop just to measure it, then pickled again in the get_rollouts reply. That is the serialize_group timing the description adds for every group.

The size is dominated by array.nbytes and the image data lengths, both known without pickling. Fix: check sum(array.nbytes) + sum(len(image.data)) against min_bytes first, and pickle only groups that go into a buffer. Small groups then pay nothing with the knob on, and the always-on serialize_group metric can go.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

from claude: keep_in_registered_buffer now compares the turn arrays' and distinct image files' bytes with min_bytes before pickling, so a small group is neither pickled nor allocated, and serialize_group is logged only for kept groups. The knob docstring says what it counts. a034714

Comment thread tests/rl/unit_tests/cpu/test_trainer.py Outdated
asyncio.run(run())


def test_check_rdma_probes_reads_off_the_event_loop(monkeypatch) -> None:

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.

This test monkeypatches both collaborators and checks that asyncio.to_thread runs on a thread. That is one line of implementation, and the test doesn't guard an invariant that could break silently (rules/tests.md). Suggest deleting it. test_a_probe_read_that_hangs_fails_setup_naming_the_leader_and_hosts already covers the user-visible behavior.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

from claude: Deleted. a034714

rdma_byte_buffers: RDMAByteBuffers | None,
rdma_min_group_bytes: int | None,
) -> None:
assert (rdma_byte_buffers is None) == (rdma_min_group_bytes is None)

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.

One optional feature is split across two parameters, plus an assert that keeps them in sync. The _keep path asserts it again. Pass one optional value instead, e.g. rdma: tuple[RDMAByteBuffers, int] | None, or a small frozen dataclass if it reads better. Then "off" has a single representation and both asserts go away.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

from claude: Kept as two: #6334 gives the store a pool with no group threshold (prompt image files alone, rdma_min_image_bytes), where the pool metrics still need the buffers, so one optional pair here would split again one PR later.

@wwwjn
wwwjn force-pushed the wwwjn/data-plane/6b-rdma-groups branch from 884df47 to ab295d3 Compare December 2, 2026 00:07
@wwwjn
wwwjn force-pushed the wwwjn/data-plane/6b-rdma-groups branch from ab295d3 to a034714 Compare December 2, 2026 00:43
@wwwjn

wwwjn commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

from claude: @claude review

This round (a034714): the size check before pickling, all probes in one read, the to_thread test deleted, and alignment padding written as zeros (your #6334 review found that a stale region's tags could survive in a reused buffer's padding). The Results now come from this PR's code: 4K score centering, read 0.29 -> 0.24 s, first microbatch wait 393 -> 334 ms, step 238.2 -> 238.1 s on one host. Cross-host is still not measured.

@claude

claude Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @wwwjn's task in 2m 13s —— View job


Request changes: the line-level fixes landed, but the step time is unchanged (238.2 -> 238.1 s) and the cross-host case is still unmeasured, so the value gate and the duplicate pool shared with #6163 stay open. Review

@claude claude 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.

Verdict: Request changes -- the line-level fixes landed, but the gate finding stands: the new 4K numbers show no end-to-end win (step 238.2 -> 238.1 s), the cross-host case is still unmeasured, and no in-repo workload produces the groups the knob is for.

What this PR does. With BaseRolloutWorker.Config.rdma_min_group_bytes set, a rollout worker serializes each group whose turn arrays and distinct images reach the threshold into a pooled NIXL-registered buffer. The ref it hands the controller is an RDMARolloutGroupRef (buffer descriptor plus tagged per-rollout and per-image regions). Each trainer DP replica leader reads only its regions one-sided, checks the (group_id, generation) tags and rebuilds the rollouts. At setup, every leader reads every worker's probe. With the knob off, #6303's get_rollouts fetch is unchanged.

Example.

4K score centering, 8 workers, 17 MB groups, 277 MB per leader per step (one host, medians)
                        fetch (#6303)   this PR
read_rollout_groups     0.29 s          0.24 s
first microbatch wait   393 ms          334 ms    (-59 ms, 0.02% of the step)
column send             14 ms           21 ms     (refs carry NIXL descriptors)
controller plan wait    109.9 s         112.1 s
step                    238.2 s         238.1 s
T1 alphabet sort (small groups, all by RDMA): read 71 -> 116 ms

Resolved since the last review

  • Size check before pickling: keep_in_registered_buffer gates on _num_array_and_image_bytes, so small groups are neither pickled nor allocated.
  • Probes: all read in one buffers.read call.
  • The to_thread test is deleted.
  • Two store parameters plus an assert: the reply holds. #6334 uses the buffers without a group threshold, so one optional pair would have to split again.
  • New: alignment padding is zeroed (rdma_rollout_group.py:212-215). I checked the written ranges. Header, arrays, and both tags of every region are covered, and everything else up to the last tag is zeroed. A stale region that straddles the new group's end fails its head-tag check. A stale region entirely past the end still holds its old, unchanged bytes.

Must fix (still open)

  1. Value not shown (gate). The new numbers replace the old ones but point the same way. The read saves 50 ms, of which the slower column send gives back 7 ms. The step does not move, and the controller's plan wait grows by 2.2 s (unexplained, possibly noise). Small groups are still slower. The target case (MB-size groups read across hosts) is not measured on this head. Its workloads (#6378 score centering, #6459 router replay) are still open, and no recipe sets the knob. Under CONTRIBUTING.md#proof-of-value and rules/config.md ("expose only options a verified recipe uses"), the PR has to wait until one of those lands and a cross-host run shows a step-time win. If the read turns out to be off the critical path there, drop the PR.
  2. torch_transport_rdma.py:84 -- a second grow-only torch-transport pool, alongside #6163's (still open). The author defers this to the maintainers. It still needs that decision before merge: one pool in rl/transport/, and whether #6163's batcher microbatch path survives #6303.

Should consider (still open)

  • trainer.py:509 -- trainer/rdma_read_bytes/max is added to every step's metrics and to the broadcast tuple on the default path, where it is always 0. Consider emitting it only when the knob is set.

Questions

  • The knob docstring says the NIXL progress thread spins a core "seen with the 1.5.2 wheel; not checked with the pinned 1.5.0". Does the pinned wheel spin too? With 8 workers, is the +2.2 s controller plan wait at 4K that cost on the env/rollout CPU pool?
Details

Overlap search. "torch transport" and "rdma rollout" found the same PRs as last round: #6163 (open, torch-transport microbatch pool), #6334 (images onto this pool), #6378 and #6459 (the workloads, both open), and this stack (#5862, #6301-#6303, #6324). direction.md still has no RL transport entry. The stack uses both Monarch RDMAObject (#5862) and torch transport (#6163, this PR).

Smallest alternative. None needed today: #6303's fetch plus #6324's read-ahead.

Re-checked at HEAD. Release order (after the weight pull, after every leader's forward_backward), tag placement in tagged, _merged_ranges, the staging-buffer handling after a failed read, the probe ranges (0, 4096) and (1024, 1024) against _PROBE_BYTES, and select trimming images to the kept rollouts.

Not verified: multi-host behavior. Also unverified: whether Monarch's call_one sends at call time. read_rollout_groups relies on that ("Each call is sent here") to overlap the endpoint fetches with the blocking RDMA read.

Before merge: fill in the human-written summary.

@wwwjn
wwwjn force-pushed the wwwjn/data-plane/6b-rdma-groups branch from a034714 to fd7b0f3 Compare December 2, 2026 01:10
@wwwjn

wwwjn commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

from claude: @claude review

Answers to the open questions (fd7b0f3):

  • NIXL spin: measured on CPU, a process with a torch transport and one registered buffer uses 0.99 cores while idle, all in one thread, with the pinned 1.5.0 and with 1.5.2. The knob docstring now says so. The 4K run had 8 rollout workers, so 8 cores of a 168-core host.
  • The +2.2 s controller plan wait at 4K is noise: the earlier pair of the same recipe went the other way (113.4 -> 112.2 s with the knob on, step 238.1 -> 239.1 s).
  • trainer/rdma_read_bytes/max on the default path: only the leaders know the knob (they hold the buffers), and the forward_backward metrics reduce over the loss mesh, so every rank has to log the same keys. Logging it only with the knob would need the knob on every trainer rank.
  • The value gate and the pool question stay open for the user and the maintainers.

@claude

claude Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @wwwjn's task in 1m 12s —— View job


Request changes: the open questions are answered, but the step time doesn't change outside noise (-0.1 s and +1.0 s across two run pairs), the cross-host case is still unmeasured, and the duplicate pool shared with #6163 is still undecided. Review

@claude claude 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.

Verdict: Request changes -- the open questions are answered, but the gate is still open. The new noise data makes it clearer that the knob has no measurable end-to-end effect on one host, and the cross-host case it exists for is still unmeasured.

What this PR does. With BaseRolloutWorker.Config.rdma_min_group_bytes set, a rollout worker serializes each group whose turn arrays and distinct image files reach the threshold into a pooled NIXL-registered buffer. It hands the controller an RDMARolloutGroupRef instead of a WorkerRolloutGroupRef. Each trainer DP replica leader reads only its rollouts' tagged regions one-sided and rebuilds them. With the knob off, #6303's get_rollouts fetch is unchanged.

Example.

4K score centering, 8 workers, 17 MB groups, 277 MB per leader per step (one host)
                        fetch (#6303)   knob on
read_rollout_groups     0.29 s          0.24 s
first microbatch wait   393 ms          334 ms
step, run pair 1        238.2 s         238.1 s
step, run pair 2        238.1 s         239.1 s   (the author's earlier pair)
T1 alphabet sort, every group by RDMA: read 71 -> 116 ms

Resolved since the last review

  • NIXL progress thread: measured at 0.99 idle cores per process with both the pinned 1.5.0 and 1.5.2, and the knob docstring now says so (rollouter.py, rdma_min_group_bytes). The 4K run used 8 of 168 cores.
  • +2.2 s controller plan wait: noise. The earlier pair moved the other way.
  • trainer/rdma_read_bytes/max on the default path: I accept the reply. Non-leader ranks don't know the knob, and the loss-mesh reduction needs the same keys on every rank. One scalar per step doesn't justify plumbing the knob to every rank.

Must fix (still open)

  1. Value not shown (gate). The two run pairs put the step-time difference at -0.1 s and +1.0 s, which is inside run-to-run noise. The ~59 ms first-microbatch saving doesn't reach the step, and small groups are slower. The case the knob is for (MB-size groups read across hosts) is not measured on this head. Its workloads are still open: #6378 (score centering) and #6459 (router replay). No recipe sets the knob. Under CONTRIBUTING.md#proof-of-value and rules/config.md ("expose only options a verified recipe uses"), this needs a cross-host end-to-end step-time win on one of those workloads once it lands. If the read turns out to be off the critical path there, drop the PR. #6303's fetch plus #6324's read-ahead already covers today's workloads.
  2. torch_transport_rdma.py:84 -- this is a second grow-only torch-transport pool alongside #6163's (still open, last updated 2026-12-01). The author defers this to the maintainers. Before merge it needs that decision: one pool in rl/transport/, and whether #6163's batcher microbatch path survives #6303.
Details

Overlap search. "torch transport", "score centering" and "router replay" found the same PRs as last round: #6163 (open), #6334 (images onto this pool), #6378 / #6380 / #6384 / #6385 (score centering, all open), #6459 / #5255 (router replay, open), and the rest of this stack (#5862, #6301-#6303, #6324). direction.md still has no RL transport entry.

Re-checked at HEAD. keep_in_registered_buffer gates on _num_array_and_image_bytes before allocating or pickling. check_rdma_probes reads every probe in one buffers.read call. The pool, release order and tag layout are unchanged since the last review.

Not verified: multi-host behavior; whether Monarch's call_one sends at call time (read_rollout_groups relies on that to overlap fetches with the RDMA read).

Before merge: fill in the human-written summary.

This branch has not been deployed

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

Labels

ciflow/rl CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant