e01.org

MLIR (software)

MLIR (Multi-Level Intermediate Representation) is an open-source compiler infrastructure project developed as a sub-project of the LLVM project. It provides a modular and extensible intermediate representation (IR) framework intended to facilitate the construction of domain-specific compilers and improve compilation for heterogeneous computing platforms. MLIR supports multiple abstraction levels in a single IR and introduces dialects, a mechanism for defining custom operations, types, and attributes tailored to specific domains. The name "Multi-Level Intermediate Representation" reflects the system’s ability to model computations at various abstraction levels and progressively lower them toward machine code. MLIR was originally developed in 2018 by Chris Lattner at Google, and publicly released as part of LLVM in 2019. It was designed to address challenges in building compilers for modern workloads such as machine learning, hardware acceleration, and high-level synthesis by...

MLIR (Multi-Level Intermediate Representation) is an open-source compiler infrastructure project developed as a sub-project of the LLVM project. It provides a modular and extensible intermediate representation (IR) framework intended to facilitate the construction of domain-specific compilers and improve compilation for heterogeneous computing platforms. MLIR supports multiple abstraction levels in a single IR and introduces dialects, a mechanism for defining custom operations, types, and attributes tailored to specific domains. The name "Multi-Level Intermediate Representation" reflects the system’s ability to model computations at various abstraction levels and progressively lower them toward machine code. MLIR was originally developed in 2018 by Chris Lattner at Google, and publicly released as part of LLVM in 2019. It was designed to address challenges in building compilers for modern workloads such as machine learning, hardware acceleration, and high-level synthesis by providing reusable components and standardizing the representation of intermediate computations across different programming languages and hardware targets. MLIR is used in a range of systems including TensorFlow, Mojo, TPU-MLIR, and others. It is released under the Apache License 2.0 with LLVM exceptions and is maintained as part of the LLVM project. %res:2 = "mydialect.morph"(%input#3) ({ ^bb0(%arg0: !mydialect loc("mysource.cc":10:8)): // nested operations }) { some.attribute = true, other_attribute = 1.5 } : (!mydialect ) -> (!mydialect , !mydialect ) loc(callsite("foo" at "mysource.cc":10:8)) This operation, named morph , belongs to the mydialect dialect. It takes one input operand ( %input#3 ) of type custom_type and produces two output values of type other_type . The operation includes two attributes- some.attribute and other_attribute -and contains a region with a single block ( ^bb0 ) that accepts one argument. The loc keyword specifies source-level location information, which can be used for debugging or diagnostic reporting. The syntax of operations, types and attributes can also be customized according to the user preferences by implementing proper parsing and printing functions within the operation definition. func.func @matrix_add(%arg0: memref , %arg1: memref ) -> memref { %result = memref.alloc() : memref affine.for %i = 0 to 10 { affine.for %j = 0 to 20 { %lhs = memref.load %arg0[%i, %j] : memref %rhs = memref.load %arg1[%i, %j] : memref %sum = arith.addf %lhs, %rhs : f32 memref.store %sum, %result[%i, %j] : memref } } func.return %result : memref } Although different dialects may be used to express similar computations, the level of abstraction and the intended compilation flow may vary. In the example above, the affine dialect enables polyhedral analysis and optimizations, while the memref and arith dialects express memory and arithmetic operations, respectively. let assemblyFormat = "attr-dict ($operands^ `:` type($operands))?"; map = affine_map (d0, d1)> module { func.func @avg(%arg0: memref , %arg1: memref ) -> memref { %alloc = memref.alloc() : memref %c0 = arith.constant 0 : index %c10 = arith.constant 10 : index %c1 = arith.constant 1 : index scf.for %arg2 = %c0 to %c10 step %c1 { %c0_0 = arith.constant 0 : index %c20 = arith.constant 20 : index %c1_1 = arith.constant 1 : index scf.for %arg3 = %c0_0 to %c20 step %c1_1 { %0 = memref.load %arg0[%arg2, %arg3] : memref %1 = memref.load %arg1[%arg2, %arg3] : memref %2 = arith.addf %0, %1 : f32 memref.store %2, %alloc[%arg2, %arg3] : memref } } return %alloc : memref } } Another possible strategy, however, could have been to use the gpu dialect to generate code for GPUs: map = affine_map (d0, d1)> module { func.func @avg(%arg0: memref , %arg1: memref ) -> memref { %alloc = memref.alloc() : memref %c0 = arith.constant 0 : index %c10 = arith.constant 10 : index %0 = arith.subi %c10, %c0 : index %c1 = arith.constant 1 : index %c0_0 = arith.constant 0 : index %c20 = arith.constant 20 : index %1 = arith.subi %c20, %c0_0 : index %c1_1 = arith.constant 1 : index %c1_2 = arith.constant 1 : index gpu.launch blocks(%arg2, %arg3, %arg4) in (%arg8 = %0, %arg9 = %c1_2, %arg10 = %c1_2) threads(%arg5, %arg6, %arg7) in (%arg11 = %1, %arg12 = %c1_2, %arg13 = %c1_2) { %2 = arith.addi %c0, %arg2 : index %3 = arith.addi %c0_0, %arg5 : index %4 = memref.load %arg0[%2, %3] : memref %5 = memref.load %arg1[%2, %3] : memref %6 = arith.addf %4, %5 : f32 memref.store %4, %alloc[%2, %3] : memref gpu.terminator } return %alloc : memref } }

References

  1. ^ "IREE" . iree.dev . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  2. ^ Kumar, Abhinav; Khedkar, Atharva; So, Hwisoo; Kuo, Megan; Gurjar, Ameya; Biswas, Partha; Shrivastava, Aviral (2025). "DSP-MLIR: A Domain-Specific Language and MLIR Dialect for Digital Signal Processing" . Proceedings of the 26th ACM SIGPLAN/SIGBED International Conference on Languages, Compilers, and Tools for Embedded Systems (LCTES '25) . New York, NY, USA: Association for Computing Machinery. pp. 146– 157. arXiv : 2408.11205 . doi : 10.1145/3735452.3735527 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  3. ^ "MLIR Language Reference - MLIR" . mlir.llvm.org . Retrieved 2023-07-05 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1688511600.0
  4. ^ "MLIR Rationale - MLIR" . mlir.llvm.org . Retrieved 2023-07-05 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1688511600.0
  5. ^ Amini, Mehdi; Riddle, River. "MLIR Tutorial" (PDF) . Retrieved 2025-06-05 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1749078000.0
  6. ^ Stroustrup, Bjarne (2015). The C++ programming language: C++ 11 (4. ed., 4. print ed.). Upper Saddle River, NJ: Addison-Wesley. ISBN 978-0-321-56384-2 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  7. ^ "TableGen Overview - LLVM 17.0.0git documentation" . llvm.org . Retrieved 2023-07-05 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1688511600.0
  8. ^ Moses, William S.; Chelini, Lorenzo; Zhao, Ruizhe; Zinenko, Oleksandr (2021). Polygeist: Raising C to Polyhedral MLIR . 30th International Conference on Parallel Architectures and Compilation Techniques (PACT). pp. 45– 59. doi : 10.1109/PACT52795.2021.00011 . ISBN 978-1-6654-4278-7 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  9. ^ Agostini, Nicolas Bohm; Curzel, Serena; Amatya, Vinay; Tan, Cheng; Minutoli, Marco; Castellana, Vito Giovanni; Manzano, Joseph; Kaeli, David; Tumeo, Antonino (2022-10-30). "An MLIR-based Compiler Flow for System-Level Design and Hardware Acceleration" . Proceedings of the 41st IEEE/ACM International Conference on Computer-Aided Design . Association for Computing Machinery. pp. 1– 9. doi : 10.1145/3508352.3549424 . hdl : 11311/1229389 . ISBN 978-1-4503-9217-4 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  10. ^ Ruizhe, Zhao; Jianyi, Cheng (2021). "Phism: Polyhedral High-Level Synthesis in MLIR". arXiv : 2103.15103 [ cs.PL ]. Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  11. ^ McCaskey, Alexander; Nguyen, Thien (October 2021). "A MLIR Dialect for Quantum Assembly Languages". 2021 IEEE International Conference on Quantum Computing and Engineering (QCE) . IEEE. pp. 255– 264. arXiv : 2101.11365 . doi : 10.1109/QCE52317.2021.00043 . ISBN 978-1-6654-1691-7 . OSTI 1862113 . S2CID 231718965 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  12. ^ Park, Sunjae; Song, Woosung; Nam, Seunghyeon; Kim, Hyeongyu; Shin, Junbum; Lee, Juneyoung (2023-06-06). "HEaaN.MLIR: An Optimizing Compiler for Fast Ring-Based Homomorphic Encryption" . Proceedings of the ACM on Programming Languages . 7 (PLDI): 196– 220. doi : 10.1145/3591228 . ISSN 2475-1421 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  13. ^ Govindarajan, Sanath; Moses, William S. "SyFER-MLIR: Integrating Fully Homomorphic Encryption Into the MLIR Compiler Framework" (PDF) . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  14. ^ "HEIR: Homomorphic Encryption Intermediate Representation" . GitHub . Retrieved 2023-09-05 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1693868400.0
  15. ^ Jin, Tian; Bercea, Gheorghe-Teodor; Le, Tung D.; Chen, Tong; Su, Gong; Imai, Haruki; Negishi, Yasushi; Leu, Anh; O'Brien, Kevin; Kawachiya, Kiyokuni; Eichenberger, Alexandre E. (2020). "Compiling ONNX Neural Network Models Using MLIR". arXiv : 2008.08272 [ cs.PL ]. Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  16. ^ Pienaar, Jacques (2020), MLIR in TensorFlow Ecosystem , retrieved 2023-07-06 Wikipedia revision 1378854463, retrieved 2026-11-18 · 1688598000.0
  17. ^ Hu, Pengchao; Lu, Man; Wang, Lei; Jiang, Guoyue (2022). "TPU-MLIR: A Compiler For TPU Using MLIR". arXiv : 2210.15016 [ cs.PL ]. Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  18. ^ Katel, Navdeep; Khandelwal, Vivek; Bondhugula, Uday (2022-03-19). "MLIR-based code generation for GPU tensor cores". Proceedings of the 31st ACM SIGPLAN International Conference on Compiler Construction . ACM. pp. 117– 128. doi : 10.1145/3497776.3517770 . ISBN 978-1-4503-9183-2 . S2CID 247522110 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  19. ^ Bik, Aart; Koanantakool, Penporn; Shpeisman, Tatiana; Vasilache, Nicolas; Zheng, Bixia; Kjolstad, Fredrik (2022-12-31). "Compiler Support for Sparse Tensor Computations in MLIR" . ACM Transactions on Architecture and Code Optimization . 19 (4): 1– 25. arXiv : 2202.04305 . doi : 10.1145/3544559 . ISSN 1544-3566 . S2CID 246680261 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  20. ^ "MLIR: A New Intermediate Representation and Compiler Framework" . TensorFlow Blog . 2019-04-18 . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  21. ^ "TFRT: A New TensorFlow Runtime" . TensorFlow Blog . 2020-04-27 . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  22. ^ "MLIR for Graph Algorithms" . mlir.llvm.org . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  23. ^ "XLA Overview" . OpenXLA . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  24. ^ "IREE" . iree.dev . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  25. ^ "Announcing IREE: A New Initiative for Machine Learning Deployment" . LF AI & Data Foundation . 2024-05-23 . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  26. ^ "IREE Targeting Vulkan" (PDF) . Khronos Group . Khronos . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  27. ^ Liu, Hsin-I Cindy; Brehler, Marius; Ravishankar, Mahesh; Vasilache, Nicolas; Vanik, Ben; Laurenzo, Stella (2022). "TinyIREE: An ML Execution Environment for Embedded Systems From Compilation to Deployment" . IEEE Micro . 42 (5). IEEE: 9– 16. Bibcode : 2022IMicr..42e...9L . doi : 10.1109/MM.2022.3178068 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  28. ^ "The torch-mlir Project (LLVM OpenMeetings 2021)" (PDF) . mlir.llvm.org . 2021-10-07 . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  29. ^ "torch-mlir: Bridging PyTorch and MLIR Ecosystems" . PyTorch Forums . 30 September 2021 . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  30. ^ "An Introduction to torch-mlir (FOSDEM 2025)" (PDF) . fosdem.org . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  31. ^ "ONNX-MLIR" . onnx.ai . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  32. ^ Jin, Tian; Bercea, Gheorghe-Teodor; Le, Tung D; Chen, Tong; Su, Gong; Imai, Haruki; Negishi, Yasushi; Leu, Anh; O'Brien, Kevin; Kawachiya, Kiyokuni (2020). "Compiling ONNX Neural Network Models Using MLIR". arXiv : 2008.08272 [ cs.PL ]. Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  33. ^ "LLVM Developer Meetings" . llvm.org . Retrieved 2025-06-05 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1749078000.0
  34. ^ "MLIR-AIE Documentation" . Xilinx GitHub Pages . Xilinx . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  35. ^ "IRON for Ryzen AI: A Tutorial on MLIR-AIE Compilation" (PDF) . amd.com . AMD . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  36. ^ "AIR for Ryzen AI: A Tutorial on Versal-AIE Compilation" (PDF) . amd.com . AMD . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  37. ^ "Triton MLIR Dialects" . triton-lang.org . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  38. ^ "microsoft/triton-shared" . GitHub . Microsoft . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  39. ^ "Understanding the Stages of Triton Kernel Compilation" . PyTorch Blog . 2023-09-26 . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  40. ^ "The Proton Dialect (LLVM Dev Meeting 2025)" (PDF) . llvm.org . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  41. ^ "Mojo Keynote – LLVM Dev Meeting 2023" (PDF) . llvm.org . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  42. ^ "How MLIR Powers Mojo" . Educative . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  43. ^ "Mojo and MLIR Interoperability" . ruhati.net . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  44. ^ "TPU-MLIR Developer Manual" . doc.sophgo.com . Sophgo . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  45. ^ a b "Traits - MLIR" . mlir.llvm.org . Retrieved 2023-07-05 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1688511600.0
  46. ^ a b "Pattern Rewriting : Generic DAG-to-DAG Rewriting - MLIR" . mlir.llvm.org . Retrieved 2023-07-06 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1688598000.0
  47. ^ a b "Dialects - MLIR" . mlir.llvm.org . Retrieved 2023-07-07 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1688684400.0
  48. ^ a b "Defining Dialects - MLIR" . mlir.llvm.org . Retrieved 2023-07-07 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1688684400.0
  49. ^ a b "Dialect Conversion - MLIR" . mlir.llvm.org . Retrieved 2023-07-06 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1688598000.0
  50. ^ a b "Operation Definition Specification (ODS) - MLIR" . mlir.llvm.org . Retrieved 2023-07-05 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1688511600.0
  51. ^ a b "Interfaces - MLIR" . mlir.llvm.org . Retrieved 2023-07-05 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1688511600.0
  52. ^ a b c Lattner, Chris; Amini, Mehdi; Bondhugula, Uday; Cohen, Albert; Davis, Andy; Pienaar, Jacques; Riddle, River; Shpeisman, Tatiana; Vasilache, Nicolas; Zinenko, Oleksandr (2021). MLIR: Scaling Compiler Infrastructure for Domain Specific Computation . 2021 IEEE/ACM International Symposium on Code Generation and Optimization (CGO). pp. 2– 14. doi : 10.1109/CGO51591.2021.9370308 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1794956400.0
  53. ^ "llvm-project" . GitHub . LLVM Project . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  54. ^ a b "MLIR-AIE" . GitHub . Xilinx . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  55. ^ a b c d "Multi-Level Intermediate Representation Overview" . mlir.llvm.org . Retrieved 2025-06-05 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1749078000.0
  56. ^ a b c d "Users of MLIR" . mlir.llvm.org . Retrieved 2025-06-05 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1749078000.0
  57. ^ a b c "Why Mojo" . docs.modular.com . Retrieved 2025-06-05 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1749078000.0
  58. ^ a b "ONNX-MLIR" . GitHub . ONNX Project . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  59. ^ a b "torch-mlir" . GitHub . LLVM Project . Retrieved 2025-06-16 . Wikipedia revision 1378854463, retrieved 2026-11-18 · 1750028400.0
  60. Wikipedia “MLIR (software)” revision 1378854463 · retrieved 2026-10-20 release date (×1) · confidence 0.95 revision URL · 1792450800.0
source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"MLIR (software)". 1791290181. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1378854463

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·