Page MenuHomePhabricator

Introduce tensor.insert op to Tensor dialect.
ClosedPublic

Authored by hanchung on Fri, Jun 11, 11:29 AM.

Details

Summary

Add tensor.insert op to make tensor.extract/tensor.insert work in pairs
for scalar domain. Like subtensor/subtensor_insert work in pairs in
tensor domain, and vector.transfer_read/vector.transfer_write work in
pairs in vector domain.

Diff Detail

Event Timeline

hanchung created this revision.Fri, Jun 11, 11:29 AM
hanchung requested review of this revision.Fri, Jun 11, 11:29 AM
hanchung updated this revision to Diff 351516.Fri, Jun 11, 11:35 AM

delete wrong comments

silvas requested changes to this revision.Fri, Jun 11, 12:40 PM
silvas added inline comments.
mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
212

Could the syntax tensor.insert %ut into %dest[%1, %2] : tensor<*xi32>work as well? The scalar type being inserted should always be the tensor element type (I think TypesMatchWith is able to support this)

227

nit: why is cast to ShapedType needed?

mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
299

Redundant after you add TypesMatchWith for scalar.

This revision now requires changes to proceed.Fri, Jun 11, 12:40 PM
hanchung updated this revision to Diff 351572.Fri, Jun 11, 3:54 PM
hanchung marked 3 inline comments as done.

address comments

mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
212

Yes, it works. I also added the case to ops.mlir. It won't complain after adding TypesMatchWith.

227

Done. It is not needed. I copied it from ExtractOp, but did not notice it.

mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
299

Done, deleted.

silvas accepted this revision.Fri, Jun 11, 5:24 PM
This revision is now accepted and ready to land.Fri, Jun 11, 5:24 PM
This revision was automatically updated to reflect the committed changes.