This is an archive of the discontinued LLVM Phabricator instance.

[mlir][MemRef] Move narrow type emulation common methods to MemRefUtils.
ClosedPublic

Authored by hanchung on Jul 11 2023, 2:15 PM.

Details

Summary

It also unifies the computation of StridedLayoutAttr. If the stride is
static known value, we can just use it.

Diff Detail

Event Timeline

hanchung created this revision.Jul 11 2023, 2:15 PM
Herald added a project: Restricted Project. · View Herald Transcript
hanchung requested review of this revision.Jul 11 2023, 2:15 PM

This addresses the refactoring part about my review comment in https://reviews.llvm.org/D154178

mravishankar accepted this revision.Jul 11 2023, 3:27 PM

Thanks for the refactoring.

This revision is now accepted and ready to land.Jul 11 2023, 3:27 PM
hanchung updated this revision to Diff 539657.Jul 12 2023, 11:34 AM

Add a MemRefUtils target to avoid cyclic deps

hanchung updated this revision to Diff 540142.Jul 13 2023, 11:42 AM

fix bazel deps

Great, thanks for surfacing this cleanly, this looks useful!

mlir/lib/Dialect/MemRef/Utils/MemRefUtils.cpp
50

Didn't look deeply at this method yet but have you tried using/extending utils from mlir/include/mlir/Dialect/Utils/IndexingUtils.h ?

Given that I am seeing a lot of linearize / delinearize business in there I thought I would surface.

Bonus points to refactoring this enough that it could become a new helper directly in IndexingUtils.h, but this may be a bridge too far, haven't thought about this deeply enough yet.