Unable to convert tosa to linalg

I generated my mlir code using this

resnet18 = models.resnet18(pretrained=True).eval()

module = fx.export_and_import(

    resnet18,

    torch.ones(1, 3, 224, 224),

    output_type="tosa",

    func_name=resnet18.__class__.__name__,

)

os.makedirs("./mlir_model", exist_ok=True)

with open("./mlir_model/test.mlir", "w") as f:

    for i in module.body:

        f.write(str(i))

I am trying to lower the tosa to llvm ir using these passes:

 mlir-opt --tosa-to-linalg-pipeline test.mlir

but facing this error:

 error: invalid properties {values = dense<0.000000e+00> : tensor<64xf32>} for op tosa.const: expected key entry for value in DictionaryAttr to set Properties.

Hi @roopika-19, I generated the TOSA MLIR using your code and then ran mlir-opt with --tosa-to-linalg-pipeline. I was able to lower the TOSA MLIR to Linalg successfully without any errors. Just to double check, do you have the most updated Torch-MLIR code base (assuming that’s where you are executing your code from)? For reference, my Torch-MLIR repo is at this hash:

with externals/llvm-project updated at hash 72144d119a7291f8b6b8e022a2947fbe31e66afc:

Can you update your Torch-MLIR and do git submodule update --recursive to see if it fixes your issue? If you are invoking mlir-opt directly from llvm-project, can you try updating your llvm-project?