This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Make ViewLikeInterface Range work with attributes
ClosedPublic

Authored by ftynse on Jul 13 2022, 4:18 AM.

Details

Summary

While most of methods in ViewLikeInterface accept an OpFoldResult for
the offset/size/stride that may be static, represented as Attribute,
or dynamic, represented as Value, the Range abstraction only
accepted Values. This can often lead to known-constant
offset/size/strides being materialized into constant operations and
hinder further constant propagation without explicitly running the
constant folding pass. This often leads to a more complicated than
necessary addressing code being emitted. Switch Range to use
OpFoldResult. Code that uses Range currently keeps materializing the
constants to minimize the effect of this change on the IR. Further
commits will make use of this.

Diff Detail

Event Timeline

ftynse created this revision.Jul 13 2022, 4:18 AM
ftynse requested review of this revision.Jul 13 2022, 4:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 4:18 AM
mravishankar accepted this revision.Jul 13 2022, 10:12 AM

Nice! Always wanted this, but it also means changes to downstream usages, but worth it for me!

mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
1411

Could we check for this condition and fail early. So move it all the way to the top. Sorry, I know this is not part of the change really, but then you wont need the #ifndef NDEBUG eyesore...

This revision is now accepted and ready to land.Jul 13 2022, 10:12 AM
nicolasvasilache accepted this revision.Jul 14 2022, 5:21 AM
ftynse updated this revision to Diff 445825.Jul 19 2022, 7:54 AM
ftynse marked an inline comment as done.

Address review.

This revision was landed with ongoing or failed builds.Jul 27 2022, 1:52 AM
This revision was automatically updated to reflect the committed changes.