Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/3446804.3446844acmconferencesArticle/Chapter ViewAbstractPublication PagesccConference Proceedingsconference-collections
research-article

Integrating a functional pattern-based IR into MLIR

Published: 27 February 2021 Publication History

Abstract

The continued specialization in hardware and software due to the end of Moore's law forces us to question fundamental design choices in compilers, and in particular for domain specific languages. The days where a single universal compiler intermediate representation (IR) was sufficient to perform all important optimizations are over. We need novel IRs and ways for them to interact with one another while leveraging established compiler infrastructures.
In this paper, we present a practical implementation of a functional pattern-based IR in the SSA-based MLIR framework. Our IR captures the program semantics as compositions of common computational patterns enabling rewrite-based optimizations. We discuss the integration with other IRs by demonstrating the compilation of a neural network represented as a TensorFlow graph down to optimized LLVM code via our functional pattern-based IR. Our implementation demonstrates for the first time a practical integration of a functional pattern-based IR with other IRs and it enables the construction of sophisticated code generators for domain specific languages.

References

[1]
2020. Circuit IR Compilers and Tools (CIRCT). htps://github.com/llvm/ circt
[2]
2020. MLIR Afine dialect online documentation. htps://mlir.llvm.org/ docs/Dialects/Afine/
[3]
2020. MLIR SCF dialect online documentation. htps://mlir.llvm.org/ docs/Dialects/SCFDialect/
[4]
Andrew W. Appel. 1998. SSA is Functional Programming. ACM SIGPLAN Notices 33, 4 ( 1998 ), 17?20. htps://doi.org/10.1145/278283. 278285
[5]
Robert Atkey, Michel Steuwer, Sam Lindley, and Christophe Dubach. 2017. Strategy Preserving Compilation for Parallel Functional Code. CoRR abs/1710.08332 ( 2017 ).
[6]
Paul Barham and Michael Isard. 2019. Machine Learning Systems are Stuck in a Rut. In HotOS. ACM, 177?183. htps://doi.org/10.1145/ 3317550.3321441
[7]
Uday Bondhugula. 2020. High Performance Code Generation in MLIR: An Early Case Study with GEMM. CoRR abs/ 2003.00532 ( 2020 ).
[8]
Tianqi Chen, Thierry Moreau, Ziheng Jiang, Lianmin Zheng, Eddie Q. Yan, Haichen Shen, Meghan Cowan, Leyuan Wang, Yuwei Hu, Luis Ceze, Carlos Guestrin, and Arvind Krishnamurthy. 2018. TVM: An Automated End-to-End Optimizing Compiler for Deep Learning. In OSDI. USENIX Association, 578?594.
[9]
Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. Kenneth Zadeck. 1991. Eficiently computing static single assignment form and the control dependence graph. Transactions on Programming Languages and Systems 13 ( 1991 ), 451?490. htps: //doi.org/10.1145/115372.115320
[10]
Google. 2020. XLA HLO. htps://github.com/tensorflow/mlir-hlo
[11]
Tobias Gysi, Christoph Müller, Oleksandr Zinenko, Stephan Herhut, Eddie Davis, Tobias Wicky, Oliver Fuhrer, Torsten Hoefler, and Tobias Grosser. 2020. Domain-Specific Multi-Level IR Rewriting for GPU. CoRR abs/ 2005.13014 ( 2020 ).
[12]
Bastian Hagedorn, Johannes Lenfers, Thomas Koehler, Xueying Qin, Sergei Gorlatch, and Michel Steuwer. 2020. Achieving highperformance the functional way: a functional pearl on expressing high-performance optimizations as rewrite strategies. Proc. ACM Program. Lang. 4, ICFP ( 2020 ), 92 :1?92: 29. htps://doi.org/10.1145/3408974
[13]
Bastian Hagedorn, Larisa Stoltzfus, Michel Steuwer, Sergei Gorlatch, and Christophe Dubach. 2018. High performance stencil code generation with lift. In CGO. ACM, 100?112. htps://doi.org/10.1145/3168824
[14]
Herbert Jordan, Simone Pellegrini, Peter Thoman, Klaus Kofler, and Thomas Fahringer. 2013. INSPIRE: The insieme parallel intermediate representation. In PACT. IEEE Computer Society, 7?17. htps://doi. org/10.1109/PACT. 2013.6618799
[15]
Chris Lattner and Vikram S. Adve. 2004. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In CGO. IEEE Computer Society, 75?88. htps://doi.org/10.1109/CGO. 2004.1281665
[16]
Chris Lattner, Mehdi Amini, Uday Bondhugula, Albert Cohen, Andy Davis, Jacques Pienaar, River Riddle, Tatiana Shpeisman, Nicolas Vasilache, and Oleksandr Zinenko. 2021. MLIR: Scaling Compiler Infrastructure for Domain Specific Computation. In CGO.
[17]
Tung D. Le, Gheorghe-Teodor Bercea, Tong Chen, Alexandre E. Eichenberger, Haruki Imai, Tian Jin, Kiyokuni Kawachiya, Yasushi Negishi, and Kevin O'Brien. 2020. Compiling ONNX Neural Network Models Using MLIR. CoRR abs/ 2008.08272 ( 2020 ).
[18]
Roland Leißa, Marcel Köster, and Sebastian Hack. 2015. A graph-based higher-order intermediate representation. In CGO. IEEE Computer Society, 202?212. htps://doi.org/10.1109/CGO. 2015.7054200
[19]
Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. 2019. PyTorch: An Imperative Style, High-Performance Deep Learning Library. In Advances in Neural Information Processing Systems 32, H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett (Eds.). Curran Associates, Inc.
[20]
Jacques Pienaar. 2020. MLIR in TensorFlow Ecosystem. Compilers For Machine Learning (C4ML) 2020, San Diego, CA, USA.
[21]
Jonathan Ragan-Kelley, Andrew Adams, Sylvain Paris, Marc Levoy, Saman P. Amarasinghe, and Frédo Durand. 2012. Decoupling algorithms from schedules for easy optimization of image processing pipelines. ACM Trans. Graph. 31, 4 ( 2012 ), 32 :1?32: 12. htps: //doi.org/10.1145/2185520.2185528
[22]
Fabrice Rastello et al. 2016. SSA-Based Compiler Design (1st ed.). Springer Publishing Company, Incorporated. htp://ssabook.gforge. inria.fr/latest/book.pdf
[23]
Michel Steuwer, Christian Fensch, Sam Lindley, and Christophe Dubach. 2015. Generating performance portable code using rewrite rules: from high-level functional expressions to high-performance OpenCL code. In ICFP. ACM, 205?217. htps://doi.org/10.1145/2858949. 2784754
[24]
Michel Steuwer, Toomas Remmelg, and Christophe Dubach. 2016. Matrix multiplication beyond auto-tuning: rewrite-based GPU code generation. In CASES. ACM, 15 :1?15: 10. htps://doi.org/10.1145/2968455. 2968521
[25]
Michel Steuwer, Toomas Remmelg, and Christophe Dubach. 2017. Lift: a functional data-parallel IR for high-performance GPU code generation. In CGO. ACM, 74?85. htps://doi.org/10.1109/CGO. 2017. 7863730

