This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Correct verifyCompatibleShapes
ClosedPublic

Authored by tpopp on Mar 10 2021, 3:57 AM.

Details

Summary

verifyCompatibleShapes is not transitive. Create an n-ary version and
update SameOperandShapes and SameOperandAndResultShapes traits to use
it.

Diff Detail

Event Timeline

tpopp created this revision.Mar 10 2021, 3:57 AM
tpopp requested review of this revision.Mar 10 2021, 3:57 AM
tpopp updated this revision to Diff 329607.Mar 10 2021, 4:00 AM

Add a missing newline and remove an unneeded include.

A test case that would have passed before and fails now would be nice:

%2 = some_same_shape_op %0, %1 : tensor<?xf32>, tensor<4xf32> -> tensor<7xf32>
mlir/lib/IR/TypeUtilities.cpp
170

nit: extra line?

174

Should the same comment exists twice? I think it would be enough in the header.

182

any_of?

199–201

If you extract this, it'd be easier to read, I feel.

frgossen accepted this revision.Mar 10 2021, 4:16 AM
This revision is now accepted and ready to land.Mar 10 2021, 4:16 AM
tpopp updated this revision to Diff 329629.Mar 10 2021, 5:41 AM
tpopp marked 4 inline comments as done.

Respond to feedback.

tpopp added inline comments.Mar 10 2021, 5:48 AM
mlir/lib/IR/TypeUtilities.cpp
174

I'm just following the other examples in the file.

182

No. Any mixture of ShapedTypes and non-ShapedTypes is not allowed in the other functions.

tpopp updated this revision to Diff 329637.Mar 10 2021, 6:00 AM

Add test case.

frgossen accepted this revision.Mar 11 2021, 1:37 AM

Thanks!