func.func @main(){
%0 = “tosa.constant”() {value = dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64>} : () → tensor<2x3xf64>
%1 = “tosa.constant”() {value = dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64>} : () → tensor<2x3xf64>
%2 = “tosa.add”(%0,%1):(tensor<2x3xf64>,tensor<2x3xf64>) → tensor<2x3xf64>
return
}
This mlir code is lowering well but can’t lower this code
func.func @main()-> tensor<2x3xf64> {
%0 = “tosa.constant”() {value = dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64>} : () → tensor<2x3xf64>
%1 = “tosa.constant”() {value = dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64>} : () → tensor<2x3xf64>
%2 = “tosa.add”(%0,%1):(tensor<2x3xf64>,tensor<2x3xf64>) → tensor<2x3xf64>
return %2 : tensor<2x3xf64>
}
build/bin/hello-opt --mlir-print-ir-after-all test/Hello/print.mlir
loc(“test/Hello/print.mlir”:7:10): error: failed to materialize conversion for result #0 of operation ‘hello.add’ that remained live after conversion
// -----// IR Dump After {anonymous}::HelloToAffineLowerPass Failed () //----- //
module {
func.func @main() → tensor<2x3xf64> {
%0 = “hello.constant”() <{value = dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64>}> : () → tensor<2x3xf64>
%1 = “hello.constant”() <{value = dense<[[1.000000e+00, 2.000000e+00, 3.000000e+00], [4.000000e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64>}> : () → tensor<2x3xf64>
%2 = “hello.add”(%0, %1) : (tensor<2x3xf64>, tensor<2x3xf64>) → tensor<2x3xf64>
return %2 : tensor<2x3xf64>
}
}
why?
why is it giving conversion error?