Abstract
Advancements in accelerated physics simulations have greatly reduced training times for reinforcement learning policies, yet the conventional step-by-step agent-simulator interaction undermines simulation accuracy. In the real-world, interactions are asynchronous, with sensing, acting and processing happening simultaneously. Failing to capture this widens the sim2real gap and results in suboptimal real-world performance. In this paper, we address the challenges of simulating realistic asynchronicity and delays within parallelized simulations, crucial to bridging the sim2real gap in complex cyber-physical systems. Our approach efficiently parallelizes cyber-physical system simulations on accelerator hardware, including physics, sensors, actuators, processing components and their asynchronous interactions. We extend existing accelerated physics simulations with latency simulation capabilities by constructing a ‘supergraph’ that encodes all data dependencies across parallelized simulation steps, ensuring accurate simulation. By finding the smallest supergraph, we minimize redundant computation. We validate our approach on two real-world systems and perform an extensive ablation, demonstrating superior performance compared to baseline methods.
Introduction
Modern reinforcement learning (RL) and robotics simulators, such as Brax or Isaac Gym, typically rely on a simplified, sequential "Step → Observe → Act" loop. While this model is easily parallelized on GPUs, it ignores the complexities of physical hardware: sensors have lag, controllers have processing delays, and different components often run at different frequencies. This discrepancy creates a significant sim2real gap, where policies trained in "clean" simulations fail on real robots due to uncompensated latency.
The Challenge of Asynchronicity
Simulating these delays on a GPU is notoriously difficult. Because different parallel simulation instances might experience different delays at different times, the execution paths diverge. This causes "thread divergence," forcing the GPU to serialize operations and destroying the speed advantages of parallelization.
Methodology: Minimum Common Supergraph (MCS)
We propose a technique called Minimum Common Supergraph (MCS) search to handle asynchrony efficiently. The core idea is to represent the interactions within a CPS as a Directed Acyclic Graph (DAG), where vertices are computations (sensing, acting, physics) and edges are data dependencies.
Since delays make the graph structure vary from one step to the next, we find a single "supergraph" that contains all possible execution paths as subgraphs. Instead of using if-else statements, the GPU executes the entire supergraph for every instance. We use "predication masks"—binary flags that tell the GPU to ignore specific nodes or edges that aren't active in a particular simulation step.
Finding the absolute smallest supergraph is an NP-hard problem. We developed a greedy algorithm that leverages the inherent periodicity of CPS to find a near-optimal supergraph quickly. The algorithm includes a backtracking parameter ($\beta$) to re-evaluate previous partitioning decisions, ensuring the supergraph remains as compact as possible.
Experimental Evaluation
The approach was evaluated using four distinct simulated environments:
- Pendulum Swing-up: A benchmark showing how simple systems fail when delays are ignored.
- Vision-based Box Pushing: A robotic manipulator (Viper 300x) using a webcam, testing high-latency scenarios.
- V2V (Vehicle-to-Vehicle) Platooning: A scalability test involving multiple vehicles coordinating via shared sensor data.
- UAV Swarm Control: A complex topology where a central controller manages a swarm of drones.
Key Results and Insights
Our results demonstrate that efficiency is directly tied to the size of the supergraph. By finding the minimum supergraph, we minimize "wasted" computation on masked-out nodes.
- Massive Throughput: In the pendulum task, the MCS approach achieved a simulation speed of approximately 3 million frames per second (fps) on a consumer-grade RTX 3070 GPU.
- Superior Compactness: The MCS method produced supergraphs significantly smaller than standard baselines (e.g., 13 vertices vs. 43 for a topological baseline in the pendulum task).
- Improved Accuracy: In the manipulation task using Model Predictive Control (MPC), the MCS approach achieved 40% higher accuracy than the delay-agnostic sequential baseline.
- Scalability: The method successfully scaled to swarms of up to 64 nodes, maintaining high efficiency.
Limitations and Future Work
The current algorithm assumes that the structure of the computation graph does not depend on the values of the data being processed. It cannot currently model "dynamic" delays, such as a vision algorithm taking longer to process a complex scene. Future work will focus on integrating this approach into frameworks like JAX to allow for the automatic alignment of dynamic computation graphs with static, parallelizable ones.
Summary updated