A Deep Learning Model for Loop Interchange

Lina Mezdour, Khadidja Kadem, Massinissa Merouani, Amina Selma Haichour, Saman Amarasinghe, Riyadh Baghdadi

Research output: Chapter in Book/Report/Conference proceedingConference contribution

Abstract

Loop interchange is an important code optimization that improves data locality and extracts parallelism. While previous research in compilers has tried to automate the selection of which loops to interchange, existing methods have an important limitation. They use less precise machine models. This is mainly because developing a model to predict whether to interchange two loops is challenging since such a prediction depends on many factors. While state-of-the-art methods try to avoid this problem by using a deep-learning based cost model, they suffer from another limitation. They scale proportionally with the number of loop levels of a given loop nest. This is mainly because they use the model to evaluate all the possible loop interchanges (or a subset of the most promising ones). In this paper, we propose a novel deep-learning model for loop interchange that addresses the previous limitations. It takes a code representation as input and predicts the best pair of loops to interchange. Compared to state-of-the-art deep-learning based cost models, it requires constant time to predict the best loop interchange. This is in contrast to state-of-the-art deep learning models that are used to evaluate all the loop pairs and then pick the best one. The proposed model is the first deep learning model that requires a constant time to predict the best loops to interchange. The model is implemented and evaluated in the Tiramisu compiler, a state-of-the-art polyhedral compiler. We evaluate the proposed model on a benchmark of Tiramisu programs and show an accuracy of 78.57% for 1-shot and 85.71% for 2-shots. Experiments show that our model outperforms the cost model currently used by the Tiramisu compiler by 8.57% in terms of 1-shot accuracy, and 5.71% with 2-shots accuracy, while at the same time reducing the total execution time needed for predicting the best pair of loops to interchange.

Original languageEnglish (US)
Title of host publicationCC 2023 - Proceedings of the 32nd ACM SIGPLAN International Conference on Compiler Construction
EditorsClark Verbrugge, Ondrej Lhotak, Xipeng Shen
PublisherAssociation for Computing Machinery, Inc
Pages50-60
Number of pages11
ISBN (Electronic)9798400700880
DOIs
StatePublished - Feb 17 2023
Event32nd ACM SIGPLAN International Conference on Compiler Construction, CC 2023 - Montreal, Canada
Duration: Feb 25 2023Feb 26 2023

Publication series

NameCC 2023 - Proceedings of the 32nd ACM SIGPLAN International Conference on Compiler Construction

Conference

Conference32nd ACM SIGPLAN International Conference on Compiler Construction, CC 2023
Country/TerritoryCanada
CityMontreal
Period2/25/232/26/23

Keywords

  • automatic code optimization
  • compilers
  • cost model
  • deep learning
  • loop interchange
  • Tiramisu

ASJC Scopus subject areas

  • Hardware and Architecture
  • Signal Processing
  • Software

Fingerprint

Dive into the research topics of 'A Deep Learning Model for Loop Interchange'. Together they form a unique fingerprint.

Cite this