[all-commits] [llvm/llvm-project] 11d26b: [mlir][PDLL] Add an initial frontend for PDLL

River Riddle via All-commits all-commits at lists.llvm.org
Wed Dec 15 18:17:05 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 11d26bd14327bf92e8fd154527d76ae4e48df74a
      https://github.com/llvm/llvm-project/commit/11d26bd14327bf92e8fd154527d76ae4e48df74a
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2021-12-16 (Thu, 16 Dec 2021)

  Changed paths:
    A mlir/include/mlir/Tools/PDLL/AST/Context.h
    A mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h
    A mlir/include/mlir/Tools/PDLL/AST/Nodes.h
    A mlir/include/mlir/Tools/PDLL/AST/Types.h
    A mlir/include/mlir/Tools/PDLL/Parser/Parser.h
    M mlir/lib/Tools/CMakeLists.txt
    A mlir/lib/Tools/PDLL/AST/CMakeLists.txt
    A mlir/lib/Tools/PDLL/AST/Context.cpp
    A mlir/lib/Tools/PDLL/AST/Diagnostic.cpp
    A mlir/lib/Tools/PDLL/AST/NodePrinter.cpp
    A mlir/lib/Tools/PDLL/AST/Nodes.cpp
    A mlir/lib/Tools/PDLL/AST/TypeDetail.h
    A mlir/lib/Tools/PDLL/AST/Types.cpp
    A mlir/lib/Tools/PDLL/CMakeLists.txt
    A mlir/lib/Tools/PDLL/Parser/CMakeLists.txt
    A mlir/lib/Tools/PDLL/Parser/Lexer.cpp
    A mlir/lib/Tools/PDLL/Parser/Lexer.h
    A mlir/lib/Tools/PDLL/Parser/Parser.cpp
    M mlir/test/CMakeLists.txt
    M mlir/test/lit.cfg.py
    A mlir/test/mlir-pdll/Parser/directive-failure.pdll
    A mlir/test/mlir-pdll/Parser/expr-failure.pdll
    A mlir/test/mlir-pdll/Parser/include.pdll
    A mlir/test/mlir-pdll/Parser/include/included.pdll
    A mlir/test/mlir-pdll/Parser/lit.local.cfg
    A mlir/test/mlir-pdll/Parser/pattern-failure.pdll
    A mlir/test/mlir-pdll/Parser/pattern.pdll
    A mlir/test/mlir-pdll/Parser/stmt-failure.pdll
    A mlir/test/mlir-pdll/Parser/stmt.pdll
    M mlir/tools/CMakeLists.txt
    A mlir/tools/mlir-pdll/CMakeLists.txt
    A mlir/tools/mlir-pdll/mlir-pdll.cpp
    M utils/bazel/llvm-project-overlay/mlir/BUILD.bazel

  Log Message:
  -----------
  [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


  Commit: 322691ab6344942032581850008d041509caa1fa
      https://github.com/llvm/llvm-project/commit/322691ab6344942032581850008d041509caa1fa
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2021-12-16 (Thu, 16 Dec 2021)

  Changed paths:
    M mlir/lib/Tools/PDLL/Parser/Parser.cpp
    M mlir/test/mlir-pdll/Parser/pattern-failure.pdll
    M mlir/test/mlir-pdll/Parser/pattern.pdll

  Log Message:
  -----------
  [PDLL] Add support for parsing pattern metadata

This allows for overriding the metadata of a pattern and
providing information such as the benefit, bounded recursion,
and more in the future.

Differential Revision: https://reviews.llvm.org/D115294


  Commit: d7e7fdf3aaaf35b1be9b45ee4120976cd57d55ef
      https://github.com/llvm/llvm-project/commit/d7e7fdf3aaaf35b1be9b45ee4120976cd57d55ef
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2021-12-16 (Thu, 16 Dec 2021)

  Changed paths:
    M mlir/include/mlir/Tools/PDLL/AST/Nodes.h
    M mlir/lib/Tools/PDLL/AST/NodePrinter.cpp
    M mlir/lib/Tools/PDLL/AST/Nodes.cpp
    M mlir/lib/Tools/PDLL/Parser/Parser.cpp
    M mlir/test/mlir-pdll/Parser/expr-failure.pdll
    A mlir/test/mlir-pdll/Parser/expr.pdll

  Log Message:
  -----------
  [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


  Commit: 02670c3f385f24789797cde340be60e8ab2447c1
      https://github.com/llvm/llvm-project/commit/02670c3f385f24789797cde340be60e8ab2447c1
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2021-12-16 (Thu, 16 Dec 2021)

  Changed paths:
    M mlir/include/mlir/Tools/PDLL/AST/Nodes.h
    M mlir/lib/Tools/PDLL/AST/NodePrinter.cpp
    M mlir/lib/Tools/PDLL/AST/Nodes.cpp
    M mlir/lib/Tools/PDLL/Parser/Parser.cpp
    M mlir/test/mlir-pdll/Parser/expr-failure.pdll
    M mlir/test/mlir-pdll/Parser/expr.pdll

  Log Message:
  -----------
  [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


  Commit: f62a57a3f02e03c2eff79d66265e1b0f32dceffa
      https://github.com/llvm/llvm-project/commit/f62a57a3f02e03c2eff79d66265e1b0f32dceffa
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2021-12-16 (Thu, 16 Dec 2021)

  Changed paths:
    M mlir/include/mlir/Tools/PDLL/AST/Nodes.h
    M mlir/include/mlir/Tools/PDLL/AST/Types.h
    M mlir/lib/Tools/PDLL/AST/Context.cpp
    M mlir/lib/Tools/PDLL/AST/NodePrinter.cpp
    M mlir/lib/Tools/PDLL/AST/Nodes.cpp
    M mlir/lib/Tools/PDLL/AST/TypeDetail.h
    M mlir/lib/Tools/PDLL/AST/Types.cpp
    M mlir/lib/Tools/PDLL/Parser/Parser.cpp
    M mlir/test/mlir-pdll/Parser/expr-failure.pdll
    M mlir/test/mlir-pdll/Parser/expr.pdll

  Log Message:
  -----------
  [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


  Commit: 12eebb8e378a5e218716ead0f02be0369f48d76d
      https://github.com/llvm/llvm-project/commit/12eebb8e378a5e218716ead0f02be0369f48d76d
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2021-12-16 (Thu, 16 Dec 2021)

  Changed paths:
    M mlir/include/mlir/Tools/PDLL/AST/Nodes.h
    M mlir/lib/Tools/PDLL/AST/NodePrinter.cpp
    M mlir/lib/Tools/PDLL/AST/Nodes.cpp
    M mlir/lib/Tools/PDLL/Parser/Parser.cpp
    M mlir/test/mlir-pdll/Parser/stmt-failure.pdll
    M mlir/test/mlir-pdll/Parser/stmt.pdll

  Log Message:
  -----------
  [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


  Commit: 3ee44cb775ebe58e833c668c03b6fcf0a850e5c7
      https://github.com/llvm/llvm-project/commit/3ee44cb775ebe58e833c668c03b6fcf0a850e5c7
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2021-12-16 (Thu, 16 Dec 2021)

  Changed paths:
    M mlir/include/mlir/Tools/PDLL/AST/Nodes.h
    M mlir/lib/Tools/PDLL/AST/NodePrinter.cpp
    M mlir/lib/Tools/PDLL/AST/Nodes.cpp
    M mlir/lib/Tools/PDLL/Parser/Parser.cpp
    M mlir/test/mlir-pdll/Parser/stmt-failure.pdll
    M mlir/test/mlir-pdll/Parser/stmt.pdll

  Log Message:
  -----------
  [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


Compare: https://github.com/llvm/llvm-project/compare/8f1ea2e85ca6...3ee44cb775eb


More information about the All-commits mailing list