[mlir][Linalg] Fix hoist padding through scf.for iter_arg
authorNicolas Vasilache <nicolas.vasilache@gmail.com>
Tue, 4 Apr 2023 15:17:19 +0000 (08:17 -0700)
committerNicolas Vasilache <nicolas.vasilache@gmail.com>
Thu, 13 Apr 2023 12:21:38 +0000 (05:21 -0700)
commitb3ed6e545568a2b483561b416c36942ce2e5d2a2
tree27a427db37bbba04b3263e6d808f1077efa9e7e1
parentc950ba7d4898f63cb7734482b4dfa38ade6f685b
[mlir][Linalg] Fix hoist padding through scf.for iter_arg

Previously, hoisting through an iter_arg would mistakenly yield the unpadded value and
cast it to the padded value.

This was incorrect and resulted in out-of-bounds accesses.
The correct formulation is to yield the padded value and extract a smaller dynamic slice
out of it.

Differential Revision: https://reviews.llvm.org/D148173
mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp
mlir/test/Dialect/Linalg/transform-op-hoist-pad.mlir