Hi all,
Can anyone help me with the following tosa dialect IR? I feel it should be able to convert via mlir-opt --tosa-to-scf
but I get a failure to legalize operation when I run it through mlir-op
.
module {
func @entry_fun(%ival: tensor<i32>, %jval: tensor<i32>, %lim: tensor<i32>) -> tensor<i32> {
%0 = "tosa.while_loop"(%ival) ( {
^bb0(%arg0: tensor<i32>): // no predecessors
%1 = "tosa.greater_equal"(%arg0, %lim) : (tensor<i32>, tensor<i32>) -> tensor<i1>
%2 = "tosa.bitwise_not"(%1) : (tensor<i1>) -> tensor<i1>
"tosa.yield"(%2, %arg0) : (tensor<i1>, tensor<i32>) -> ()
}, {
^bb0(%arg0: tensor<i32>): // no predecessors
%2 = "tosa.while_loop"(%jval) ( {
^bb0(%arg1: tensor<i32>): // no predecessors
%3 = "tosa.greater_equal"(%arg1, %lim) : (tensor<i32>, tensor<i32>) -> tensor<i1>
%4 = "tosa.bitwise_not"(%3) : (tensor<i1>) -> tensor<i1>
"tosa.yield"(%4, %arg1) : (tensor<i1>, tensor<i32>) -> ()
}, {
^bb0(%arg1: tensor<i32>): // no predecessors
%3 = "tosa.add"(%arg0, %arg1) : (tensor<i32>, tensor<i32>) -> tensor<i32>
"tosa.yield"(%3) : (tensor<i32>) -> ()
}) : (tensor<i32>) -> tensor<i32>
"tosa.yield"(%2) : (tensor<i32>) -> ()
}) : (tensor<i32>) -> tensor<i32>
return %0 : tensor<i32>
}
}
Is it possible to have nested tosa.while_loops ops? Unless I am missing something very obvious here I am a little stumped as to why the IR is not converting.
Thanks!
Anthony