This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Print both types for linalg.transpose
ClosedPublic

Authored by bkramer on Sep 10 2020, 8:58 AM.

Details

Summary

Previously only the input type was printed, and the parser applied it to
both input and output, creating an invalid transpose. Print and parse
both types, and verify that they match.

Diff Detail

Event Timeline

bkramer created this revision.Sep 10 2020, 8:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 10 2020, 8:58 AM
bkramer requested review of this revision.Sep 10 2020, 8:58 AM
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
860

Please extract this piece into a function that can be reused in both the builder and the verifier.
E.g.

MemRefType inferTransposeResultType(sourceType, permutationMap);
929

I'd make the verifier check dstType == inferTransposeResultType(...).

mlir/test/Dialect/Linalg/roundtrip.mlir
129

does this allow

memref<?x?x?xf32, offset: ?, strides: [1, ?, ?]>>

?

bkramer updated this revision to Diff 291035.Sep 10 2020, 11:12 AM

Factor out inferTransposeResultType

bkramer marked 2 inline comments as done.Sep 10 2020, 11:14 AM
bkramer added inline comments.
mlir/test/Dialect/Linalg/roundtrip.mlir
129

No, that's not the same type. I don't know if there's a way of expressing the transposition in this syntax.

This revision is now accepted and ready to land.Sep 11 2020, 1:08 AM
This revision was landed with ongoing or failed builds.Sep 11 2020, 2:18 AM
This revision was automatically updated to reflect the committed changes.