[mlir] detensorize: don't accidentally convert function entry blocks
authorAlex Zinenko <zinenko@google.com>
Sat, 22 Apr 2023 08:57:10 +0000 (08:57 +0000)
committerAlex Zinenko <zinenko@google.com>
Tue, 25 Apr 2023 03:33:54 +0000 (03:33 +0000)
commit65eedcebdc03052959508911417bac548009652a
tree6f12106b3a886560f4f7d3dc1a60b38c68155262
parent8117f58adc97b4e1bb8720d2113a7e092260131b
[mlir] detensorize: don't accidentally convert function entry blocks

In the Linalg detensorize pass, dialect conversion could accidentally
trigger signature conversion of the function entry block after inlining
the body of a Linalg generic into it. Such a conversion is not desirable
because it would break the internal validity of the function op, that is
futhermore not supposed to be detensorized at the boundary. Mitigate
this by creating a dummy (empty) entry block so Linalg operations are
never inlined into it and the conversion is never triggered.

Closes #62249.

Reviewed By: silvas

Differential Revision: https://reviews.llvm.org/D148983
mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
mlir/test/Dialect/Linalg/detensorize_entry_block.mlir [new file with mode: 0644]
mlir/test/Dialect/Linalg/detensorize_while_pure_cf.mlir