feat(shm): Zero-Copy SHM Transport & Remote SkyRL Integration#440
Open
RUFFY-369 wants to merge 13 commits intoNousResearch:mainfrom
Open
feat(shm): Zero-Copy SHM Transport & Remote SkyRL Integration#440RUFFY-369 wants to merge 13 commits intoNousResearch:mainfrom
RUFFY-369 wants to merge 13 commits intoNousResearch:mainfrom
Conversation
for more information, see https://pre-commit.ci
Properly exported SHM primitives in atroposlib.api. Added technical documentation for the SkyRL bridge and a dedicated local test runner (test_shm.sh). Verified with library tests.
ea01ce3 to
2776ea1
Compare
9366abf to
463aa79
Compare
for more information, see https://pre-commit.ci
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.
PR Type
📝 General Information
Description
This PR introduces a major architectural enhancement to the Atropos environment ecosystem: a Zero-Copy Shared Memory (SHM) transport backplane.
While this work was primarily driven by the need for high-speed SkyRL integration, the SHM transport is implemented as a generic, opt-in feature in BaseEnv. This allows any Atropos environment to bypass the traditional HTTP/JSON "serialization tax," which has historically limited per-node throughput to ~2k trajectories per second (benchmarked on RTX 3090 cluster).
Key Technical Changes:
ZeroCopySHMBufferas a core utility. It utilizesmultiprocessing.shared_memoryandnumpyviews to enable near-instantaneous transmission of trajectories, scores, and metadata across local-node processes.read_idx,write_idx) to ensure 100% data integrity during high-concurrency collection (e.g., 4+ environment workers writing to a single trainer).BaseEnvIntegration: Added native support for SHM transport at the root environment level. Environments can now opt-in to binary-level streaming, bypassing the aiohttp stack entirely.Performance Benchmarks:
Hardware: 2x RTX 3090
Baseline (HTTP/JSON): ~2,000 traj/s
Zero-Copy SHM: 37,848 traj/s (~19x improvement)
Micro-bench (Latency): 0.10ms (SHM) vs 237ms (JSON)
Integrity: Verified 100% metadata/logprob retention across 1M samples.
Related Issues
Solves issue #439
Type of Change
✅ Developer & Reviewer Checklist