Page MenuHomePhabricator

[mlir][MemRef] Fix canonicalization of BufferCast(TensorLoad).
ClosedPublic

Authored by akuegel on Aug 5 2021, 2:30 AM.

Details

Summary

CastOp::areCastCompatible does not check whether casts are definitely compatible.
When going from dynamic to static offset or stride, the canonicalization cannot
know whether it is really cast compatible. In that case, it can only canonicalize
to an alloc plus copy.

Diff Detail

Event Timeline

akuegel created this revision.Aug 5 2021, 2:30 AM
akuegel requested review of this revision.Aug 5 2021, 2:30 AM
herhut added a comment.Aug 5 2021, 5:21 AM

Thanks, just nits.

mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
343

Maybe use llvm::zip to iterate both?

362

DimOp always yields an index typed value.

akuegel updated this revision to Diff 364432.Aug 5 2021, 5:52 AM

Address nits.

akuegel marked 2 inline comments as done.Aug 5 2021, 5:53 AM

Thanks for the review :)

herhut accepted this revision.Aug 5 2021, 6:33 AM

Thanks for fixing this!

This revision is now accepted and ready to land.Aug 5 2021, 6:33 AM