This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add apply_patterns op to transform dialect
AbandonedPublic

Authored by guraypp on Sep 23 2022, 3:10 AM.

Details

Summary

This revision introduces a transform.structured.apply_patterns operation that operates on an isolated from above op and applies a set of patterns while updating transform dialect handles.

It provides currently three patterns

  • canonicalization: adds all the canonicalization patterns of all registered dialects and ops.
  • rank_reducing: adds patterns that results in rank-reducing behavior on subset-based operations.
  • vector_to_gpu: adds patterns that converts vector dialect to gpu dialect.

Depends on D134190

Event Timeline

guraypp created this revision.Sep 23 2022, 3:10 AM
guraypp published this revision for review.Sep 23 2022, 3:11 AM
nicolasvasilache requested changes to this revision.Sep 23 2022, 3:18 AM
nicolasvasilache added subscribers: Mogball, ftynse.

unfortunately we cannot have this in upstream MLIR (@ftynse @mehdi_amini @Mogball in case there is a possible way forward for CSE / canonicalization with custom Rewriter/Driver that use Listeners)

This revision now requires changes to proceed.Sep 23 2022, 3:18 AM
guraypp abandoned this revision.Sep 23 2022, 5:49 AM

It looks like supporting this Op is not possible because of the reasons that @nicolasvasilache mentioned. So I abandon it.

unfortunately we cannot have this in upstream MLIR (@ftynse @mehdi_amini @Mogball in case there is a possible way forward for CSE / canonicalization with custom Rewriter/Driver that use Listeners)

Not sure about CSE, but for canonicalization what you need is the information of what the operation is being replaced with. We already have a hook that indicates that an operation is being replaced, adding an extra operand to that hook to indicate the replacement could be enough for your use case...