This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg] Add getIteratorTypesArray to LinalgInterface.
ClosedPublic

Authored by olegshyshkov on Sep 27 2022, 4:45 AM.

Details

Summary

Most of the code that gets iterator_types from LinalgInterface is forced to
extract values from an Attribute. As a result, the usage pattern looks like
this:

SmallVector<StringRef> iterators = llvm::to_vector<4>(linalgOp.iterator_types().getAsValueRange<StringAttr>());

It also forces all operations that implement LinalgOp interface to have
iterator_types attribute even when the information can be easily infered from
other parameters.

In perfect future, getIteratorTypeArray should be the only method to get
iterator types from the interface. The default implementation can rely on
iterator_types attribute though.

The name getIteratorTypeArray was picked to be consistent with existing
getIndexingMapsArray.

This patch add a few sample usages. More cleanups will follow.

Diff Detail

Event Timeline

olegshyshkov created this revision.Sep 27 2022, 4:45 AM
olegshyshkov requested review of this revision.Sep 27 2022, 4:45 AM
pifon2a accepted this revision.Sep 27 2022, 6:39 AM
This revision is now accepted and ready to land.Sep 27 2022, 6:39 AM

clang-format

This revision was landed with ongoing or failed builds.Sep 27 2022, 7:31 AM
This revision was automatically updated to reflect the committed changes.