Introduce a pattern to 'push down' a tensor.unpack through a
tensor.pad. The propagation happens if the unpack does not touch the
padded dimensions.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Let me know if you want to move this pattern as part of the tensor dialect. Currently, here as I did not want add another test pass just for this single pattern.
mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp | ||
---|---|---|
468 | nit: tensor.pad | |
471 | Should we rename it to PushDownUnPackThroughPadOp or BubbleUpPadThroughUnPack? | |
476–477 | The inputPad is only used here. I think padOp.getSource() contains a solid meaning, so we don't have to declare a variable for it. | |
506 | I think we should add a matching check for padOp.getConstantPaddingValue() because we assume that the pad op has constant padding value in the pattern. |
mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp | ||
---|---|---|
506 | I think the method getConstantPaddingValue is a bit misleading. Constant here means 1) a constant-like value, 2) a bb argument from a different block, or 3) a value defined outside the pad block. Looking at the method, it can fail only if: 1) there is no yield in the pad bb or 2) the padding is defined within the block. I never saw these two conditions, and I am not even sure we want allow them in tensor.pad. |
nit: tensor.pad