Page MenuHomePhabricator

[MLIR] Propagate unpack through element-wise ops

Authored by chelini on Jan 24 2023, 11:50 PM.



Introduce pushDownUnPackOpThroughElemGenericOp to propagate producer
unpack operation through an element-wise linalg.generic operation. This
pattern complements BubbleUpPackOpThroughElemGenericOp. The general
idea is to bubble up tensor.pack as much as possible while pushing down
tensor.unpack as much as possible, and canonicalize away symmetrical
tensor.pack and tensor.unpack operations.

Currently, pushDownUnPackOpThroughElemGenericOp expects a single
tensor.unpack operation as the producer of one of the linalg.generic's

Diff Detail

Event Timeline

chelini created this revision.Jan 24 2023, 11:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 24 2023, 11:50 PM
chelini requested review of this revision.Jan 24 2023, 11:50 PM
hanchung added inline comments.Jan 30 2023, 8:10 PM

nit: unpack


nit: auto. The getDefiningOp already spells the type.


I think we don't need this variable. Because we can check if unPackedOperand is set or not. If it's already set, we can return failure directly.


does this comment explain anything happening in the test or it just a separate note?

If it is just a note, I'd prefer removing it from here.

chelini updated this revision to Diff 493598.Jan 31 2023, 6:48 AM

Address comments.

chelini marked 4 inline comments as done.Jan 31 2023, 6:48 AM
hanchung accepted this revision.Jan 31 2023, 8:05 PM

nice work, thanks!

This revision is now accepted and ready to land.Jan 31 2023, 8:05 PM
chelini retitled this revision from [MLIR] Introduce a pattern unpack through elementwise op to [MLIR] Propagate unpack through element-wise ops.Feb 1 2023, 12:11 AM
This revision was automatically updated to reflect the committed changes.