Machine-learning-guided compiler optimization for FPGAs

Learning LLVM pass sequences for high-level synthesis

High-level synthesis compiles C/C++ code into FPGA hardware, but LLVM’s optimization pipeline is tuned for CPUs and serves FPGA back ends poorly. With the CAAD Lab and Red Hat, I worked on letting a learned agent choose the LLVM pass sequence instead, rewarded by the quality of the resulting hardware, and compared supervised and reinforcement-learning approaches using RNN, Transformer, and GNN models of the program. Paper (PDF) · Red Hat Collaboratory project (2022) · Red Hat Research project page

RL pass ordering for high-level synthesis An RL agent chooses the LLVM pass sequence applied to a C/C++ kernel before high-level synthesis, and learns from the resulting FPGA design's quality. C/C++ kernel LLVM passes order chosen by agent HLS tool FPGA design latency · area RL agent learns pass order pass sequence reward
up to 3×
speedup over -O3
up to 23×
faster learning

References

2022

  1. Reinforcement Learning Strategies for Compiler Optimization in High Level Synthesis
    Hafsah Shahzad, Ahmed Sanaullah, Sanjay Arora, Robert Munafo, Xiteng Yao, Ulrich Drepper, and Martin Herbordt
    In IEEE/ACM Workshop on the LLVM Compiler Infrastructure in HPC (LLVM-HPC), held with SC22, Dallas, 2022