|
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2 |
|
| #
faf42264 |
| 02-Jan-2022 |
River Riddle <[email protected]> |
[PDLL] Add support for user defined constraint and rewrite functions
These functions allow for defining pattern fragments usable within the `match` and `rewrite` sections of a pattern. The main stru
[PDLL] Add support for user defined constraint and rewrite functions
These functions allow for defining pattern fragments usable within the `match` and `rewrite` sections of a pattern. The main structure of Constraints and Rewrites functions are the same, and are similar to functions in other languages; they contain a signature (i.e. name, argument list, result list) and a body:
```pdll // Constraint that takes a value as an input, and produces a value: Constraint Cst(arg: Value) -> Value { ... }
// Constraint that returns multiple values: Constraint Cst() -> (result1: Value, result2: ValueRange); ```
When returning multiple results, each result can be optionally be named (the result of a Constraint/Rewrite in the case of multiple results is a tuple).
These body of a Constraint/Rewrite functions can be specified in several ways:
* Externally In this case we are importing an external function (registered by the user outside of PDLL):
```pdll Constraint Foo(op: Op); Rewrite Bar(); ```
* In PDLL (using PDLL constructs) In this case, the body is defined using PDLL constructs:
```pdll Rewrite BuildFooOp() { // The result type of the Rewrite is inferred from the return. return op<my_dialect.foo>; } // Constraints/Rewrites can also implement a lambda/expression // body for simple one line bodies. Rewrite BuildFooOp() => op<my_dialect.foo>; ```
* In PDLL (using a native/C++ code block) In this case the body is specified using a C++(or potentially other language at some point) code block. When building PDLL in AOT mode this will generate a native constraint/rewrite and register it with the PDL bytecode.
```pdll Rewrite BuildFooOp() -> Op<my_dialect.foo> [{ return rewriter.create<my_dialect::FooOp>(...); }]; ```
Differential Revision: https://reviews.llvm.org/D115836
show more ...
|
| #
3ee44cb7 |
| 16-Dec-2021 |
River Riddle <[email protected]> |
[PDLL] Add a `rewrite` statement to enable complex rewrites
The `rewrite` statement allows for rewriting a given root operation with a block of nested rewriters. The root operation is not implicitly
[PDLL] Add a `rewrite` statement to enable complex rewrites
The `rewrite` statement allows for rewriting a given root operation with a block of nested rewriters. The root operation is not implicitly erased or replaced, and any transformations to it must be expressed within the nested rewrite block. The inner body may contain any number of other rewrite statements, variables, or expressions.
Differential Revision: https://reviews.llvm.org/D115299
show more ...
|
| #
12eebb8e |
| 16-Dec-2021 |
River Riddle <[email protected]> |
[PDLL] Add a `replace` rewrite statement for replacing operations
This statement acts as a companion to the existing `erase` statement, and is the corresponding PDLL construct for the `PatternRewrit
[PDLL] Add a `replace` rewrite statement for replacing operations
This statement acts as a companion to the existing `erase` statement, and is the corresponding PDLL construct for the `PatternRewriter::replaceOp` C++ API. This statement replaces a given operation with a set of values.
Differential Revision: https://reviews.llvm.org/D115298
show more ...
|
| #
f62a57a3 |
| 16-Dec-2021 |
River Riddle <[email protected]> |
[PDLL] Add support for tuple types and expressions
Tuples are used to group multiple elements into a single compound value. The values in a tuple can be of any type, and do not need to be of the sam
[PDLL] Add support for tuple types and expressions
Tuples are used to group multiple elements into a single compound value. The values in a tuple can be of any type, and do not need to be of the same type. There is also no limit to the number of elements held by a tuple.
Tuples will be used to support multiple results from Constraints and Rewrites (added in a followup), and will also make it easier to support more complex primitives (such as range based maps that can operate on multiple values).
Differential Revision: https://reviews.llvm.org/D115297
show more ...
|
| #
02670c3f |
| 16-Dec-2021 |
River Riddle <[email protected]> |
[PDLL] Add support for `op` Operation expressions
An operation expression in PDLL represents an MLIR operation. In the match section of a pattern, this expression models one of the input operations
[PDLL] Add support for `op` Operation expressions
An operation expression in PDLL represents an MLIR operation. In the match section of a pattern, this expression models one of the input operations to the pattern. In the rewrite section of a pattern, this expression models one of the operations to create. The general structure of the operation expression is very similar to that of the "generic form" of textual MLIR assembly:
``` let root = op<my_dialect.foo>(operands: ValueRange) {attr = attr: Attr} -> (resultTypes: TypeRange); ```
For now we only model the components that are within PDL, as PDL gains support for blocks and regions so will this expression.
Differential Revision: https://reviews.llvm.org/D115296
show more ...
|
| #
d7e7fdf3 |
| 16-Dec-2021 |
River Riddle <[email protected]> |
[PDLL] Add support for literal Attribute and Type expressions
This allows for using literal attributes and types within PDLL, which simplifies building both constraints and rewriters. For example, c
[PDLL] Add support for literal Attribute and Type expressions
This allows for using literal attributes and types within PDLL, which simplifies building both constraints and rewriters. For example, checking if an attribute is true is as simple as `attr<"true">`.
Differential Revision: https://reviews.llvm.org/D115295
show more ...
|
| #
11d26bd1 |
| 16-Dec-2021 |
River Riddle <[email protected]> |
[mlir][PDLL] Add an initial frontend for PDLL
This is a new pattern rewrite frontend designed from the ground up to support MLIR constructs, and to target PDL. This frontend language was proposed in
[mlir][PDLL] Add an initial frontend for PDLL
This is a new pattern rewrite frontend designed from the ground up to support MLIR constructs, and to target PDL. This frontend language was proposed in https://llvm.discourse.group/t/rfc-pdll-a-new-declarative-rewrite-frontend-for-mlir/4798
This commit starts sketching out the base structure of the frontend, and is intended to be a minimal starting point for building up the language. It essentially contains support for defining a pattern, variables, and erasing an operation. The features mentioned in the proposal RFC (including IDE support) will be added incrementally in followup commits.
I intend to upstream the documentation for the language in a followup when a bit more of the pieces have been landed.
Differential Revision: https://reviews.llvm.org/D115093
show more ...
|