[PATCH] D76817: `shape` dialect: add some ops

Jacques Pienaar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 17:58:01 PDT 2020


jpienaar added inline comments.


================
Comment at: mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td:189
+    in the tensor equals the rank of the shape, and the elements equal the
+    extents of the shape.
+  }];
----------------
silvas wrote:
> jpienaar wrote:
> > What happens for unranked and or dynamic tensors?
> it return the shape. Notice that the return type is not static shaped. For an unranked tensor it will return a `tensor<?xi32>` (or index someday).
Thus far FromExtentTensorOp has as input a tensor with known values and produces a fixed shape shape (e.g., there is no special numeric values that correspond to unknown). But another problem is that ToExtentTensor now needs to convert from a shape which may be an error to a tensor of ints. The intention is to have all shape ops be side-effect free and I don't see how that can be maintained for this op.

What I had though of here was something like:

```
shape.if_static(%s : shape) {
  ^bb(%t: tensor<?xi32>):
     ... now use as 
} else {
}
```

so that you only convert when it is safe,


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76817/new/

https://reviews.llvm.org/D76817





More information about the llvm-commits mailing list