TL;DR
SwiftRL introduces the first implementation and optimization of offline Reinforcement Learning (RL) workloads on real-world Processing-In-Memory (PIM) hardware. By executing computations directly inside memory banks, SwiftRL bypasses the classic "memory wall," achieving near-linear performance scaling and significantly outperforming traditional CPU and GPU setups.
What Problem Does This Paper Address?
In reinforcement learning—particularly offline RL, where an agent learns from massive pre-collected experience logs—training is heavily bottlenecked by data movement. As processors repeatedly sample huge datasets of states, actions, and rewards, traditional architectures (CPUs and GPUs) waste significant time and energy shuffling data back and forth between memory chips and compute units.
To quantify this, the authors utilize a roofline model to demonstrate that standard CPU implementations of popular RL algorithms sit squarely within the memory-bound region. SwiftRL tackles this bottleneck by exploring the potential of emerging Processing-In-Memory (PIM) architectures to accelerate these workloads.
Methods
The authors design and implement SwiftRL, adapting Tabular Q-learning and SARSA algorithms to run on commercial UPMEM PIM systems. Instead of moving data to the processor, UPMEM embeds simple, highly parallel RISC cores (DRAM Processing Units, or DPUs) directly alongside DRAM banks.
To make RL algorithms compatible and efficient on this hardware, SwiftRL introduces several key co-design strategies:
- Data Partitioning: The experience dataset is split into equal chunks and distributed across thousands of PIM cores to maximize parallel execution.
- Fixed-Point Optimization (INT32): Real-world PIM cores often lack native floating-point (FP32) hardware support, meaning floating-point operations must be emulated in software, which is painfully slow. SwiftRL bypasses this by converting the math to 32-bit fixed-point representations, scaling variables up by a factor of 10,000 during computation, and descaling them afterward.
- Custom PIM Routines: Standard library functions like
rand()are unsupported or inefficient on PIM hardware, so the authors implement custom, lightweight alternatives (such as a linear congruential generator) directly on the cores. - Multi-Agent Parallelism: SwiftRL scales naturally to multi-agent reinforcement learning by pinning independent learning agents to individual PIM cores, allowing them to train concurrently on agent-specific datasets without requiring inter-core communication.
Datasets
SwiftRL was evaluated using two classic environments from OpenAI Gym:
- Frozen Lake: A grid-world environment where the agent must cross a slippery frozen lake. The authors collected a dataset of 1 million transitions.
- Taxi: A more complex environment involving navigating, picking up, and dropping off passengers. Because it features a state space 31.25× larger than Frozen Lake, the authors collected a larger dataset of 5 million transitions.
Both datasets were generated using an exploratory random behavior policy until a specific performance threshold was reached.
Key Insights and Ideas
- The Random Access Advantage: PIM is exceptionally well-suited for random memory access patterns, which frequently occur during the exploratory sampling phases of RL. However, the authors note that for strictly sequential or stride-based data access, traditional CPUs still hold an edge because their hardware prefetchers are highly optimized for data locality.
- Hardware-Algorithmic Co-Design is Mandatory: Simply porting standard RL code to a PIM architecture yields poor results due to hardware limitations like emulated floating-point math. The real breakthrough of SwiftRL comes from restructuring the underlying algorithm (e.g., the INT32 scaling trick) to match the hardware's native strengths.
- Embracing Asynchrony: PIM cores lack direct inter-core communication channels; they must communicate through the host CPU. SwiftRL successfully mitigates this by allowing PIM cores to train asynchronously on local Q-tables, periodically synchronizing via the host without degrading the final policy's quality.
Key Results
- Near-Linear Scaling: SwiftRL demonstrates excellent strong scaling. Increasing the number of PIM cores by 16× (from 125 to 2,000 cores) yields a 15× speedup in kernel execution time.
- Substantial Speedups over CPU/GPU: When utilizing the fixed-point (INT32) optimization, SwiftRL achieves at least a 1.62× speedup over an Intel Xeon Silver CPU and a 4.84× speedup over an NVIDIA RTX 3090 GPU.
- Algorithmic Scalability: For multi-agent workloads training 2,000 independent agents simultaneously, SwiftRL achieves a massive 21.92× speedup compared to a multi-threaded Xeon CPU baseline.
- Uncompromised Training Quality: Despite the fixed-point approximations and asynchronous training, the final aggregated policies achieve mean rewards on par with (or slightly better than) traditional CPU training.
Limitations and Future Work
- Tabular vs. Deep RL: SwiftRL is strictly evaluated on tabular RL methods (Q-tables). Modern, large-scale applications typically rely on Deep Reinforcement Learning (DRL), which substitutes Q-tables with deep neural networks. Extending this framework to DRL remains a major open challenge.
- The Synchronization Bottleneck: As the state-action space grows (as seen in the Taxi environment), the amount of data that needs to be transferred back to the host CPU for synchronization increases. For very large state spaces, this inter-core communication overhead can begin to diminish PIM's performance gains.
- UPMEM Hardware Constraints: The current hardware generation features tight constraints, such as a small 24KB instruction memory (IRAM) per core, limiting the complexity of the code that can be deployed directly inside the memory.
Summary updated