TY - GEN
T1 - A Deep Learning Model for Loop Interchange
AU - Mezdour, Lina
AU - Kadem, Khadidja
AU - Merouani, Massinissa
AU - Haichour, Amina Selma
AU - Amarasinghe, Saman
AU - Baghdadi, Riyadh
N1 - Funding Information:
This work was partially supported by the Center for Artificial Intelligence and Robotics at New York University Abu Dhabi.
Publisher Copyright:
© 2023 ACM.
PY - 2023/2/17
Y1 - 2023/2/17
N2 - 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.
AB - 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.
KW - automatic code optimization
KW - compilers
KW - cost model
KW - deep learning
KW - loop interchange
KW - Tiramisu
UR - http://www.scopus.com/inward/record.url?scp=85149180097&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=85149180097&partnerID=8YFLogxK
U2 - 10.1145/3578360.3580257
DO - 10.1145/3578360.3580257
M3 - Conference contribution
AN - SCOPUS:85149180097
T3 - CC 2023 - Proceedings of the 32nd ACM SIGPLAN International Conference on Compiler Construction
SP - 50
EP - 60
BT - CC 2023 - Proceedings of the 32nd ACM SIGPLAN International Conference on Compiler Construction
A2 - Verbrugge, Clark
A2 - Lhotak, Ondrej
A2 - Shen, Xipeng
PB - Association for Computing Machinery, Inc
T2 - 32nd ACM SIGPLAN International Conference on Compiler Construction, CC 2023
Y2 - 25 February 2023 through 26 February 2023
ER -