[MLIR][Affine] Add utility to check if the slice is valid
authorVinayaka Bandishti <vinayaka@polymagelabs.com>
Thu, 1 Apr 2021 09:08:24 +0000 (14:38 +0530)
committerUday Bondhugula <uday@polymagelabs.com>
Thu, 1 Apr 2021 09:22:22 +0000 (14:52 +0530)
commitdc537158d5372894b539b7cf90ace3cfe911a520
treed114360005ea87dc2296d6b29043c7e183c545cc
parentb468f0e165ed67c5b1046b295b65e446afee62aa
[MLIR][Affine] Add utility to check if the slice is valid

Fixes a bug in affine fusion pipeline where an incorrect slice is computed.
After the slice computation is done, original domain of the the source is
compared with the new domain that will result if the fusion succeeds. If the
new domain must be a subset of the original domain for the slice to be
valid. If the slice computed is incorrect, fusion based on such a slice is
avoided.

Relevant test cases are added/edited.

Fixes https://bugs.llvm.org/show_bug.cgi?id=49203

Differential Revision: https://reviews.llvm.org/D98239
mlir/include/mlir/Analysis/Utils.h
mlir/include/mlir/Transforms/LoopFusionUtils.h
mlir/lib/Analysis/AffineStructures.cpp
mlir/lib/Analysis/Utils.cpp
mlir/lib/Transforms/Utils/LoopFusionUtils.cpp
mlir/test/Transforms/loop-fusion-slice-computation.mlir
mlir/test/Transforms/loop-fusion.mlir
mlir/test/lib/Transforms/TestLoopFusion.cpp