[tosa] Should unranked tensor allowed for `tosa::reduce_*Op`?

Hi, I have a question: Should an unranked tensor allowed for tosa::reduce_*Op? Currently, the verifier permits unranked tensors, but I believe this is invalid.

Hi @MLS, when you say “unranked” are you referring to a scalar rank-0 tensor or a tensor with unknown rank e.g. tensor<*xf32>?

If you’re referring to the former, I just created a patch to prevent the creation of some operations with rank-0 operands/results: [mlir][tosa] Require operand/result tensors of at least rank 1 for some operations by lhutton1 · Pull Request #131335 · llvm/llvm-project · GitHub, including the reduce* ops.

For the latter, I believe these should be permitted by the verifier, since the operation can be updated with a type that has a known rank later on. The validation pass can be run to ensure no unranked tensors exist.

Hope this helps - Luke

1 Like

Thanks for your answer. I see.