This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector] Share enums with the transform dialect
ClosedPublic

Authored by qcolombet on Jan 16 2023, 11:09 AM.

Details

Summary

Refactor the definition of the enums that are used in the lower_vectors operation of the transformation dialect.
This avoid duplicating the definition of all the configurations that this operation can trigger.

NFC

Diff Detail

Event Timeline

qcolombet created this revision.Jan 16 2023, 11:09 AM
Herald added a reviewer: ftynse. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
qcolombet requested review of this revision.Jan 16 2023, 11:10 AM
qcolombet added inline comments.Jan 16 2023, 11:15 AM
mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
54

We have to explicitly list all the fields here to have the proper parsing of the enums.

This may have an impact on the supported syntax. I.e., I don't know if attr-dict allows to put the attributes in whatever order, but if it does, then we lose this ability here.

mlir/include/mlir/Dialect/Vector/Transforms/VectorTransformsEnums.h
2 ↗(On Diff #489606)

This file is a work around the fact that tablegen'ed enums header are not guarded.
I don't know how we want to move forward here.

mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
54

attr-dict allows any order and not enforcing a particular order indeed seems better.

Lookup oilist in the ODS doc, it does what you want here: https://mlir.llvm.org/docs/DefiningDialects/Operations/#directives

mlir/include/mlir/Dialect/Vector/Transforms/VectorTransformsEnums.h
2 ↗(On Diff #489606)

Just add the include to VectorTransforms.h and avoid a special include file for this?

  • Make the change really NFC thanks to oilist (thanks @nicolasvasilache for the pointer)
  • Include directly VectorTransforms.h to avoid creating a VectorTransformsEnums header
This revision is now accepted and ready to land.Jan 17 2023, 12:57 AM
qcolombet marked 2 inline comments as done.Jan 17 2023, 12:57 AM
qcolombet added inline comments.
mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
54

Great!

ftynse accepted this revision.Jan 17 2023, 1:01 AM
This revision was automatically updated to reflect the committed changes.
qcolombet marked an inline comment as done.