Abstract
Porting CPU kernels to GPUs is a resource-intensive process with uncertain performance outcomes. This paper presents Static XAPP, a machine learning framework that predicts GPU speedups using static analysis of source code. By analyzing LLVM Intermediate Representation (IR) and employing a Random Forest classifier, the framework identifies high-potential kernels with 94% accuracy without requiring code execution or profiling. Our results demonstrate that structural program features are sufficiently explanatory for cross-architecture performance prediction, offering a significant reduction in wasted development effort.
Introduction
The transition from CPU to GPU architectures is a notoriously slow and tedious process. Developers must restructure data for complex memory hierarchies and maximize parallelism, often spending weeks on optimization only to find that architectural overheads negate any performance gains. Existing prediction tools typically require execution-based binary instrumentation—which can slow execution by up to 1000x—or manual expert estimation via models like the Roofline model.
Static XAPP addresses this by providing an automated, execution-free "go/no-go" signal. This "third way" of performance prediction allows developers to prioritize kernels with high speedup potential before the porting process begins.
Methodology
Static XAPP utilizes a novel IR-based workflow to bridge the gap between static code structure and dynamic performance:
- Static Feature Extraction: The tool extracts 10 specific program properties from the LLVM IR, including memory coalescing patterns, branch divergence, and instruction intensities.
- Discretization: To mitigate the inherent imprecision of static analysis (e.g., unknown loop trip counts), the authors use equal frequency binning. Converting continuous numerical features into discrete categories (Low, Medium, High) trades raw precision for model robustness.
- Machine Learning: A Random Forest (RF) classifier, consisting of 1000 decision trees, is trained to identify complex correlations between these discretized static properties and observed speedups.
Experimental Setup
The study utilized a dataset of 156 datapoints derived from ~80 core kernels in the Lonestar, Rodinia, and NAS suites. To overcome the "small dataset regime," the authors employed data augmentation through perturbation, manually modifying code snippets to create diverse performance profiles. Evaluation was conducted on two NVIDIA platforms: the Maxwell-based GTX 750 and the Kepler-based GTX 660 Ti.
Key Results and Insights
Static XAPP demonstrates that the "essence" of a program's suitability for GPU acceleration is visible in its static structure. The framework achieved a peak binary classification accuracy of 94% when predicting whether a kernel would achieve at least a 3x speedup.
A critical finding is the model's 98% Negative Predictive Value (NPV). As shown in the confusion matrix, the model rarely misclassifies a low-potential kernel as high-potential. For engineers, this means that if the tool suggests a kernel is not worth porting, that recommendation is almost certainly correct.
Furthermore, the model maintains stability across different hardware generations and varying speedup definitions. While accuracy naturally fluctuates based on the specific "Speedup Cutoff Point" chosen to define a successful port, the average accuracy remains high across both tested platforms.
Discussion and Future Work
While the current dataset of 156 points is sufficient for Random Forest models, larger datasets would be required to leverage deep learning architectures. Additionally, the current static analysis approach is most effective for kernels representable in standard IR; pointer-heavy or non-affine programs remain a challenge.
Future iterations of Static XAPP could be integrated directly into IDEs, providing real-time "Potential GPU Speedup" tooltips. Such integration would allow for automated device placement in heterogeneous clusters, further streamlining the development of high-performance applications.
Summary updated