NVIDIA-NeMo/RL #5176, part 11 of 11 in the partial-checkpointing stack.
Counts are the PR's own commit 788133a..981376a (+2,281 / โ49). Permalinks pin 981376a.
The review is pending; its comment links work once it is published.
Four pages on this PR. This one: which lines can go, and why each cut is safe.
Two asks do most of the work. C15 drops the PR's three settings (prefix_writer_actor, prefix_write_pipeline.enabled,
direct_column_encoding), which today allow six ways to write a cut, and picks the new path whenever the run can use it: text-only capture on TransferQueue simple.
The old path stays only for media capture and other TQ backends, which the new one does not support (L851-L856).
C2 keeps the NumPy byte views, because Ray 2.58 copies torch tensors (and so a TensorDict) through torch's own pickle but hands NumPy arrays to the actor in place
(โ 45 + 14 ms against โ 2 + 0 ms for a 128 MiB batch). It shrinks them to two helpers and replaces the 94-line
RayPrefixWriterClient with a thin wrapper.
| ID | What goes | Why nothing measured is lost | Lines |
|---|---|---|---|
| C2 | G_DTYPES, PackedColumn, PrefixPut, the bf16 branch, RayPrefixWriterClient | Two helpers do the same no-copy byte views for every dtype; the actor options already keep writes ordered and failures loud. | โ 205 |
| C3 | Timing fields, per-write INFO logs, snapshot(), stats() | Only log lines and tests read them. | โ 130 |
| C8 | _validate_keys in the actor | Its only caller sends generation-cut keys for the same partition, so it never fires. | โ 26 |
| C9 | Copied dense-or-jagged tail in the encoder | One helper, same output. | โ 5 |
| C15 | The three settings, their checks in two places, 6 YAML blocks, the doc table, the config tests | The run already says which path can work; the new path won every measured row, and the old one stays where it is needed. | โ 185 |
๐ด Review comments: C2 ยท prefix_writer_actor.py:95C3 ยท prefix_writer_actor.py:86C8 ยท prefix_writer_actor.py:202C9 ยท direct_prefix_batch.py:70C15 ยท vllm/config.py:119
Nothing below is implemented.
Where it lands: RL only. No TQ or Ray change.
C2 ยท the hop to the writer actor
# writer thread in the vLLM worker (proposed: two small helpers, a thin wrapper) cols = encode_prefix_groups(rows) # one TensorDict ref = ray.put(PrefixPut(pack_columns(cols))) # ~100 lines: dtype table, bf16 branch, checks RayPrefixWriterClient.put_samples(...) # ~95 lines: locks, timings, reply checks columns = {name: to_bytes(t) for name, t in cols.items()} # NumPy uint8 views, no copy ray.get(actor.put_samples.remote(columns=columns, ...)) # Ray copies once into shared memory # PrefixWriterActor process (CPU only, same node) def put(batch): fields = unpack_columns(batch.columns) def put_samples(columns, ...): fields = {k: from_bytes(*v) for k, v in columns.items()} # reads shared memory in place own_tq_client.put_samples(sample_ids, fields, tags)
Real code today: pack_columns, unpack_columns, RayPrefixWriterClient.
C15 ยท choosing the write path
# vLLM worker, setup_token_capture (proposed: no settings) writer_on = cfg.prefix_writer_actor # 3 settings, 6 combinations pipeline_on = cfg.prefix_write_pipeline.enabled encoder_on = cfg.prefix_write_pipeline.direct_column_encoding fast = prefix_cuts and not capture_media and tq_backend == 'simple' # decided once, from what the run is if fast: pipeline = PrefixWritePipeline(encoder=direct, limits=parts.generation_prefix_batch_*) # existing limits writer = create_prefix_writer() # fails clearly if no free CPU else: keep today's path # media capture, other TQ backends
Real code today: setup_token_capture checks, validate_vllm_async_actor_settings, PrefixWritePipelineConfig.