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

Automatic Software Tailoring for Optimal Performance

José Miguel Aragón-Jurado, Juan Carlos de la Torre, Patricia Ruiz, Pedro L. Galindo, Albert Y. Zomaya, Bernabé DorronsoroIEEE Trans. Sustain. Comput 2024

Abstract

Standard compiler optimizations often fail to account for specific hardware architectures and the complex interactions between code transformations. This paper presents an automated framework that utilizes a cellular genetic algorithm (cGA) to discover optimal LLVM optimization sequences. A key contribution is the introduction of a bootstrap-based method to mitigate runtime measurement noise. Experimental results across diverse hardware platforms demonstrate performance improvements of up to 26.3% over the standard -O3 optimization level and significant reductions in energy consumption.

Introduction

Modern compilers like Clang and GCC typically rely on predefined optimization levels, such as -O3, which apply a fixed set of transformations. However, the "phase ordering problem"—where the sequence and repetition of optimizations significantly affect the final binary—makes finding a universal "best" sequence impossible. Furthermore, generic optimizations cannot exploit the unique architectural features of specific hardware, such as cache hierarchies or instruction pipelines.

A significant challenge in automating this search is runtime uncertainty. Background system processes and hardware states introduce noise into execution time measurements, potentially leading optimization algorithms toward suboptimal solutions based on "lucky" runs.

Methodology

The proposed framework addresses the Software Code Optimization Problem (SCOP) by combining evolutionary search with robust statistical analysis.

Cellular Genetic Algorithm (cGA)

The framework employs a cGA to explore the vast search space of LLVM transformation passes. Unlike traditional genetic algorithms, a cGA organizes its population in a toroidal mesh. Individuals only interact with their immediate neighbors, which preserves genetic diversity and prevents premature convergence to local optima. The search space includes 87 distinct LLVM passes, with each individual represented as a sequence of 300 operations.

Overview of the automated software tailoring framework.

Bootstrap Uncertainty Handling

To combat measurement noise, the authors introduce a bootstrap technique. Rather than relying on a single execution or a simple average, the framework executes a program multiple times (e.g., 15) and generates 500 bootstrap subsets to construct a 95% confidence interval for the runtime. The most effective approach, termed wcase15, focuses on the worst-case execution times within these intervals, providing a more stable and representative fitness metric for the GA.

Experimental Evaluation

The framework was evaluated using the Polybench benchmark suite, covering 15 computational kernels across linear algebra, solvers, and multiresolution analysis. Testing spanned four diverse hardware architectures:

  • Raspberry Pi 3B+ (Low-power ARM)
  • Latte Panda Alpha (Intel Core M3)
  • Intel Core i7-7700K (High-performance Desktop)
  • Kunpeng 920 (ARM-based HPC server)

Results and Discussion

The tailored optimization sequences consistently outperformed standard compiler flags. Compared to unoptimized code (-O0), execution times were reduced by 28.1% to 63.2%. More importantly, the framework achieved gains of 13.9% to 26.3% over the industry-standard -O3 level.

Comparison of runtime distributions between original and optimized software using the wcase15 method.

The study also highlighted the "green" benefits of software tailoring. On the Raspberry Pi, the optimized code consumed approximately 30% less energy. By reducing execution time, hardware components can transition to low-power states sooner, directly contributing to energy efficiency.

Analysis of the winning passes revealed hardware-specific preferences. For instance, Intel systems benefited from -loop-rotate, while ARM-based HPC systems favored -loop-unswitch. The wcase15 method proved highly reliable, providing a 100% representative fitness estimation in most test cases.

Conclusion

This research demonstrates that automated, hardware-specific software tailoring can yield substantial performance and energy benefits over generic compiler optimizations. While the evolutionary search process is computationally intensive, the resulting performance gains justify the investment for critical software components. Future work will explore multi-objective optimization (e.g., balancing speed and memory footprint) and the use of machine learning to predict optimal passes more efficiently.

Summary updated

BibTeX
@article{aragonjurado2024automatic,
  author = {José Miguel Aragón-Jurado and Juan Carlos de la Torre and Patricia Ruiz and Pedro L. Galindo and Albert Y. Zomaya and Bernabé Dorronsoro},
  title = {{Automatic Software Tailoring for Optimal Performance}},
  journal = {IEEE Trans. Sustain. Comput.},
  year = {2024},
  doi = {10.1109/tsusc.2023.3330671},
}
Figure