This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg] Fix `FoldInitTensorWithDimOp` if dim(init_tensor) is static.
ClosedPublic

Authored by pifon2a on Sep 3 2021, 10:06 AM.

Details

Summary

It looks like it was a typo. Instead of *maybeConstantIndex,
initTensorOp.getStaticSize(*maybeConstantIndex) should be used to access the
dim size of the tensor. There is a test for that in canonicalize.mlir, but it
was working correctly because ReplaceStaticShapeDims was canonicalizing DimOp
before FoldInitTensorWithDimOp. So, to make the patterns more "orthogonal",
this case is disabled.

Diff Detail