skip to main content
research-article

Compiler Autotuning through Multiple-phase Learning

Authors Info & Claims
Published:18 April 2024Publication History
Skip Abstract Section

Abstract

Widely used compilers like GCC and LLVM usually have hundreds of optimizations controlled by optimization flags, which are enabled or disabled during compilation to improve the runtime performance (e.g., small execution time) of the compiler program. Due to the large number of optimization flags and their combination, it is difficult for compiler users to manually tune compiler optimization flags. In the literature, a number of autotuning techniques have been proposed, which tune optimization flags for a compiled program by comparing its actual runtime performance with different optimization flag combinations. Due to the huge search space and heavy actual runtime cost, these techniques suffer from the widely recognized efficiency problem. To reduce the heavy runtime cost, in this article we propose a lightweight learning approach that uses a small number of actual runtime performance data to predict the runtime performance of a compiled program with various optimization flag combinations. Furthermore, to reduce the search space, we design a novel particle swarm algorithm that tunes compiler optimization flags with the prediction model. To evaluate the performance of the proposed approach, CompTuner, we conduct an extensive experimental study on two popular C compilers, GCC and LLVM, with two widely used benchmarks, cBench and PolyBench. The experimental results show that CompTuner significantly outperforms the six compared techniques, including the state-of-the-art technique BOCA.

