This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Change IteratorType in ContractionOp in Vector dialect from string to enum.
ClosedPublic

Authored by olegshyshkov on Sep 12 2022, 6:51 AM.

Details

Summary

This is the first step in replacing interator_type from strings with enums in Vector and Linalg dialect. This change adds IteratorTypeAttr and uses it in ContractionOp.

To avoid breaking all the tests, print/parse code has conversion between string and enum for now.

There is a shared code in StructuredOpsUtils.h that expects iterator types to be strings. To break this dependancy, this change forks helper function isParallelIterator and isReductionIterator to utils in both dialects and adds getIteratorTypeNames() to support backward compatibility with StructuredGenerator.

In the later changes, I plan to add a similar enum attribute to Linalg.

Diff Detail

Event Timeline

olegshyshkov created this revision.Sep 12 2022, 6:51 AM
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
olegshyshkov requested review of this revision.Sep 12 2022, 6:51 AM
pifon2a accepted this revision.Sep 12 2022, 7:07 AM

Very nice!

mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
1491–1493

nit:

vector::IteratorType par = vector::IteratorType::parallel,
vector::IteratorType red = vector::IteratorType::reduction;
mlir/lib/Dialect/Vector/IR/VectorOps.cpp
529–531

nit: omit {}

This revision is now accepted and ready to land.Sep 12 2022, 7:07 AM
olegshyshkov marked 2 inline comments as done.Sep 12 2022, 7:32 AM