[BugFix] Stage collector weight sync through CPU when device sharing …#4027
Open
theap06 wants to merge 1 commit into
Open
[BugFix] Stage collector weight sync through CPU when device sharing …#4027theap06 wants to merge 1 commit into
theap06 wants to merge 1 commit into
Conversation
…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
🔗 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.
|
theap06
force-pushed
the
fix/weight-sync-cuda-ipc-staging
branch
from
July 17, 2026 07:00
cf9a375 to
0bc6c45
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
##Summary:
The fix. Weights bound for a device that can't cross process boundaries are now staged through CPU shared memory and moved back to the policy device inside each worker, with a UserWarning about the extra host-device copy: