Welcome to the second issue of the MLIR (bi)Weekly, a newsletter (published on Friday) covering developments in MLIR, and related projects in the ecosystem. MLIR (bi)Weekly is brought to you by a collective effort of contributors, we welcome your contributions!
See the previous published edition.
Highlights
- The C4ML workshop took place last week: we announced public MLIR exactly one year ago at the same workshop! This year multiple talks are using MLIR (see detail below).
- Tatiana and Chris delivered the keynote at the CGO conference (see below). Chris took this opportunity to present his thoughts on a possible path for using MLIR in Clang! See slides and discuss here
- There is now a canonical publication for MLIR: A Compiler Infrastructure for the End of Moore’s Law
MLIR Core
On Discourse
- A proposal to implement quantization transformations was shared by Feng.
- A thread on duplicate successors on terminator derived on a interesting discussion between Chris and John about critical edges in CFG and some deep LLVM consideration about the consequences of
indirect_br
- Discussions on linalg.generic semantics here and here.
Infrastructure
- The CMake option
-DLLVM_BUILD_LLVM_DYLIB
now also builds libMLIR.so when MLIR is configured. - An interface for specifying operation side effects has landed, and also enables specifying side effects directly on arguments/results.
-
Successor operands have been removed from the core
Operation
class, allowing for terminator operations to define their own semantics for supplying block arguments.- The BranchOpInterface can be used to access the original API.
- A new document on how to structure a dialect (directory structure, CMake integration, …) is online.
Table-driven Infrastructure
- The requirements for builders using variadic operands gets simplified ads
operand_segment_sizes
is now automatically populated in the declarative assembly format, as well as the auto-generated builders.
Code Generation
- Loops and Ifs can now return values.
- Loops and parallel loops with reductions can now be lowered to CFG and further to LLVM.
- A simple greedy parallel loop to GPU kernel mapper, using attributes, has been implemented.
- Simple parallel-loop fusion and tiling have landed.
- Introduced atomic read-modify-write operation to the standard dialect, with lowerings to LLVM.
- Expose llvm.intr.matrix_multiply
SPIR-V
- The SPIR-V dialect now properly supports integer signedness.
- The mlir-vulkan-runner now can output basic timing metrics for kernel launches.
Other
Added support for OpenMP barrier and its translation. This is the first operation in the OpenMP Dialect!
In the Ecosystem
Flang
The Fortran IR (FIR) dialect is up for review in the master branch.
IREE
SPIR-V structured ops compilation pipeline
- continues to support more ops and models: CLs pending to enable reduction, etc. and support mnist, unidirectional lstm, etc.
- work in progress to threading target environment support across the whole stack.
(ModelBuilder) runs end-to-end on CPU: aiming for C++ programmable MLIR that is delightful to use and offers unsurprising perf behavior.
PlaidML
- pmlc-vulkan-runner accepting GPU MLIR inputs is using the recently added upstream VulkanRuntime.
Recent Talks
The C4ML workshop took place last week, multiple talks were involving MLIR:
- Jacques Pienaar, Google: : MLIR in the TensorFlow ecosystem
- Tim Zerrell, Intel: Using PlaidML for Affine Parallel Optimizations in MLIR
- Javier Setoain, ARM: MLIR DRRs for multitarget linear algebra optimizations
- Nagy Mostafa, Intel nGraph: Towards a common high-level IR for Deep Learning graph optimization
- Samuel Bayliss, Xilinx: Compiling for Xilinx AI Engine using MLIR
MLIR: Multi-Level Intermediate Representation Compiler Infrastructure
Chris Lattner, Tatiana Shpeisman
Keynote @ International Symposium on Code Generation and Optimization (CGO’20)
End-to-end Dynamic Shape Support in MLIR-HLO CodeGen
This talk from Alibaba PAI explores the challenge of optimizations and CodeGen in presence of dynamic shape, starting from an equivalent to HLO (the XLA IR).
Slides and recording are available
This triggered interesting discussions here and here about some aspects of fusion in the Linalg dialect.
Recent Publications
MLIR: A Compiler Infrastructure for the End of Moore’s Law
Chris Lattner, Mehdi Amini, Uday Bondhugula, Albert Cohen, Andy Davis, Jacques Pienaar, River Riddle, Tatiana Shpeisman, Nicolas Vasilache, Oleksandr Zinenko
https://arxiv.org/abs/2002.11054
High Performance Code Generation in MLIR: An Early Case Study with GEMM
Uday Bondhugula
https://arxiv.org/abs/2003.00532