A Software-Hardware Co-Optimized Toolkit for Deep Reinforcement Learning on Heterogeneous Platforms

Yuan Meng, Michael Kinsner, Deshanand P. Singh, Mahesh A. Iyer, Viktor K. PrasannaarXiv 2023

Abstract

Deep Reinforcement Learning (DRL) is vital in various AI applications. DRL algorithms comprise diverse compute kernels, which may not be simultaneously optimized using a homogeneous architecture. However, even with available heterogeneous architectures, optimizing DRL performance remains a challenge due to the complexity of hardware and programming models employed in modern data centers. To address this, we introduce PEARL, a toolkit for composing parallel DRL systems on heterogeneous platforms consisting of general-purpose processors (CPUs) and accelerators (GPUs, FPGAs). Our innovations include:

  1. A general training protocol agnostic of the underlying hardware, enabling portable implementations across various processors and accelerators.
  2. Incorporation of DRL-specific scheduling optimizations within the protocol, facilitating parallelized training and enhancing the overall system performance.
  3. High-level API for productive development using the toolkit.
  4. Automatic optimization of DRL task-to-device assignments through performance estimation, supporting various optimization metrics including throughput and power efficiency. We showcase our toolkit through experimentation with two widely used DRL algorithms, DQN and DDPG, on two diverse heterogeneous platforms. The generated implementations outperform state-of-the-art libraries for CPU-GPU platforms by throughput improvements of up to 2.1$\times$ and power efficiency improvements of up to 3.4$\times$.

Introduction

Deep Reinforcement Learning (DRL) is computationally diverse, comprising three primary tasks with conflicting hardware requirements:

  1. Policy Execution (Actors): Simulation-heavy tasks that gather experience data.
  2. Dataset Management (Replay Buffer): Memory-bound tasks involving complex data structures like "sum trees" for prioritized sampling.
  3. Training (Learner): Compute-intensive tasks, such as gradient descent, typically optimized for GPUs.

While modern data centers provide heterogeneous architectures (CPUs, GPUs, FPGAs), manually optimizing DRL algorithms across these devices is complex and time-consuming. Developers often default to homogeneous implementations, leaving significant performance and power efficiency on the table. PEARL addresses this by automatically mapping DRL tasks to the most efficient hardware available.

The PEARL Toolkit Architecture

PEARL bridges the gap between high-level DRL algorithms and low-level hardware optimization through a modular toolchain. It allows developers to generate highly optimized, heterogeneous systems with minimal code.

Overview of the PEARL toolkit components and workflow.

Core components of the toolkit include:

  • System Composer: The central engine that takes user algorithm and hardware specifications to decide which task should run on which device to maximize throughput or power efficiency.
  • Parameterized Primitive Library: A collection of optimized templates for DRL tasks. For instance, the FPGA-based Replay Manager uses a pipelined architecture to handle updates near-memory, bypassing the latency bottlenecks common in GPU implementations.
  • Host Runtime Code Generator: Automatically produces the necessary host code to execute the optimized system across the target hardware.

Unified Training Protocol and Scheduling

PEARL employs a hardware-agnostic training protocol built on oneAPI and SYCL, ensuring portability across diverse processors. A critical innovation within this protocol is Collision-Free Scheduling.

PEARL's unified training protocol and collision-free scheduling mechanism.

This scheduling approach defers data insertion into the Replay Buffer to prevent "data contamination" (where the learner might read partially written data). By batching insertions and overlapping them with the training process, PEARL effectively removes the Replay Buffer's latency from the system's critical path, significantly boosting overall throughput.

Evaluation and Results

The toolkit was evaluated using OpenAI Gym benchmarks (CartPole, MountainCar, and Pong) with DQN and DDPG algorithms on diverse heterogeneous platforms.

  • Throughput: PEARL-generated implementations outperformed industry-standard libraries like RLlib and Stable Baselines 3 by up to 2.1x in terms of experiences processed per second.
  • Power Efficiency: By leveraging FPGAs for memory-bound Replay Buffer tasks, PEARL achieved up to 3.4x higher performance-per-watt than GPU-only configurations.
  • Portability: The toolkit demonstrated high portability, allowing diverse hardware combinations (e.g., CPU+iGPU vs. CPU+GPU+FPGA) to be utilized with minimal code divergence ($\approx 0.05$).

Conclusion

PEARL simplifies the deployment of DRL on heterogeneous hardware while delivering substantial performance gains. Future work will focus on expanding support for integrated GPUs in vision-heavy tasks and scaling the toolkit for disaggregated data center environments where resources are networked across multiple nodes.

Summary updated

BibTeX
@misc{meng2023software,
  author = {Yuan Meng and Michael Kinsner and Deshanand P. Singh and Mahesh A. Iyer and Viktor K. Prasanna},
  title = {{A Software-Hardware Co-Optimized Toolkit for Deep Reinforcement Learning on Heterogeneous Platforms}},
  year = {2023},
  eprint = {2311.09445},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.09445},
}
Figure