Skip to content

feat(shm): Zero-Copy SHM Transport & Remote SkyRL Integration#440

Open
RUFFY-369 wants to merge 13 commits intoNousResearch:mainfrom
RUFFY-369:feat/skyrl-shm-reasoning-infra
Open

feat(shm): Zero-Copy SHM Transport & Remote SkyRL Integration#440
RUFFY-369 wants to merge 13 commits intoNousResearch:mainfrom
RUFFY-369:feat/skyrl-shm-reasoning-infra

Conversation

@RUFFY-369
Copy link
Copy Markdown

@RUFFY-369 RUFFY-369 commented Apr 6, 2026

PR Type

  • RL Environment PR - Complete Environment Snapshot & Zero-Training sections
  • Non-Environment PR - Complete Description, Related Issues & Type of Change sections

📝 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:

  • General Purpose SHM Buffer: Implemented ZeroCopySHMBuffer as a core utility. It utilizes multiprocessing.shared_memory and numpy views to enable near-instantaneous transmission of trajectories, scores, and metadata across local-node processes.
  • SkyRL Orchestration: Provides the technical foundation for the corresponding SkyRL PR: feat: native Atropos-SHM integration and modular ingestion layer NovaSky-AI/SkyRL#1473 . This includes native support for reasoning-dense traces (Thinking Traces + PRM) and synchronized Task ID tracking.
  • Atomic Pointer Safety: Refined index management (read_idx, write_idx) to ensure 100% data integrity during high-concurrency collection (e.g., 4+ environment workers writing to a single trainer).
  • BaseEnv Integration: 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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Code refactor (no functional changes)
  • Build/CI/CD related changes
  • Other (please describe):


✅ Developer & Reviewer Checklist

  • Code follows project style (black, isort, flake8 pass with pre-commit)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes
  • Docstrings added for all new public classes / functions
  • If .env vars required, did you add it to the .env.example in repo root?

@RUFFY-369 RUFFY-369 force-pushed the feat/skyrl-shm-reasoning-infra branch 2 times, most recently from ea01ce3 to 2776ea1 Compare April 7, 2026 22:12
@RUFFY-369 RUFFY-369 force-pushed the feat/skyrl-shm-reasoning-infra branch from 9366abf to 463aa79 Compare April 7, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant