This is an archive of the discontinued LLVM Phabricator instance.

[mlir] support creating memref descriptors from static shape with non-zero offset
ClosedPublic

Authored by gysit on Feb 12 2020, 3:07 AM.

Details

Summary

This patch adapts the method MemRefDescriptor::fromStaticShape to support static non-zero offsets. The updated method uses the getStridesAndOffset method to extract strides and offset. The patch also adapts the test cases since sizes and strides are now set in forward instead of reverse order.

Diff Detail

Unit TestsFailed

Event Timeline

gysit created this revision.Feb 12 2020, 3:07 AM
ftynse requested changes to this revision.Feb 12 2020, 6:19 AM

Can you add a tests where the non-zero offset is exercised?

Nit: you could have kept the loop order reversed to spare yourself the effort of changing the tests.

This revision now requires changes to proceed.Feb 12 2020, 6:19 AM
gysit updated this revision to Diff 244169.Feb 12 2020, 7:00 AM

I added a test for a memref with a non-zero offset and non-standard strides. Let me know if you had another test in mind...

ftynse accepted this revision.Feb 12 2020, 1:32 PM

Thanks!

This revision is now accepted and ready to land.Feb 12 2020, 1:32 PM
This revision was automatically updated to reflect the committed changes.