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

ParaGraph: Weighted Graph Representation for Performance Optimization of HPC Kernels

Ali TehraniJamsaz, Alok Mishra, Akash Dutta, Abid M. Malik, Barbara M. Chapman, Ali Jannesari

TL;DR

ParaGraph is a novel weighted graph representation for programs that allows Machine Learning models to "see" the performance-critical features of High-Performance Computing (HPC) code. By augmenting standard syntax trees with control-flow edges and weights representing loop iterations, it enables Graph Neural Networks (GNNs) to predict kernel runtimes on CPUs and GPUs with remarkably low error rates.

What Problem Does This Paper Address?

Optimizing code for modern supercomputers is a nightmare for developers. We are in the era of "heterogeneous computing," where a single program might run across a mix of CPUs and various GPUs (NVIDIA, AMD, etc.). Tools like OpenMP help by using "directives" (code annotations) to handle parallelism, but choosing the right strategy—like which loops to collapse or when to offload data to a GPU—remains a manual, tedious process.

Machine Learning (ML) could automate these choices, but ML models are only as good as the data they consume. Standard ways of representing code—like treating it as a sequence of text tokens or a basic Abstract Syntax Tree (AST)—fail to capture the "dynamic" soul of HPC code. They don't explicitly show how many times a loop runs, how data flows between variables, or how parallel threads divide the workload. This paper introduces ParaGraph to bridge that gap.

Methods

The authors built ParaGraph by starting with a standard Clang AST and "supercharging" it with three layers of information:

  1. Enhanced Connectivity: They added edges to show the order of tokens (NextToken), the order of "sibling" nodes in the tree (NextSib), and links between where a variable is used and where it was defined (Ref).
  2. Control Flow Awareness: They introduced specific edges for loops (ForExec, ForNext) and conditionals (ConTrue, ConFalse). This transforms a static tree into something that behaves more like a map of the program's execution path.
  3. The "Weighted" Secret Sauce: This is the core innovation. They assigned weights to edges to represent the "workload." For example, if a loop runs 100 times, the edges within that loop get a weight of 100. If that loop is parallelized across 4 threads, the weight is divided (25 per thread) to reflect the actual work done by each processing unit.

These graphs are then fed into a Relational Graph Attention Network (RGAT), a type of deep learning model designed to process graphs where different types of connections (edges) carry different meanings.

Datasets

Because there is a lack of public datasets for OpenMP GPU offloading, the authors created their own:

  • Applications: 17 kernels from 9 diverse domains, including linear algebra (Matrix Multiplication), statistics, and medical imaging (Particle Filter).
  • Variants: They used the "OpenMP Advisor" tool to generate thousands of versions of these kernels, varying the parallelization strategy (CPU vs. GPU, loop collapsing, data transfer methods).
  • Scale: A total of ~26,000 unique data points were collected across two major clusters: Summit (IBM Power9 + NVIDIA V100) and Corona (AMD EPYC + AMD MI50).

Key Insights and Ideas

  • Structure is not Performance: A graph that shows a loop exists is useful, but a graph that shows a loop runs one million times is what a performance model actually needs. The addition of weights is the "aha" moment that allows the model to distinguish between a quick calculation and a heavy computational kernel.
  • Parallelism as a Graph Property: By dividing edge weights by the number of threads or teams, the authors successfully encoded the concept of "parallel scaling" directly into the graph's topology.
  • Ablation Proof: The researchers showed that using a "Raw AST" results in massive errors. Adding semantic edges helps, but adding weights provides the final, dramatic boost in accuracy, proving that performance modeling requires quantitative execution data, not just qualitative syntax.

Key Results

The ParaGraph-based model achieved impressive accuracy in predicting runtimes:

  • Low Error: The Normalized Root Mean Square Error (RMSE) was as low as 0.004 to 0.01 across different platforms.
  • Superiority over SOTA: It outperformed COMPOFF, the current state-of-the-art cost model. While COMPOFF only works for GPUs, ParaGraph is "architecture-agnostic," performing equally well on both CPUs and GPUs.
  • Stability: The model showed stable behavior across a wide range of runtimes, from very short kernels to those taking several seconds.

Limitations and Future Work

  • Static Estimation: ParaGraph relies on static analysis to estimate loop counts. If a loop's duration depends on complex input data values that change at runtime, the static weights might be inaccurate.
  • Simple Branching: Currently, the model assumes a 50/50 probability for if-else branches. Real-world code often has highly biased branches that could affect performance predictions.
  • Broader Ecosystems: While the paper focuses on OpenMP, the authors suggest that ParaGraph could be extended to other parallel programming models like OpenACC, Kokkos, or HIP.
  • Hybrid Features: The authors mention that combining these static graph features with dynamic "Performance Counters" (real-time hardware data) could be a powerful next step.

Summary updated

BibTeX
@inproceedings{tehranijamsaz2024paragraph,
  author = {Ali TehraniJamsaz and Alok Mishra and Akash Dutta and Abid M. Malik and Barbara M. Chapman and Ali Jannesari},
  title = {{ParaGraph: Weighted Graph Representation for Performance Optimization of HPC Kernels}},
  booktitle = {Workshops @ IPDPS},
  year = {2024},
  doi = {10.1109/ipdpsw63119.2024.00070},
}
Figure