This is an archive of the discontinued LLVM Phabricator instance.

[mlir][scf] refactor scf structuralOpConversion to better support 1:N type conversion
ClosedPublic

Authored by Peiming on Oct 31 2022, 11:36 AM.

Details

Summary

This patch moves the 1:N type mapping into its own classes to allow better code reuse in D137100.

Diff Detail

Event Timeline

Peiming created this revision.Oct 31 2022, 11:36 AM
Peiming requested review of this revision.Oct 31 2022, 11:36 AM
Peiming edited the summary of this revision. (Show Details)Oct 31 2022, 11:44 AM

I already had commented on the other one, so this is also LGTM, but wait for Alex.

mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
75

Packs

ftynse accepted this revision.Nov 2 2022, 5:02 AM

LGTM with comments addressed.

mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
35–39

Please document top-level classes, especially the expectation of what the Converter should provide. Looking at the uses below, it looks like Structural1ToNConversionPattern follows CRTP and Converter is the concrete derived class. If that's the case, it is preferable to reflect this in the name of the attribute, e.g., ConcretePattern.

73

Did you mean "operation"?

86–88

Nit: wrap this into brackets. We omit brackets when both the condition and the body are single-line.

106

Please document.

126–127

This reflow looks irrelevant. Is your editor configured to wrap at 79 cols rather than 80?

This revision is now accepted and ready to land.Nov 2 2022, 5:02 AM
Peiming updated this revision to Diff 472649.Nov 2 2022, 9:33 AM
Peiming marked 6 inline comments as done.

Address comments from Alex.

mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
106

I add a more detailed comment in the base class.

Peiming updated this revision to Diff 472650.Nov 2 2022, 9:34 AM

minor fix.

This revision was landed with ongoing or failed builds.Nov 2 2022, 9:45 AM
This revision was automatically updated to reflect the committed changes.