[Mlir-commits] [mlir] [mlir][tosa] Fix lowering of tosa.conv2d (PR #73240)

Spenser Bauman llvmlistbot at llvm.org
Wed Nov 29 05:08:02 PST 2023


sabauma wrote:

These operators come out of the TFL->TOSA lowerings where we end up with a mixture of TOSA and other dialects in the IR. The pattern looks something like the following:

Start with a fully dynamic tosa.conv operator:

    %producer = tosa.something ... : tensor<?x?x?x?xf32>
    %conv = tosa.conv2d %p ... : tensor<?x?x?x?xf32>
    %consumer = non_tosa.op %conv

`tosa-infer-shapes` then resolves the dimensions of some of the inputs to the `tosa.conv2d` operator.

    %producer = tosa.something ... : tensor<1x2x3x4xf32>
    %conv = tosa.conv2d %p ... : tensor<?x?x?x?xf32>
    %consumer = non_tosa.op %conv

`tosa-infer-shapes` will not update the output type of `tosa.conv2d` in this case because the consumer op does not have a shape inference related interface and is not a `func.return` op.

https://github.com/llvm/llvm-project/pull/72715 attempts to address this limitation in the `tosa-infer-shapes` pass.

It seemed desirable to also address this issue in the `tosa-to-linalg-named` lowering as well, as the lowering currently produces invalid IR for inputs that pass all the verifiers.

https://github.com/llvm/llvm-project/pull/73240


More information about the Mlir-commits mailing list