RL's Roots: Three Pillars of Learning Optimal Passes

The ability of Reinforcement Learning to optimize compiler passes stems from the convergence of three historical research threads: optimal control and dynamic programming (pioneered by Richard Bellman), trial-and-error learning from animal psychology, and temporal-difference learning (leading to methods like Q-learning).

The top 3

  1. Q-Learning's Foundational Role in Compiler Optimization: Q-learning, a value-based reinforcement learning algorithm, pioneered the optimization of compiler pass sequences by learning the optimal Q-values for state-action pairs, guiding the selection of beneficial transformations that maximize cumulative rewards like reduced execution time or code size.
  2. Policy Gradients: Directly Learning Optimal Compiler Strategies: Policy-based methods, including REINFORCE and Proximal Policy Optimization (PPO), directly learn a mapping from program states to optimal compiler actions or passes. This approach is highly effective for sequential decision-making in complex compiler optimization pipelines with high-dimensional action spaces.
  3. Model-Based RL: Simulating & Planning Compiler Optimizations: Model-based reinforcement learning aims to build a predictive model of the compiler environment, allowing the agent to simulate the effects of different pass sequences without costly real-world compilation. This enables efficient planning and exploration of optimization strategies, potentially accelerating the search for optimal compiler configurations.

Sources

Open the full topic