Cited By

View all
  • (2024)eCC++ : A Compiler Construction Framework for Embedded Domain-Specific Languages2024 IEEE International Parallel and Distributed Processing Symposium Workshops (IPDPSW)10.1109/IPDPSW63119.2024.00129(667-677)Online publication date: 27-May-2024
  • (2022)Source Matching and Rewriting for MLIR Using String-Based AutomataACM Transactions on Architecture and Code Optimization10.1145/357128320:2(1-26)Online publication date: 18-Nov-2022

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
CC 2021: Proceedings of the 30th ACM SIGPLAN International Conference on Compiler Construction
March 2021
164 pages
ISBN:9781450383257
DOI:10.1145/3446804
  • General Chair:
  • Aaron Smith,
  • Program Chairs:
  • Delphine Demange,
  • Rajiv Gupta
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].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 27 February 2021

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. Intermediate Representation
  2. MLIR
  3. Rise

Qualifiers

  • Research-article

Conference

CC '21
Sponsor:

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)68
  • Downloads (Last 6 weeks)11
Reflects downloads up to 08 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2024)eCC++ : A Compiler Construction Framework for Embedded Domain-Specific Languages2024 IEEE International Parallel and Distributed Processing Symposium Workshops (IPDPSW)10.1109/IPDPSW63119.2024.00129(667-677)Online publication date: 27-May-2024
  • (2022)Source Matching and Rewriting for MLIR Using String-Based AutomataACM Transactions on Architecture and Code Optimization10.1145/357128320:2(1-26)Online publication date: 18-Nov-2022

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media