NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

ProGraML: Graph-based Deep Learning for Program Optimization and Analysis

Chris Cummins, Zacharias V. Fisches, Tal Ben-Nun, Torsten Hoefler, Hugh LeatherarXiv 2020

Introduction

Optimizing compilers are the unsung heroes of software performance, but they traditionally rely on "heuristics"—hand-tuned rules of thumb—to make critical decisions. As hardware architectures like GPUs and TPUs grow in complexity, maintaining these heuristics manually has become unsustainable.

While Machine Learning (ML) offers a path to automate these decisions, existing approaches often treat code as sequential text or simplified trees (ASTs). These representations frequently fail because they cannot capture long-range dependencies (e.g., a variable defined on line 10 and used on line 1000) or the rigid logic of program structure. ProGraML (Program Graphs for Machine Learning) addresses these issues by introducing a novel graph-based representation that captures the complex semantics of computer programs in a language-agnostic format.

The ProGraML Framework

The authors represent a program as a directed attributed multigraph. Unlike previous models, ProGraML combines three distinct types of edges into a single unified structure:

  • Control Flow: The execution paths through instructions.
  • Data Flow: The relationships between variables/constants and the instructions that use or produce them.
  • Call Flow: Inter-procedural connections between different functions.
The ProGraML pipeline integrates graph-based program representations into the compiler optimization loop using Message Passing Neural Networks.

Crucially, ProGraML adds positional labels to edges, allowing the model to distinguish between the first and second operands of non-commutative operations (like division) or different branches of a switch statement. This focus on structure over syntax ensures the model is immune to "noise" like variable names or coding styles.

Methods and Modeling

To process these complex graphs, the researchers utilize Message Passing Neural Networks (MPNNs). The architecture of an MPNN is a natural fit for compiler theory: traditional iterative data-flow algorithms and MPNNs both rely on local updates that eventually reach a global stable state. In this framework, each node (instruction, variable, or constant) starts with an initial embedding. During iterative message-passing steps, nodes exchange information with their neighbors, mimicking the way information propagates through a program during analysis.

Comparative Representations

Existing methods often fall short by relying on surface-level features or incomplete graphs. For example, models like code2vec can be overly sensitive to variable naming rather than underlying logic, while other graph formats like XFG or CDFG may lack the comprehensive flow integration found in ProGraML.

Comparison of program representations: (a) code2vec's sensitivity to naming, (b) XFG, and (c) CDFG.

Key Results

The study utilized a massive corpus of 250,000 LLVM-IR files across six languages, including C, C++, and Swift. ProGraML demonstrated state-of-the-art performance across several domains:

  • Compiler Analysis: ProGraML achieved an average 94.0 $F_1$ score across five fundamental analysis tasks (e.g., Reachability, Data Dependencies), compared to just 27.3 for a sequential LSTM baseline.
  • Heterogeneous Device Mapping: It achieved 86.6% accuracy on AMD and 80.0% on NVIDIA platforms for predicting whether a kernel should run on a CPU or GPU.
  • Algorithm Classification: On the POJ-104 benchmark, it set a new state-of-the-art with a 3.33% test error, a 1.27× improvement over previous methods.

Limitations and Future Work

While powerful, the model faces challenges with scalability for massive graphs and vocabulary coverage for rare instructions. Additionally, the fixed number of message-passing steps may not be sufficient for extremely complex programs with deep loop nesting. Future research may explore IR-to-IR transpilation—using ML to actually rewrite and optimize code—and automatic parallelization.

Summary updated

BibTeX
@misc{cummins2020programl,
  author = {Chris Cummins and Zacharias V. Fisches and Tal Ben-Nun and Torsten Hoefler and Hugh Leather},
  title = {{ProGraML: Graph-based Deep Learning for Program Optimization and Analysis}},
  year = {2020},
  eprint = {2003.10536},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2003.10536},
}
Figure