Reinforcement Learning for Automated Pragma-Based Loop Optimization

Jiaxuan Li, Qilong Zheng · 2025

Loops often dominate the execution time in high-performance computing, effective loop optimization is critical for overall performance. We propose a reinforcement learning–based framework that automatically discovers and composes transformations—including tiling, fusion, interchange, and unrolling—and evaluate the framework on a subset of Polybench benchmarks. Compared to the Polly compiler baseline, our approach achieves an average speedup of 2.46×, peaking at 7× on the jacobi-1d kernel, while also consistently outperforming a global greedy scheduling algorithm. By adaptively combining multiple transformations, the RL-based method exploits deeper synergies with minimal overhead once trained, thus alleviating the repeated manual tuning and hardware-specific adjustments required by conventional techniques.

Read the paper · More papers on PaperTik