[all-commits] [llvm/llvm-project] 42987d: [mlir][irdl] Add `irdl.any_of` operation

Fehr Mathieu via All-commits all-commits at lists.llvm.org
Wed May 17 13:54:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 42987dfa3a85e0cec987b9f07a8ffe61073ddc52
      https://github.com/llvm/llvm-project/commit/42987dfa3a85e0cec987b9f07a8ffe61073ddc52
  Author: Mathieu Fehr <mathieu.fehr at gmail.com>
  Date:   2023-05-17 (Wed, 17 May 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/IRDL/IR/IRDLInterfaces.td
    M mlir/include/mlir/Dialect/IRDL/IR/IRDLOps.td
    M mlir/lib/Dialect/IRDL/IR/IRDLOps.cpp
    M mlir/lib/Dialect/IRDL/IRDLLoading.cpp
    M mlir/test/Dialect/IRDL/cmath.irdl.mlir
    A mlir/test/Dialect/IRDL/cyclic-types.irdl.mlir
    A mlir/test/Dialect/IRDL/cyclic-types.mlir
    A mlir/test/Dialect/IRDL/test-type.irdl.mlir
    A mlir/test/Dialect/IRDL/test-type.mlir
    M mlir/test/Dialect/IRDL/testd.irdl.mlir
    M mlir/test/Dialect/IRDL/testd.mlir

  Log Message:
  -----------
  [mlir][irdl] Add `irdl.any_of` operation

The `irdl.any_of` operation represent a constraint that is satisfied
if any of its subconstraint is satisfied.

For instance, in the following example:
```
%0 = irdl.is f32
%1 = irdl.is f64
%2 = irdl.any_of(f32, f64)
```

`%2` can only be satisfied by `f32` or `f64`.

Note that the verification algorithm required by `irdl.any_of` is
non-trivial, since we want that the order of arguments of
`irdl.any_of` to not matter. For this reason, our registration
algorithm fails if two constraints used by `any_of` might be
satisfied by the same `Attribute`. This is approximated by checking
the possible `Attribute` bases of each constraints.

Depends on D145734

Reviewed By: Mogball

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




More information about the All-commits mailing list