Issue 89926
Summary mlir-opt --tosa-to-linalg-pipeline fails in validation: element type 'f32' is not legal
Labels new issue
Assignees
Reporter PerMildner
    It seems `mlir-opt --tosa-to-linalg-pipeline` unconditionally uses the Basic Inference profile, and therefore only allows integer types.

The help-text for `--tosa-to-linalg-pipeline` says

> The default pipeline for converting TOSA operators to the equivalent operations using the tensor operations in LinAlg as well as LinAlg named operations.

so I would have assumed it should be usable also for floating point tensors.

I could not find any tests using `--tosa-to-linalg-pipeline` except tests that are supposed to fail. Other tests seems build a stripped down version of `--tosa-to-linalg-pipeline` using explicit `--pass-pipeline`.

The symptom is:
```
$ cat ../bad_tosa.mlir
module attributes {llvm.data_layout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", llvm.target_triple = "x86_64-unknown-linux-gnu"} {
  func.func @main_graph() -> (tensor<1xf32>) {
    %0 = "tosa.const"() <{value = dense<0.000000e+00> : tensor<1xf32>}> : () -> tensor<1xf32>
    return %0 : tensor<1xf32>
  }
}

$ build/bin/mlir-opt --tosa-to-linalg-pipeline ../bad_tosa.mlir
../bad_tosa.mlir:3:10: error: 'tosa.const' op is not profile-aligned: element type 'f32' is not legal
 %0 = "tosa.const"() <{value = dense<0.000000e+00> : tensor<1xf32>}> : () -> tensor<1xf32>
         ^
../bad_tosa.mlir:3:10: note: see current operation: %0 = "tosa.const"() <{value = dense<0.000000e+00> : tensor<1xf32>}> : () -> tensor<1xf32>
../bad_tosa.mlir:4:5: error: 'func.return' op is not profile-aligned: element type 'f32' is not legal
 return %0 : tensor<1xf32>
    ^
../bad_tosa.mlir:4:5: note: see current operation: "func.return"(%0) : (tensor<1xf32>) -> ()
```
Commit 2bcbe40f8a1c6cc9a256711261d8aa8fde50f7b3.

I have attached a full transcript.

[bad_tosa.txt](https://github.com/llvm/llvm-project/files/15094963/bad_tosa.txt)

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to