This adds conversions for const_size and to_extent_tensor. Also, cast-like operations are now folded away if the source and target types are the same.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/Shape/IR/Shape.cpp | ||
---|---|---|
543 | I don't know how to test this case, as it is illegal. I just added it for completeness if this every materializes during some conversion. |
mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp | ||
---|---|---|
133 | nit: notifyMatchFailure | |
mlir/lib/Dialect/Shape/IR/Shape.cpp | ||
543 | I think this would do it: func @f(%arg0: index) { %0 = size_to_index(%arg0) return s } foldCastOp is for non-constant but where we otherwise know the op is structurally identity. |
mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp | ||
---|---|---|
67 | Should we make this pattern fail in case the result type is a shape.size? |
mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp | ||
---|---|---|
67 | But even if the result is a shape.size, we would lower it to a index value when going to standard. It cannot be an error. | |
mlir/lib/Dialect/Shape/IR/Shape.cpp | ||
543 | If I write a test case where %arg0 is of type index, then I cannot even parse it because passing and index to this operation is invalid. I guess I should remove it again. I also have no good use for it. This op is the structural identity of the two types are the same. Would you prefer to spell this out here? |
mlir/lib/Dialect/Shape/IR/Shape.cpp | ||
---|---|---|
543 | Sounds like it can be a TODO for when size_to_index accepts index inputs. |
mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td | ||
---|---|---|
443 | Ouch, thanks :) |
Ouch, thanks :)