[all-commits] [llvm/llvm-project] 26222d: [mlir][DeclarativeParser] Add support for the Type...

River Riddle via All-commits all-commits at lists.llvm.org
Fri Feb 21 15:17:32 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 26222db01b079023d0fe3bb60f2c1b38f4f19d5a
      https://github.com/llvm/llvm-project/commit/26222db01b079023d0fe3bb60f2c1b38f4f19d5a
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-02-21 (Fri, 21 Feb 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
    M mlir/include/mlir/Dialect/VectorOps/VectorOps.td
    M mlir/include/mlir/IR/OpImplementation.h
    M mlir/include/mlir/IR/OperationSupport.h
    M mlir/lib/Dialect/StandardOps/IR/Ops.cpp
    M mlir/lib/Dialect/VectorOps/VectorOps.cpp
    M mlir/test/IR/invalid-ops.mlir
    M mlir/tools/mlir-tblgen/OpFormatGen.cpp

  Log Message:
  -----------
  [mlir][DeclarativeParser] Add support for the TypesMatchWith trait.

This allows for injecting type constraints that are not direct 1-1 mappings, for example when one type is equal to the element type of another. This allows for moving over several more parsers to the declarative form.

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


  Commit: 2d0477a003687588886ae6e9b59b9355f8bb6b8c
      https://github.com/llvm/llvm-project/commit/2d0477a003687588886ae6e9b59b9355f8bb6b8c
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-02-21 (Fri, 21 Feb 2020)

  Changed paths:
    M mlir/docs/OpDefinitions.md
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
    M mlir/lib/Dialect/StandardOps/IR/Ops.cpp
    M mlir/test/mlir-tblgen/op-format-spec.td
    M mlir/tools/mlir-tblgen/OpFormatGen.cpp

  Log Message:
  -----------
  [mlir][DeclarativeParser] Add basic support for optional groups in the assembly format.

When operations have optional attributes, or optional operands(i.e. empty variadic operands), the assembly format often has an optional section to represent these arguments. This revision adds basic support for defining an "optional group" in the assembly format to support this. An optional group is defined by wrapping a set of elements in `()` followed by `?` and requires the following:

* The first element of the group must be either a literal or an operand argument.
  - This is because the first element must be optionally parsable.
* There must be exactly one argument variable within the group that is marked as the anchor of the group. The anchor is the element whose presence controls whether the group should be printed/parsed. An element is marked as the anchor by adding a trailing `^`.
* The group must only contain literals, variables, and type directives.
  - Any attribute variables may be used, but only optional attributes can be marked as the anchor.
  - Only variadic, i.e. optional, operand arguments can be used.
  - The elements of a type directive must be defined within the same optional group.

An example of this can be seen with the assembly format for ReturnOp, which has a variadic number of operands.

```
def ReturnOp : ... {
  let arguments = (ins Variadic<AnyType>:$operands);

  // We only print the operands+types if there are a non-zero number
  // of operands.
  let assemblyFormat = "attr-dict ($operands^ `:` type($operands))?";
}
```

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


  Commit: ca4ea51c0af2dd3f3c73adc587c8e642c9dcdeec
      https://github.com/llvm/llvm-project/commit/ca4ea51c0af2dd3f3c73adc587c8e642c9dcdeec
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-02-21 (Fri, 21 Feb 2020)

  Changed paths:
    M mlir/docs/OpDefinitions.md
    M mlir/test/lib/TestDialect/TestOps.td
    M mlir/test/mlir-tblgen/op-format-spec.td
    M mlir/test/mlir-tblgen/op-format.mlir
    M mlir/tools/mlir-tblgen/OpFormatGen.cpp

  Log Message:
  -----------
  [mlir][DeclarativeParser] Add an 'attr-dict-with-keyword' directive

This matches the '(print|parse)OptionalAttrDictWithKeyword' functionality provided by the assembly parser/printer.

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


  Commit: 93813e5feb18ece7becd1eece24d0138c955fd53
      https://github.com/llvm/llvm-project/commit/93813e5feb18ece7becd1eece24d0138c955fd53
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-02-21 (Fri, 21 Feb 2020)

  Changed paths:
    M mlir/include/mlir/Support/STLExtras.h

  Log Message:
  -----------
  [mlir] Add a utility iterator range that repeats a given value `n` times.

This range is useful when an desired API expects a range or when comparing two different ranges for equality, but the underlying data is a splat. This range removes the need to explicitly construct a vector in those cases.

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


  Commit: b1de971ba8c83c82ef63077b666aaff3ba8e56b9
      https://github.com/llvm/llvm-project/commit/b1de971ba8c83c82ef63077b666aaff3ba8e56b9
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-02-21 (Fri, 21 Feb 2020)

  Changed paths:
    M mlir/docs/OpDefinitions.md
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    M mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
    M mlir/include/mlir/IR/OpBase.td
    M mlir/include/mlir/TableGen/Constraint.h
    M mlir/include/mlir/TableGen/Operator.h
    A mlir/include/mlir/TableGen/Successor.h
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
    M mlir/lib/TableGen/CMakeLists.txt
    M mlir/lib/TableGen/Constraint.cpp
    M mlir/lib/TableGen/Operator.cpp
    A mlir/lib/TableGen/Successor.cpp
    M mlir/test/Dialect/SPIRV/control-flow-ops.mlir
    M mlir/test/lib/TestDialect/TestOps.td
    M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

  Log Message:
  -----------
  [mlir][ODS] Add support for specifying the successors of an operation.

This revision add support in ODS for specifying the successors of an operation. Successors are specified via the `successors` list:
```
let successors = (successor AnySuccessor:$target, AnySuccessor:$otherTarget);
```

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


  Commit: 9eb436feaa7f5f01dc4852396647a5b46311c8eb
      https://github.com/llvm/llvm-project/commit/9eb436feaa7f5f01dc4852396647a5b46311c8eb
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-02-21 (Fri, 21 Feb 2020)

  Changed paths:
    M mlir/docs/OpDefinitions.md
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    M mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
    M mlir/include/mlir/IR/OpImplementation.h
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
    M mlir/lib/Dialect/StandardOps/IR/Ops.cpp
    M mlir/lib/Parser/Parser.cpp
    M mlir/test/Dialect/SPIRV/control-flow-ops.mlir
    M mlir/test/IR/invalid.mlir
    M mlir/test/lib/TestDialect/TestOps.td
    M mlir/test/mlir-tblgen/op-format-spec.td
    M mlir/test/mlir-tblgen/op-format.mlir
    M mlir/tools/mlir-tblgen/OpFormatGen.cpp

  Log Message:
  -----------
  [mlir][DeclarativeParser] Add support for formatting the successors of an operation.

This revision add support for formatting successor variables in a similar way to operands, attributes, etc.

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


  Commit: 0050e8f0cf5782217ebd78fa2b58be3aa9f8d9e2
      https://github.com/llvm/llvm-project/commit/0050e8f0cf5782217ebd78fa2b58be3aa9f8d9e2
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-02-21 (Fri, 21 Feb 2020)

  Changed paths:
    M mlir/docs/Tutorials/Toy/Ch-2.md
    M mlir/docs/Tutorials/Toy/Ch-3.md
    M mlir/docs/Tutorials/Toy/Ch-4.md
    M mlir/docs/Tutorials/Toy/Ch-5.md
    M mlir/docs/Tutorials/Toy/Ch-6.md
    M mlir/docs/Tutorials/Toy/Ch-7.md
    M mlir/examples/toy/Ch2/include/toy/Ops.td
    M mlir/examples/toy/Ch2/mlir/Dialect.cpp
    M mlir/examples/toy/Ch3/include/toy/Ops.td
    M mlir/examples/toy/Ch3/mlir/Dialect.cpp
    M mlir/examples/toy/Ch4/include/toy/Ops.td
    M mlir/examples/toy/Ch4/mlir/Dialect.cpp
    M mlir/examples/toy/Ch5/include/toy/Ops.td
    M mlir/examples/toy/Ch5/mlir/Dialect.cpp
    M mlir/examples/toy/Ch6/include/toy/Ops.td
    M mlir/examples/toy/Ch6/mlir/Dialect.cpp
    M mlir/examples/toy/Ch7/include/toy/Ops.td
    M mlir/examples/toy/Ch7/mlir/Dialect.cpp
    M mlir/test/Examples/Toy/Ch2/codegen.toy
    M mlir/test/Examples/Toy/Ch2/scalar.toy
    M mlir/test/Examples/Toy/Ch3/codegen.toy
    M mlir/test/Examples/Toy/Ch3/scalar.toy
    M mlir/test/Examples/Toy/Ch4/codegen.toy
    M mlir/test/Examples/Toy/Ch4/scalar.toy
    M mlir/test/Examples/Toy/Ch4/shape_inference.mlir
    M mlir/test/Examples/Toy/Ch5/affine-lowering.mlir
    M mlir/test/Examples/Toy/Ch5/codegen.toy
    M mlir/test/Examples/Toy/Ch5/scalar.toy
    M mlir/test/Examples/Toy/Ch5/shape_inference.mlir
    M mlir/test/Examples/Toy/Ch6/affine-lowering.mlir
    M mlir/test/Examples/Toy/Ch6/codegen.toy
    M mlir/test/Examples/Toy/Ch6/llvm-lowering.mlir
    M mlir/test/Examples/Toy/Ch6/scalar.toy
    M mlir/test/Examples/Toy/Ch6/shape_inference.mlir
    M mlir/test/Examples/Toy/Ch7/affine-lowering.mlir
    M mlir/test/Examples/Toy/Ch7/codegen.toy
    M mlir/test/Examples/Toy/Ch7/llvm-lowering.mlir
    M mlir/test/Examples/Toy/Ch7/scalar.toy
    M mlir/test/Examples/Toy/Ch7/shape_inference.mlir
    M mlir/test/Examples/Toy/Ch7/struct-codegen.toy
    M mlir/test/Examples/Toy/Ch7/struct-opt.mlir

  Log Message:
  -----------
  [mlir][Tutorial] Add a section to Toy Ch.2 detailing the custom assembly format.

Summary:
This details the C++ format as well as the new declarative format. This has been one of the major missing pieces from the toy tutorial.

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


Compare: https://github.com/llvm/llvm-project/compare/393f4e8ac263...0050e8f0cf57


More information about the All-commits mailing list