This is an archive of the discontinued LLVM Phabricator instance.

[mlir][MemRef] Expose utility to invert subview index mapping
AbandonedPublic

Authored by christopherbate on Aug 25 2022, 12:08 PM.

Details

Summary

The FoldSubView transformation contains a utility that takes a set of
indices in the domain of a memref.subview result and transform them
into the domain of the memref.subview's source. This function is
useful more widely, especially when "subview folding" needs to be
implemented in other dialects. It is therefore moved under
MemRef/Utils.h and renamed to a memref::invertSubViewIndexMapping.

Diff Detail

Event Timeline

christopherbate requested review of this revision.Aug 25 2022, 12:08 PM

@christopherbate note https://reviews.llvm.org/D128986 which also supports expand / collapse.
I suspect we can refactor at finer granularity and make the individual parts more composable (i.e. make OpFoldResult and AffineApply happen under the hood rather than have to maintain all this if/else everywhere).

mlir/include/mlir/Dialect/MemRef/Utils/MemRefUtils.h
39

invert is a misnomer IMO, this is better thought of as folding through a subview.

christopherbate abandoned this revision.Sep 21 2022, 3:38 PM

Closing in favor of introducing interface. Here is the draft diff: https://reviews.llvm.org/D134393