Abstract
Optimizing code for High-Performance Computing (HPC) environments is a complex challenge due to the diversity of hardware architectures and the sensitivity of performance to input data. Traditional auto-tuning methods often rely on brute-force search or unimodal machine learning models that fail to capture the full complexity of program behavior. This paper presents the Multimodal Graph Neural Network and Autoencoder (MGA) tuner, a framework that integrates structural, semantic, and dynamic context to automate performance tuning. Our results demonstrate significant improvements over state-of-the-art methods, achieving up to a 3.4x speedup in OpenMP thread prediction and 98% accuracy in OpenCL device mapping.
1. Introduction
In modern HPC, achieving peak performance requires precise tuning of parameters such as thread counts, scheduling policies, and hardware placement. However, a configuration that excels on one processor may perform poorly on another, or fail when input sizes change. Developers typically rely on exhaustive search-based tuners, which are computationally expensive, or machine learning models that analyze code either as text (syntax) or as a graph (structure).
This paper addresses the limitations of these "unimodal" approaches by proposing the MGA tuner. By simultaneously analyzing code structure, instruction semantics, and real-time hardware feedback, MGA provides a holistic view of the software-hardware interaction, enabling faster and more accurate optimization.
2. The MGA Framework
The MGA tuner architecture is built upon three distinct modalities, fused to make final optimization decisions:
2.1 Structural Modeling (Heterogeneous GNN)
To capture the logical flow of the program, MGA utilizes ProGraML to represent code as a multi-graph encompassing data flow, control flow, and function calls. Unlike standard Graph Neural Networks (GNNs) that treat all edges identically, MGA employs a Heterogeneous GNN. This allows the model to distinguish between different types of relationships—such as a data dependency versus a function call—leading to a more nuanced understanding of program logic.
2.2 Semantic Modeling (Denoising Autoencoder)
While graphs capture structure, they often miss the specific "meaning" of instructions. MGA uses IR2Vec to generate distributed embeddings of the code, treating it as a high-dimensional mathematical space. These embeddings are processed through a Denoising Autoencoder (DAE) to compress the data and extract the most salient semantic features, filtering out noise that does not contribute to performance outcomes.
2.3 Dynamic Context (Performance Counters)
Static analysis cannot account for runtime variables like cache contention or branch mispredictions. MGA integrates dynamic feedback using the PAPI (Performance Application Programming Interface) library. By incorporating hardware performance counters, the model gains a "reality check" on how the code interacts with specific hardware under varying input loads.
3. Experimental Methodology
The framework was evaluated across a diverse set of industry-standard benchmarks, including PolyBench, Rodinia, STREAM, and NAS. Testing was conducted on multiple hardware architectures:
- CPUs: Intel Comet Lake, Broadwell, and Sandy Bridge.
- GPUs: AMD and NVIDIA architectures.
The evaluation focused on two primary tasks: predicting optimal OpenMP thread configurations and mapping OpenCL kernels to the most efficient device (CPU vs. GPU).
4. Results and Analysis
4.1 Performance Gains
The MGA tuner demonstrated substantial improvements in execution efficiency:
- OpenMP Tuning: The model achieved a geometric mean speedup of 3.4x for thread count prediction. When simultaneously tuning threads, scheduling policies, and chunk sizes, it maintained a 2.23x speedup.
- OpenCL Mapping: MGA achieved 98% accuracy in device mapping, significantly outperforming unimodal models like IR2Vec (92%) and ProGraML (86%).
4.2 Efficiency and Portability
MGA proved to be significantly faster than traditional search-based tuners. It identified near-optimal configurations in approximately 90 seconds, compared to 180–260 seconds for tools like OpenTuner or ytopt. Furthermore, the model exhibited "zero-shot" portability; a model trained on Intel Comet Lake could successfully predict performance on older Sandy Bridge architectures by simply scaling performance counter values.
5. Key Insights
The success of MGA highlights several critical factors in HPC optimization:
- Multimodal Synergy: Combining syntax and structure eliminates the "blind spots" inherent in unimodal models.
- Input Sensitivity: Researchers found that 64% of OpenMP loops require different tuning based on input size, justifying the inclusion of dynamic performance counters.
- Heterogeneity: Recognizing different edge types in program graphs is essential for modeling complex logic accurately.
6. Conclusion
The MGA tuner represents a significant step forward in automated performance optimization. By fusing structural, semantic, and dynamic data, it provides a robust and efficient alternative to manual tuning and exhaustive search. Future work will focus on transitioning from offline training to online tuning, allowing the model to adapt in real-time during application execution, and expanding support to specialized hardware such as FPGAs.
Summary updated