This is an archive of the discontinued LLVM Phabricator instance.

[mlir][irdl] Add `irdl.any_of` operation
ClosedPublic

Authored by math-fehr on Mar 9 2023, 3:48 PM.

Details

Summary

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

Diff Detail

Event Timeline

math-fehr created this revision.Mar 9 2023, 3:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2023, 3:48 PM
math-fehr requested review of this revision.Mar 9 2023, 3:48 PM
Mogball accepted this revision.May 4 2023, 2:38 AM
Mogball added inline comments.
mlir/lib/Dialect/IRDL/IR/IRDLOps.cpp
59
61

can these be const?

mlir/lib/Dialect/IRDL/IRDLRegistration.cpp
419 ↗(On Diff #503959)
This revision is now accepted and ready to land.May 4 2023, 2:38 AM
math-fehr updated this revision to Diff 523154.May 17 2023, 1:29 PM
math-fehr marked 3 inline comments as done.

Address comments, and rebase on main

This revision was automatically updated to reflect the committed changes.