REFERENCES

  1. [1] Agakov Felix V., Bonilla Edwin V., Cavazos John, Franke Björn, Fursin Grigori, O’Boyle Michael F. P., Thomson John, Toussaint Marc, and Williams Christopher K. I.. 2006. Using machine learning to focus iterative optimization. In 4th IEEE/ACM International Symposium on Code Generation and Optimization (CGO’06). IEEE Computer Society, 295305.Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. [2] Almagor Lelac, Cooper Keith D., Grosul Alexander, Harvey Timothy J., Reeves Steven W., Subramanian Devika, Torczon Linda, and Waterman Todd. 2004. Finding effective compilation sequences. ACM SIGPLAN Notices 39, 7 (2004), 231239.Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. [3] Ansel Jason, Kamil Shoaib, Veeramachaneni Kalyan, Ragan-Kelley Jonathan, Bosboom Jeffrey, O’Reilly Una-May, and Amarasinghe Saman P.. 2014. OpenTuner: An extensible framework for program autotuning. In International Conference on Parallel Architectures and Compilation (PACT’14), Amaral José Nelson and Torrellas Josep (Eds.). ACM, 303316.Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. [4] Ashouri Amir Hossein. 2016. Compiler Autotuning Using Machine Learning Techniques. Ph.D. thesis, 34.Google ScholarGoogle Scholar
  5. [5] Ashouri Amir H., Bignoli Andrea, Palermo Gianluca, Silvano Cristina, Kulkarni Sameer, and Cavazos John. 2017. Micomp: Mitigating the compiler phase-ordering problem using optimization sub-sequences and machine learning. ACM Transactions on Architecture and Code Optimization (TACO) 14, 3 (2017), 128.Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. [6] Ashouri Amir H., Killian William, Cavazos John, Palermo Gianluca, and Silvano Cristina. 2018. A survey on compiler autotuning using machine learning. ACM Computing Surveys (CSUR) 51, 5 (2018), 142.Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. [7] Ashouri Amir Hossein, Mariani Giovanni, Palermo Gianluca, Park Eunjung, Cavazos John, and Silvano Cristina. 2016. COBAYN: Compiler autotuning framework using bayesian networks. ACM Transactions on Architecture and Code Optimization 13, 2, Article 21 (June2016), 25 pages.Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. [8] Ashouri Amir H., Palermo Gianluca, Cavazos John, and Silvano Cristina. 2018. Automatic Tuning of Compilers Using Machine Learning. Springer.Google ScholarGoogle ScholarCross RefCross Ref
  9. [9] Bergstra James, Bardenet Rémi, Bengio Yoshua, and Kégl Balázs. 2011. Algorithms for hyper-parameter optimization. Advances in Neural Information Processing Systems 24 (2011), 25462554.Google ScholarGoogle Scholar
  10. [10] Cavazos John, Fursin Grigori, Agakov Felix, Bonilla Edwin, O’Boyle Michael F. P., and Temam Olivier. 2007. Rapidly selecting good compiler optimizations using performance counters. In International Symposium on Code Generation and Optimization (CGO’07). IEEE, 185197.Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. [11] cBench. 2022. https://ctuning.org/wiki/index.php/CTools:CBenchGoogle ScholarGoogle Scholar
  12. [12] Chen Junjie, Xu Ningxin, Chen Peiqi, and Zhang Hongyu. 2021. Efficient compiler autotuning via Bayesian optimization. In 2021 IEEE/ACM 43rd International Conference on Software Engineering (ICSE’21). IEEE, 11981209.Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. [13] Chen Yang, Fang Shuangde, Huang Yuanjie, Eeckhout Lieven, Fursin Grigori, Temam Olivier, and Wu Chengyong. 2012. Deconstructing iterative optimization. ACM Transactions on Architecture and Code Optimization (TACO) 9, 3 (2012), 130.Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. [14] Cummins Chris, Petoumenos Pavlos, Wang Zheng, and Leather Hugh. 2017. End-to-end deep learning of optimization heuristics. In 26th International Conference on Parallel Architectures and Compilation Techniques (PACT’17). IEEE Computer Society, 219232.Google ScholarGoogle ScholarCross RefCross Ref
  15. [15] Dogru Oguzhan, Velswamy Kirubakaran, Ibrahim Fadi, Wu Yuqi, Sundaramoorthy Arun Senthil, Huang Biao, Xu Shu, Nixon Mark, and Bell Noel. 2022. Reinforcement learning approach to autonomous PID tuning. Computers & Chemical Engineering 161 (2022), 107760.Google ScholarGoogle ScholarCross RefCross Ref
  16. [16] Du Qi and Huang Hui. 2020. Research on the realization and optimization of FFTs in ARMv8 platform. In IOP Conference Series: Materials Science and Engineering, Vol. 768. IOP Publishing, 072114.Google ScholarGoogle ScholarCross RefCross Ref
  17. [17] Du Qi, Huang Hui, and Huang Chun. 2020. Roofline model-guided compilation optimization parameter selection method. In Proceedings of Data Science: 6th International Conference of Pioneering Computer Scientists, Engineers and Educators (ICPCSEE’20), Part I 6. Springer, 268282.Google ScholarGoogle ScholarCross RefCross Ref
  18. [18] Engelke Alexis and Schulz Martin. 2020. Robust practical binary optimization at run-time using LLVM. In 2020 IEEE/ACM 6th Workshop on the LLVM Compiler Infrastructure in HPC (LLVM-HPC’20) and Workshop on Hierarchical Parallelism for Exascale Computing (HiPar’20). IEEE, 5664.Google ScholarGoogle ScholarCross RefCross Ref
  19. [19] Fischetti Matteo and Stringher Matteo. 2019. Embedded hyper-parameter tuning by Simulated Annealing. CoRR abs/1906.01504. arXiv:1906.01504 http://arxiv.org/abs/1906.01504Google ScholarGoogle Scholar
  20. [20] Frazier Peter I.. 2018. A tutorial on Bayesian optimization. arXiv preprint arXiv:1807.02811.Google ScholarGoogle Scholar
  21. [21] Garciarena Unai and Santana Roberto. 2016. Evolutionary optimization of compiler flag selection by learning and exploiting flags interactions. In Proceedings of the 2016 on Genetic and Evolutionary Computation Conference Companion. 11591166.Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. [22] GCC. 2022. https://gcc.gnu.orgGoogle ScholarGoogle Scholar
  23. [23] Haj-Ali Ameer, Ahmed Nesreen K., Willke Theodore L., Shao Yakun Sophia, Asanovic Krste, and Stoica Ion. 2020. NeuroVectorizer: End-to-end vectorization with deep reinforcement learning. In 18th ACM/IEEE International Symposium on Code Generation and Optimization (CGO’20). ACM, 242255.Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. [24] He Haochen, Jia Zhouyang, Li Shanshan, Yu Yue, Zhou Chenglong, Liao Qing, Wang Ji, and Liao Xiangke. 2022. Multi-intention-aware configuration selection for performance tuning. In 44th IEEE/ACM 44th International Conference on Software Engineering (ICSE’22). ACM, 14311442.Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. [25] Henard Christopher, Papadakis Mike, Harman Mark, and Traon Yves Le. 2015. Combining multi-objective search and constraint solving for configuring large software product lines. In 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering, Vol. 1. 517528.Google ScholarGoogle ScholarCross RefCross Ref
  26. [26] Hoste Kenneth and Eeckhout Lieven. 2008. Cole: Compiler optimization level exploration. In Proceedings of the 6th Annual IEEE/ACM International Symposium on Code Generation and Optimization. 165174.Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. [27] Huang Qijing, Haj-Ali Ameer, Moses William, Xiang John, Stoica Ion, Asanovic Krste, and Wawrzynek John. 2019. Autophase: Compiler phase-ordering for hls with deep reinforcement learning. In 2019 IEEE 27th Annual International Symposium on Field-programmable Custom Computing Machines (FCCM’19). IEEE, 308308.Google ScholarGoogle ScholarCross RefCross Ref
  28. [28] Jantz Michael R. and Kulkarni Prasad A.. 2013. Performance potential of optimization phase selection during dynamic JIT compilation. In ACM SIGPLAN/SIGOPS International Conference on Virtual Execution Environments (co-located with ASPLOS’13) (VEE’13), Muir Steve, Heiser Gernot, and Blackburn Stephen M. (Eds.). ACM, 131142.Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. [29] Kennedy James and Eberhart Russell. 1995. Particle swarm optimization. In Proceedings of International Conference on Neural Networks (ICNN’95), Vol. 4. IEEE, 19421948.Google ScholarGoogle ScholarCross RefCross Ref
  30. [30] Lipowski Adam and Lipowska Dorota. 2012. Roulette-wheel selection via stochastic acceptance. Physica A: Statistical Mechanics and Its Applications 391, 6 (2012), 21932196.Google ScholarGoogle ScholarCross RefCross Ref
  31. [31] LLVM. 2022. https://llvm.orgGoogle ScholarGoogle Scholar
  32. [32] Monsifrot Antoine, Bodin François, and Quiniou Rene. 2002. A machine learning approach to automatic production of compiler heuristics. In International Conference on Artificial Intelligence: Methodology, Systems, and Applications. Springer, 4150.Google ScholarGoogle ScholarCross RefCross Ref
  33. [33] Nair Vivek, Yu Zhe, Menzies Tim, Siegmund Norbert, and Apel Sven. 2020. Finding faster configurations using FLASH. IEEE Transactions on Software Engineering 46, 7 (2020), 794811.Google ScholarGoogle ScholarCross RefCross Ref
  34. [34] Nematzadeh Sajjad, Kiani Farzad, Torkamanian-Afshar Mahsa, and Aydin Nizamettin. 2022. Tuning hyperparameters of machine learning algorithms and deep neural networks using metaheuristics: A bioinformatics study on biomedical and biological cases. Computational Biology and Chemistry 97 (2022), 107619.Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. [35] Ni Youcong, Wu Rui, Du Xin, Ye Peng, Li Wangbiao, and Xiao Ruliang. 2019. Evolutionary algorithm for optimization of energy consumption at GCC compile time based on frequent pattern mining. Journal of Software 30, 5 (2019), 12691287.Google ScholarGoogle Scholar
  36. [36] Numpy. 2022. https://numpy.orgGoogle ScholarGoogle Scholar
  37. [37] Padua David A. and Wolfe Michael J.. 1986. Advanced compiler optimizations for supercomputers. Communications of the ACM 29, 12 (1986), 11841201.Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. [38] Pereira Juliana Alves, Acher Mathieu, Martin Hugo, and Jézéquel Jean-Marc. 2020. Sampling effect on performance prediction of configurable systems: A case study. In 11th ACM/SPEC International Conference on Performance Engineering (ICPE’20). ACM, 113.Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. [39] Cáceres Leslie Pérez, Pagnozzi Federico, Franzin Alberto, and Stützle Thomas. 2017. Automatic configuration of GCC using Irace. In International Conference on Artificial Evolution (Evolution Artificielle). Springer, 202216.Google ScholarGoogle Scholar
  40. [40] Poli Riccardo, Kennedy James, and Blackwell Tim. 2007. Particle swarm optimization. Swarm Intelligence 1, 1 (2007), 3357.Google ScholarGoogle ScholarCross RefCross Ref
  41. [41] PolyBench. 2022. https://web.cse.ohio-state.edu/∼pouchet.2/software/polybench/Google ScholarGoogle Scholar
  42. [42] Purini Suresh and Jain Lakshya. 2013. Finding good optimization sequences covering program space. ACM Transactions on Architecture and Code Optimization (TACO) 9, 4 (2013), 123.Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. [43] Sandran Thayalan, Zakaria Nordin, and Pal Anindya Jyoti. 2012. An optimized tuning of genetic algorithm parameters in compiler flag selection based on compilation and execution duration. In Proceedings of the International Conference on Soft Computing for Problem Solving (SocProS’11). Springer, 599610.Google ScholarGoogle ScholarCross RefCross Ref
  44. [44] Sarasaen Chompunuch, Chatterjee Soumick, Breitkopf Mario, Rose Georg, Nürnberger Andreas, and Speck Oliver. 2021. Fine-tuning deep learning model parameters for improved super-resolution of dynamic MRI with prior-knowledge. CoRR abs/2102.02711. arXiv:2102.02711 https://arxiv.org/abs/2102.02711Google ScholarGoogle Scholar
  45. [45] Schneck Paul B.. 1973. A survey of compiler optimization techniques. In Proceedings of the ACM Annual Conference. 106113.Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. [46] learn scikit. 2022. https://scikit-learn.org/stable/Google ScholarGoogle Scholar
  47. [47] Shahriari Bobak, Swersky Kevin, Wang Ziyu, Adams Ryan P., and Freitas Nando De. 2015. Taking the human out of the loop: A review of Bayesian optimization. Proceedings of the IEEE 104, 1 (2015), 148175.Google ScholarGoogle ScholarCross RefCross Ref
  48. [48] Shi Yuhui and Eberhart Russell C.. 1999. Empirical study of particle swarm optimization. In Proceedings of the 1999 Congress on Evolutionary Computation (CEC’99) (Cat. No. 99TH8406), Vol. 3. IEEE, 19451950.Google ScholarGoogle ScholarCross RefCross Ref
  49. [49] Siegmund Norbert, Grebhahn Alexander, Apel Sven, and Kästner Christian. 2015. Performance-influence models for highly configurable systems. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering. 284294.Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. [50] Snoek Jasper, Larochelle Hugo, and Adams Ryan P.. 2012. Practical Bayesian optimization of machine learning algorithms. Advances in Neural Information Processing Systems 25 (2012), 2951-2959.Google ScholarGoogle Scholar
  51. [51] Tiwari Ananta, Chen Chun, Chame Jacqueline, Hall Mary, and Hollingsworth Jeffrey K.. 2009. A scalable auto-tuning framework for compiler optimization. In 2009 IEEE International Symposium on Parallel & Distributed Processing. IEEE, 112.Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. [52] Vazquez Ruben, Gordon-Ross Ann, and Stitt Greg. 2019. Energy prediction for cache tuning in embedded systems. In 37th IEEE International Conference on Computer Design (ICCD’19). IEEE, 630637.Google ScholarGoogle ScholarCross RefCross Ref
  53. [53] Victoria Helen and Maragatham Ganesh. 2021. Automatic tuning of hyperparameters using Bayesian optimization. Evolving Systems 12 (2021), 1230.Google ScholarGoogle ScholarCross RefCross Ref
  54. [54] Wang Yu, Jiang Shu, Lin Weiman, Cao Yu, Lin Longtao, Hu Jiangtao, Miao Jinghao, and Luo Qi. 2021. A learning-based automatic parameters tuning framework for autonomous vehicle control in large scale system deployment. In 2021 American Control Conference (ACC’21). IEEE, 29192926.Google ScholarGoogle ScholarCross RefCross Ref
  55. [55] Ye Jun. 2011. Cosine similarity measures for intuitionistic fuzzy sets and their applications. Mathematical and Computer Modelling 53, 1–2 (2011), 9197.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Compiler Autotuning through Multiple-phase Learning

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM Transactions on Software Engineering and Methodology
      ACM Transactions on Software Engineering and Methodology  Volume 33, Issue 4
      May 2024
      940 pages
      ISSN:1049-331X
      EISSN:1557-7392
      DOI:10.1145/3613665
      • Editor:
      • Mauro Pezzè
      Issue’s Table of Contents

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 18 April 2024
      • Online AM: 11 January 2024
      • Accepted: 27 December 2023
      • Revised: 18 December 2023
      • Received: 28 October 2022
      Published in tosem Volume 33, Issue 4

      Check for updates

      Qualifiers

      • research-article
    • Article Metrics

      • Downloads (Last 12 months)163
      • Downloads (Last 6 weeks)77

      Other Metrics

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Full Text

    View this article in Full Text.

    View Full Text