This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][PDL] Add support for representing and lowering negated constraints
ClosedPublic

Authored by martin-luecke on Jun 27 2023, 6:55 AM.

Details

Summary

This commit enables modelling negation of native constraints.

This is accomplished through an attribute isNegated on the operations pdl.apply_native_constraint and pdl_interp.apply_constraint and according adjustments to the conversion in the ConvertPDLToPDLInterpPass.

Diff Detail

Event Timeline

martin-luecke created this revision.Jun 27 2023, 6:55 AM
Herald added a project: Restricted Project. · View Herald Transcript
martin-luecke requested review of this revision.Jun 27 2023, 6:55 AM
Mogball accepted this revision.Jun 29 2023, 9:43 AM
Mogball added inline comments.
mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
50
mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td
105

please fit this into a line 80 characters wide

mlir/lib/Conversion/PDLToPDLInterp/Predicate.h
474

Why did this need to get defined?

This revision is now accepted and ready to land.Jun 29 2023, 9:43 AM

address comments

martin-luecke marked 3 inline comments as done.Aug 24 2023, 6:27 AM

Thank you for the comments @Mogball

I do not have commit priviledges, so if you are happy with the current state I would appreciate it if you could commit on my behalf.

mlir/lib/Conversion/PDLToPDLInterp/Predicate.h
474

The error I get without this is along the lines of

llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h:267:44: error: ‘getHashValue’ is not a member of ‘llvm::DenseMapInfo<bool, void>’
  267 |         DenseMapInfo<EltType>::getHashValue(std::get<I>(values)),

i.e. the correct hash function for this key could not be found. I added this as a fix, similar to the other structs defined here that have a boolean as part of their key.