No need to fill the buffer if no padding is added. I.e., the tensor.pad is packing only.
Also improve tensor::createPadHighOp to use attributes instead of SSA values for high padding sizes when possible.
Depends On: D153555
Paths
| Differential D153874
[mlir][linalg] Do not emit FillOp for tensor.pad with zero padding ClosedPublic Authored by springerm on Jun 27 2023, 7:24 AM.
Details Summary No need to fill the buffer if no padding is added. I.e., the tensor.pad is packing only. Also improve tensor::createPadHighOp to use attributes instead of SSA values for high padding sizes when possible. Depends On: D153555
Diff Detail
Event Timelinespringerm added a parent revision: D153555: [mlir][linalg][NFC] Return tensor::PadOp handle from transform op.Jun 27 2023, 7:24 AM springerm added a child revision: D153970: [mlir][linalg] BufferizeToAllocationOp: Bufferize ops, not values.Jun 28 2023, 6:49 AM mravishankar added inline comments.
This revision now requires changes to proceed.Jun 28 2023, 9:15 PM springerm added inline comments.
springerm added inline comments.
This revision now requires review to proceed.Jul 4 2023, 8:45 AM This revision is now accepted and ready to land.Jul 4 2023, 9:22 AM Closed by commit rGbb566b652f7d: [mlir][linalg] Do not emit FillOp for tensor.pad with zero padding (authored by springerm). · Explain WhyJul 4 2023, 11:45 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 534972 mlir/lib/Dialect/Linalg/Transforms/ConvertToDestinationStyle.cpp
mlir/lib/Dialect/Tensor/Utils/Utils.cpp
mlir/test/Dialect/Linalg/generalize-tensor-pack.mlir
mlir/test/Dialect/Linalg/pad-to-specific-memory-space.mlir
mlir/test/Dialect/Linalg/transform-op-pad.mlir
|
This seems strange. Why is there even a pad op if we don't have low pad or high pad. That seems like that pad should be folded away.