[WIP] Remove `tensor.empty` for fusion cases.
For a dispatch of the form
tensor.empty -> linalg.fill -> linalg.matmul -> linalg.generic
in some cases, the tensor.empty can be replaced with using the output of the linalg.generic directly if the result of the linalg.matmul has the same type as the result of linalg.generic. This transformation already existed in the ConvertToDestinationPassingStyle pass but was removed since the assumption was that after vectorization the tensor.empty would be dead. Adding this back since for non-vectorization cases this will result in an unnecessary stack allocation.
Fixes #14316, #14305
FYI, @hanhanW and @dcaballe . I think this enables the removal of tensor.empty with ConvertToDestinationPassingStyle pass. I am just leaving this as a draft for now. If you want you can cherry-pick this on your PRs and try.
I haven't had time to look into this but, before it gets stale, would it make sense to merge it?
I haven't had time to look into this but, before it gets stale, would it make sense to merge it?
I think I can merge it.... let me rebase.
@MaheshRavishankar this has two issues attached to it - is this something you want to rebase/land or should we close them all?
(closing as stale)