Welcome to the fourth 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
- PyMLIR is a “full Python interface to parse, process, and output MLIR files”. It does not provide any bindings to MLIR nor depends on MLIR: it is a complete reimplementation of the generic MLIR parser in Python/Lark.
- A new declarative pass specification is added: we’re moving away for the static global pass registration (and in general aim to have
mlir/lib/...
entirely free of static global initializers soon) - An example of creating your own dialect as an out-of-tree CMake project has been added.
- A new page on the website provides Debugging Tips
MLIR Core
Infrastructure
-
mlir-print-op-on-diagnostic
defaults to true now (fix pr44830: this addresses a common user trap to think that the location printed along with the diagnostic is the same as the current operation that caused the error. - Pass Infrastructure Refactoring: CRTP is being removed from the Pass hierarchy, making the class interface much cleaner.
- Dominance gets a new utility function to find the nearest common dominator of two given blocks.
- The dialect conversion infrastructure now supports block creation in ConversionPatternRewriter.
- Documentation cleanup:
- Dialect documentation now contains information on assembly format, successors, regions, and saw an overall cleanup.
- Passes.md now includes all of the registered passes in MLIR (though many are unfortunately missing detailed descriptions)
- The documentation on canonicalization now discusses the different canonicalization mechanisms and how to use them.
- The MLIR website now supports .md includes, which allows to mix static doc with generated one. For example the SPIR-V dialect static .md source includes the generated documentation for the operations to produce a unified online doc. Other dialects are entirely generated from the ODS definition.
Table-driven Infrastructure
- A new declarative pass specification(i.e. tablegen backend) is being added. Several revisions are still inflight and should land early next week. Having a declarative description for the passes provides multiple benefits:
- We can generate the pass documentation for the command line and for website or any other medium from the same source.
- We can generate the registration for the passes and we won’t have any static global constructor to manage pass registration anymore (porting MLIR pass options mechanism to LLVM would make some users happy I think).
- The pass options being declaratively defined allows to generate a base class for each pass, it reduces the boilerplate for the user.
- ODS now supports variadic regions
Code Generation & Optimizations
- LoopToStandard now supports if/else results.
- The emission of wrappers around C interface is now controlled by a function attribute.
- LLVMFuncOp can now pass opaque attributes through to LLVM. See the IREE section for an example of how the it is used to brings 50% improvements on a
skylake-avx512
benchmark! - The bitwidth of the
index
type is now configurable when lowering to LLVM. - LoopToStandard conversion supports now “if/else” with results
- Introduction of a utility to separate full tiles from partial tiles when tiling affine loop nests where trip counts are unknown or where tile sizes don’t divide trip counts.
- Linalg
- Linalg starts to get support for “named ops”:
- The idea is to define ops using a “Tensor-Comprehension-like” specification (see RFC
- A first implementation for generating ODS for Linalg op from such representation is up for review.
- Fusion has been extended to support WAW on buffers
- Pooling for min/max/sum ops has been added
- Lowering to libraries now takes advantage of the function attribute to control C wrapper.
- Linalg starts to get support for “named ops”:
SPIR-V
- Documentation for SPIR-V dialect is consolidated into one [page ('spv' Dialect - MLIR) now (see the
Infrastructure
section above). -
mlir-vulkan-runner
now supports 3D memref.
In the Ecosystem
IREE : An Experimental MLIR Execution Environment
- A new website and roadmap is getting started!
- Improved “getting started” documentation pages.
- Compiling with dynamic shapes:
- First e2e compile and run of a simple computation with dynamic shapes (from Python/numpy).
- Implemented dynamic dim and rank from custom ops, allowing a TF/Keras LSTM to compile for the first time (has some minor runtime bugs still in the list module)
- Concluded a lot of misc work to get shape types plumbed through everything for the VMLA path. Next need to apply to LLVM/SPIR-V backends.
- Working on model by model triage to source further gaps.
- IRModelBuilder llvm.matrix intrinsic based benchmark makes proper use of LLVM function attribute
passthrough = [["prefer-vector-width", "512"]]
. Brings 50% improvements on the 16^3 case onskylake-avx512
.