@weilinquan
Yes, I believe above PR also enables the use of the attribute.
But I’m not sure if everything is fine for the transpose op.
@makslevental
Thanks for pointing out your PR!
I’ve tried it and can create linalg.transpose with operands and attribute
op1 = tensor.EmptyOp([1, 13], f32)
op2 = tensor.EmptyOp([13, 1], f32)
op3 = linalg.TransposeOp(input=op1, init=op2, result=[RankedTensorType.get((13, 1), f32)], permutation=[1,0])
This gives
%0 = "tensor.empty"() : () -> tensor<1x13xf32>
%1 = "tensor.empty"() : () -> tensor<13x1xf32>
%2 = "linalg.transpose"(%0, %1) <{permutation = array<i64: 1, 0>}> ({
}) : (tensor<1x13xf32>, tensor<13x1xf32>) -> tensor<13x1xf32>
But, there’s an issue when I feed it to the mlir-opt.
<stdin>:4:8: error: 'linalg.transpose' op region #0 ('region') failed to verify constraint: region with 1 blocks
%2 = "linalg.transpose"(%0, %1) <{permutation = array<i64: 1, 0>}> ({
^
It doesn’t seem to be caused by your PR but we’re creating generic mlir operation from python and when the created operation is parsed, it doesn’t satisfy the verifier in this case.