This allows replacing of this op with a true_witness in the case of both
inputs being const_shapes and being found to be broadcastable.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/Shape/IR/Shape.cpp | ||
---|---|---|
302 | As far as the constant folding logic, you can just use an i1 for a witness. You just need to add a case in ShapeDialect::materializeConstant know how to materialize it into a true_witness op or false_witness op (or just a single const_witness?). Maybe you can rename this patch "introduce basic constant folding for witnesses" and use this fold as the first example? |
mlir/lib/Dialect/Shape/IR/Shape.cpp | ||
---|---|---|
302 | It took me a long time to figure out that I could use a BoolAttr for this. In the spirit of small commits, I'm leaving the ConstWitnessOp creation separate, but I'm not folding this for constant false witnesses because that needs to be carefully thought through as that is removing an assert that can be triggered. |
This commit breaks building MLIR for me. You need to create the directory IR in the build directory in mlir/lib/Dialect/Shape/CMakeLists.txt. Otherwise mlir-tblgen fails with a file not found error.
Would a simple op.lhs() == op.rhs() work?