This is an archive of the discontinued LLVM Phabricator instance.

[mlir][MemRef] Change the anchor point of a subview pattern
ClosedPublic

Authored by qcolombet on Oct 12 2022, 6:03 PM.

Details

Summary

Essentially, this patches changes the anchor point of the extract_strided_metadata(subview) pattern from extract_strided_metadata to subview.

In details, this means that instead of replacing:

base, offset, sizes, strides = extract_strided_metadata(subview(src))

With

base, ... = extract_strided_metadata(src)
offset = <some math>
sizes = subSizes
strides = <some math>

We replace only the subview part and connect it back with a reinterpret_cast:

val = subview(src)

>

base, ... = extract_strided_metadata(src)
offset = <some math>
sizes = subSizes
strides = <some math>
val = reinterpret_cast base, offset, sizes, strides

Note: This patch is part of a series that replaces the lowering of view like operations in MemRefToLLVM with composable patterns.
Note2: This patch depends on other patches in that series but mostly only because of the output of the tests.

Diff Detail

Event Timeline

qcolombet created this revision.Oct 12 2022, 6:03 PM
qcolombet requested review of this revision.Oct 12 2022, 6:03 PM
qcolombet edited the summary of this revision. (Show Details)Oct 12 2022, 6:04 PM
qcolombet added a subscriber: llvm-commits.
nicolasvasilache accepted this revision.Oct 13 2022, 3:10 AM
This revision is now accepted and ready to land.Oct 13 2022, 3:10 AM
qcolombet updated this revision to Diff 468334.Oct 17 2022, 2:39 PM
This revision was landed with ongoing or failed builds.Nov 14 2022, 10:54 AM
This revision was automatically updated to reflect the committed changes.