Hi All,
I’m new to MLIR, so I might well be doing something silly or non-sensical.
What I have is the following MLIR:
module {
func.func @global_tosa_pad_kernel(%arg0: tensor<3x3xf32>, %arg1: tensor<2x2xi32>, %arg2: tensor<f32>) -> (tensor<5x5xf32>) {
%0 = "tosa.pad"(%arg0, %arg1, %arg2) {} : (tensor<3x3xf32>, tensor<2x2xi32>, tensor<f32>) -> (tensor<5x5xf32>)
return %0 : tensor<5x5xf32>
}
}
and from the command line, I’m running:
mlir-opt --tosa-to-tensor --tensor-bufferize --func-bufferize --buffer-results-to-out-params --finalizing-bufferize test.mlir -o test.out
The passes I’m using above are part of a larger pass pipeline that should eventually lower the function to SPIR-V.
I’m getting the following error when the FinalizingBufferize pass is run:
./test.mlir:3:10: error: failed to legalize operation 'linalg.map'
%0 = "tosa.pad"(%arg0, %arg1, %arg2) {} : (tensor<3x3xf32>, tensor<2x2xi32>, tensor<f32>) -> (tensor<5x5xf32>)
^
./bin/test.mlir:3:10: note: see current operation:
%24 = "linalg.map"(%23) ({
%29 = "linalg.index"() <{dim = 0 : i64}> : () -> index loc("./bin/test.mlir":3:10)
%30 = "linalg.index"() <{dim = 1 : i64}> : () -> index loc("./bin/test.mlir":3:10)
"linalg.yield"(%9) : (f32) -> () loc("./bin/test.mlir":3:10)
}) : (tensor<5x5xf32>) -> tensor<5x5xf32> loc("./bin/test.mlir":3:10)
Am I missing a pass here?
Any help would be appreciated.
Thanks,
Grant