Skip to content

[BugFix] Stage collector weight sync through CPU when device sharing …#4027

Open
theap06 wants to merge 1 commit into
pytorch:mainfrom
theap06:fix/weight-sync-cuda-ipc-staging
Open

[BugFix] Stage collector weight sync through CPU when device sharing …#4027
theap06 wants to merge 1 commit into
pytorch:mainfrom
theap06:fix/weight-sync-cuda-ipc-staging

Conversation

@theap06

@theap06 theap06 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

##Summary:

…is unsupported

MultiCollector's weight sync schemes ship policy weights to spawned
workers through mp.Queue and process pickling. For CUDA tensors this
relies on CUDA IPC, which the driver only implements on native Linux:
on Windows and WSL2 the handles are exchanged without error but the
tensors are received as zeros, and the sender's CUDA memory can be
corrupted as well, zeroing unrelated modules that live in the same
allocator segments (pytorch#3985, pytorch/pytorch#149155). On macOS,
MPS tensors cannot be pickled at all and collector construction fails
outright.

Weights bound for a device that cannot be shared across processes are
now staged through CPU shared memory instead, and each worker moves
them back to its policy device after applying them. A UserWarning
documents the fallback and the extra host-device copy it adds to each
weight sync.

Fixes pytorch#3985
@pytorch-bot

pytorch-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/4027

Note: Links to docs will display an error until the docs builds have been completed.

⚠️ 15 Awaiting Approval

As of commit 0bc6c45 with merge base 702709c (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 16, 2026
@theap06
theap06 force-pushed the fix/weight-sync-cuda-ipc-staging branch from cf9a375 to 0bc6c45 Compare July 17, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BugFix CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Collectors Integrations/torch_geometric Integrations WeightUpdate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] MultiCollector zeroes parameters/buffers of ClipPPOLoss when initialized with GPU modules on Windows

1 participant