Depends On D99159
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/Shape/IR/Shape.cpp | ||
---|---|---|
1081 | Can we generalize this? Like can we also canonicalize %0 = shape.shape_of %arg : tensor<?x?x?xf32> -> tensor<?xindex> %1 = tensor.cast %0 : tensor<?xindex> to tensor<3xindex> I would assume it can work both ways. The only case I'm not sure is safe is with unranked tensors like. %0 = shape.shape_of %arg : tensor<*xf32> -> tensor<?xindex> %1 = tensor.cast %0 : tensor<?xindex> to tensor<3xindex> |
This moves us a little further in the direction of having more precise types in the shape dialect in the non-error bearing case. I think this is the right direction to go but also want to give Jacques a chance to comment.
mlir/lib/Dialect/Shape/IR/Shape.cpp | ||
---|---|---|
1029 | This change seems unrelated. Can you add a motivation to the diff description? | |
1031 | nit: Move into conditional. |
mlir/lib/Dialect/Shape/IR/Shape.cpp | ||
---|---|---|
1081 | Good point, yes, the former would also be a valid canonicalization. The latter is not, unless we give shape_of asserting behavior wrt. its return type, which tensor.cast has. I think we should not and rather use the cast in this case. This is independent of the fact that asserting behavior is not implemented for tensor.cast I think. |
Thanks!
mlir/lib/Dialect/Shape/IR/Shape.cpp | ||
---|---|---|
1029 | Right, it does not really belong here. Will make a separate CL |
This change seems unrelated. Can you add a motivation to the diff description?