This is an archive of the discontinued LLVM Phabricator instance.

Make shape.is_broadcastable/shape.cstr_broadcastable nary
ClosedPublic

Authored by tpopp on Feb 10 2021, 1:44 AM.

Details

Summary

This corresponds with the previous work to make shape.broadcast nary.
Additionally, simplify the ConvertShapeConstraints pass. It now doesn't
lower an implicit shape.is_broadcastable. This is still the same in
combination with shape-to-standard when the 2 passes are used in either
order.

Diff Detail

Event Timeline

tpopp created this revision.Feb 10 2021, 1:44 AM
tpopp requested review of this revision.Feb 10 2021, 1:44 AM
herhut added inline comments.Feb 10 2021, 6:30 AM
mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
276

Why do you sometimes use iv and sometimes outputDimension?

286

nit: std::tie?

frgossen accepted this revision.Feb 10 2021, 7:04 AM
frgossen added inline comments.
mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
224

Is the error something like type not buildable? In that case you could add the missing C++ for the type, I think.

mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
240

They can be shapes, can't they?
In that case, don't we want to make the pattern fail normally?

tpopp updated this revision to Diff 323036.Feb 11 2021, 8:39 AM
tpopp marked 2 inline comments as done.

Address code cleanup comments.

mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
224

I was just getting compile time errors right after the table-gen'ed code. It wasn't at runtime. Any pointers to code snippets would be welcomed though. I couldn't figure out what to do.

mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
240

Thanks for catching that. Done.

tpopp marked an inline comment as done.Feb 11 2021, 8:39 AM
frgossen added inline comments.Feb 12 2021, 1:10 AM
mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
224

I meant BuildableType in mlir/include/mlir/IR/OpBase.td.
The I type in the same file is an example of a type that implements it so it's probably not the problem you ran into.

rriddle added inline comments.Feb 12 2021, 1:12 AM
mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
237

This should be emitting an error if there is a failure. Otherwise, it is silent with no indication to the user what is wrong. This points to a lack of test coverage.

758

Same here.

tpopp updated this revision to Diff 323684.Feb 15 2021, 1:12 AM

Add message and tests for op verification failures

tpopp marked 2 inline comments as done.Feb 15 2021, 1:12 AM
This revision was not accepted when it landed; it landed in state Needs Review.Feb 15 2021, 7:05 AM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.