llvm-project/mlir/tools/mlir-tblgen
River Riddle 3fb3927bd3 [mlir] Add a new "Pattern Descriptor Language" (PDL) dialect.
PDL presents a high level abstraction for the rewrite pattern infrastructure available in MLIR. This abstraction allows for representing patterns transforming MLIR, as MLIR. This allows for applying all of the benefits that the general MLIR infrastructure provides, to the infrastructure itself. This means that pattern matching can be more easily verified for correctness, targeted by frontends, and optimized.

PDL abstracts over various different aspects of patterns and core MLIR data structures. Patterns are specified via a `pdl.pattern` operation. These operations contain a region body for the "matcher" code, and terminate with a `pdl.rewrite` that either dispatches to an external rewriter or contains a region for the rewrite specified via `pdl`. The types of values in `pdl` are handle types to MLIR C++ types, with `!pdl.attribute`, `!pdl.operation`, and `!pdl.type` directly mapping to `mlir::Attribute`, `mlir::Operation*`, and `mlir::Value` respectively.

An example pattern is shown below:

```mlir
// pdl.pattern contains metadata similarly to a `RewritePattern`.
pdl.pattern : benefit(1) {
  // External input operand values are specified via `pdl.input` operations.
  // Result types are constrainted via `pdl.type` operations.

  %resultType = pdl.type
  %inputOperand = pdl.input
  %root, %results = pdl.operation "foo.op"(%inputOperand) -> %resultType
  pdl.rewrite(%root) {
    pdl.replace %root with (%inputOperand)
  }
}
```

This is a culmination of the work originally discussed here: https://groups.google.com/a/tensorflow.org/g/mlir/c/j_bn74ByxlQ

Differential Revision: https://reviews.llvm.org/D84578
2020-08-19 13:13:06 -07:00
..
CMakeLists.txt [MLIR,OpenMP] Lowering of parallel operation: proc_bind clause 2/n 2020-08-12 08:03:13 +01:00
DialectGen.cpp Separate the Registration from Loading dialects in the Context 2020-08-19 01:19:03 +00:00
DocGenUtilities.h Mass update the MLIR license header to mention "Part of the LLVM project" 2020-01-26 03:58:30 +00:00
EnumsGen.cpp [mlir-tblgen] Use fully qualified names in generated code files 2020-06-26 15:05:33 +02:00
LLVMIRConversionGen.cpp [mlir] LLVMType: make getUnderlyingType private 2020-07-29 13:43:38 +02:00
LLVMIRIntrinsicGen.cpp [MLIR] Rename SideEffects.td -> SideEffectInterfaces.td 2020-05-12 12:21:42 -07:00
OpDefinitionsGen.cpp [MLIR][TableGen] Fix ambiguous build methods when inferring result types. 2020-08-10 10:05:06 -07:00
OpDocGen.cpp [mlir][NFC] Remove usernames and google bug numbers from TODO comments. 2020-07-07 01:40:52 -07:00
OpFormatGen.cpp [mlir] Add a new "Pattern Descriptor Language" (PDL) dialect. 2020-08-19 13:13:06 -07:00
OpFormatGen.h [mlir] Add initial support for parsing a declarative operation assembly format 2020-01-30 11:43:40 -08:00
OpInterfacesGen.cpp [mlir][ODS] Add support for specifying the namespace of an interface. 2020-07-12 14:18:32 -07:00
OpenMPCommonGen.cpp [NFC][MLIR][OpenMP] Add comments and test for OpenMP enum declaration utility 2020-08-14 23:22:23 +01:00
PassDocGen.cpp [mlir][Pass] Update the PassGen to generate base classes instead of utilities 2020-04-07 14:08:52 -07:00
PassGen.cpp Separate the Registration from Loading dialects in the Context 2020-08-19 01:19:03 +00:00
RewriterGen.cpp [drr] Add $_loc special directive for NativeCodeCall 2020-08-11 14:06:17 -07:00
SPIRVUtilsGen.cpp [mlir][NFC] Remove usernames and google bug numbers from TODO comments. 2020-07-07 01:40:52 -07:00
StructsGen.cpp [mlir-tblgen] Use fully qualified names in generated code files 2020-06-26 15:05:33 +02:00
mlir-tblgen.cpp Mass update the MLIR license header to mention "Part of the LLVM project" 2020-01-26 03:58:30 +00:00