Hey! First time posting here.
I try to convert from tosa dialect to linalg, but I keep getting some weird error. If I use mlir-opt -tosa-to-linalg-on-tensors tosanew.mlir > linalglowering.mlir
I get the expected error because the tf dialect is not milir native: tosanew.mlir:37:11:error:‘tf.Sign’ op created with unregistered dialect. If this is intended, please call allowUnregisteredDialects() on the MLIRContext, or use -allow-unregistered-dialect with mlir-opt
tosanew.mlir:37:11: note: see current operation: %34 = “tf.Sign”(%33) {device = “”} : (tensor<3x3x1x32xf32>) → tensor<3x3x1x32xf32>
but if I use mlir-opt -allow-unregistered-dialect -tosa-to-linalg-on-tensors tosanew.mlir > linalglowering.mlir
the task does not work at all. I get:
It seems to fail on the very first line. Do I do something wrong or did I discover a bug?
For context: I used the tf compiler to lower from the tf dialect to the tosa dialect. Now I want to lower this to linalg and then after that to affine. Thanks for your help!
it should convert the tosa.const operation before hand. The tosa-to-linalg-on-tensors lowering is failing because it assumes that tosa-to-standard has already been invoked.
@MaheshRavishankar I am currently using the FullConversion so that we fail on unrecognized tosa operations so that we can guarantee everything is converted. Likely we will change back to a partial conversion once TOSA is complete. Overall I would like to have a single pipeline added to tosa-to-linalg instead of people invoking the pass themselves.
@mbartel Looking through the current tosa-to-linalg-on-tensors this should not occur as the pass specifically marks tosa.const as legal during the full conversion. Are you using an up to date version of mlir-opt? Can you send the input IR you are using?
@rsuderman After some investigation the error was because of my M1 Mac. Everything works fine except for this weird case. I switched to an ubuntu server and it works.
Cool, I can help from here as well. We are still working on statically shaped ops right now and haven’t begun on dynamic shapes (see the ? size). Its on a roadmap but you will need to guarantee your model is statically shaped for now.
Fortunately in a few weeks we should have tooling to shape propagate, which means if inputs are statically shaped, TOSA operations can propagate their shapes forward.