This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Support normalizing memrefs with MemRef_ReinterpretCastOp
ClosedPublic

Authored by imaihal on Aug 3 2021, 11:10 PM.

Details

Summary

This patch enables normalizing memrefs with MemRef_ReinterpretCastOp by
adding MemRefsNormalizable trait in the Op definition.

Signed-off-by: Haruki Imai <imaihal@jp.ibm.com>

Diff Detail

Event Timeline

imaihal created this revision.Aug 3 2021, 11:10 PM
imaihal requested review of this revision.Aug 3 2021, 11:10 PM
imaihal added a subscriber: bondhugula.EditedAug 3 2021, 11:19 PM

@bondhugula I would like to support normalizing memrefs with MemRef_ReinterpretCastOp. As usual, this patch adds MemRefNormalizable trait. Could you review this patch?

@bondhugula Sorry again. Could you be a reviewer of this patch?

bondhugula added inline comments.Aug 9 2021, 7:47 PM
mlir/test/Transforms/normalize-memrefs-ops.mlir
128–131

Is this test case really testing this change? The memref_reinterpret_cast has no uses of the memref with the tiled layout map.

imaihal added inline comments.Aug 9 2021, 9:21 PM
mlir/test/Transforms/normalize-memrefs-ops.mlir
128–131

Yes. Without this patch, memrefs with the tiled layout map are not normalized in this function. I think it is because we take conservative approach described here.

https://mlir.llvm.org/doxygen/NormalizeMemRefs_8cpp_source.html#l00143

Check whether all the uses of AllocOps, CallOps and function arguments of a function are either of dereferencing type or are uses in: DeallocOp, CallOp or ReturnOp. Only if these constraints are satisfied will the function become a candidate for normalization. We follow a conservative approach here wherein even if the non-normalizable memref is not a part of the function's argument or return type, we still label the entire function as non-normalizable. We assume external functions to be normalizable.
bondhugula accepted this revision.Aug 10 2021, 7:46 AM
bondhugula added inline comments.
mlir/test/Transforms/normalize-memrefs-ops.mlir
128–131

I see.

This revision is now accepted and ready to land.Aug 10 2021, 7:46 AM
imaihal marked an inline comment as done.Aug 10 2021, 9:03 AM

@bondhugula Thanks for your review! I don't have commit access. So, could you land this patch?