Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlir-opt --tosa-to-linalg-pipeline fails in validation: element type 'f32' is not legal #89926

Open
PerMildner opened this issue Apr 24, 2024 · 0 comments

Comments

@PerMildner
Copy link

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 2bcbe40.

I have attached a full transcript.

bad_tosa.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants