HomePhabricator

[mlir][Linalg] Allow folding to rank-zero tensor when using rank-reducing…

Authored by mravishankar on May 6 2021, 5:17 PM.

Description

[mlir][Linalg] Allow folding to rank-zero tensor when using rank-reducing subtensors.

The pattern to convert subtensor ops to their rank-reduced versions
(by dropping unit-dims in the result) can also convert to a zero-rank
tensor. Handle that case.
This also fixes a OOB access bug in the existing pattern for such
cases.

Differential Revision: https://reviews.llvm.org/D101949