Hi all, I’m new here, studying how to convert mlir to llvm-ir(and finally, to machine code); Soon i met the problem:
A.mlir:
module {
func.func public @main(%arg0: tensor<f32> ) -> (tensor<f32>) {
%0 = arith.mulf %arg0, %arg0 : tensor<f32>
return %0 : tensor<f32>
}
}
B.mlir:
module {
func.func public @main(%arg0: f32 ) -> (f32) {
%0 = arith.mulf %arg0, %arg0 : f32
return %0 : f32
}
}
When i execute: mlir-opt A.mlir --convert-to-llvm -o llvm.ir, nothing changed in the output file, while convertting B.mlir successfully emits llvm-ir:
module {
llvm.func @main(%arg0: f32) -> f32 {
%0 = llvm.fmul %arg0, %arg0 : f32
llvm.return %0 : f32
}
}
I wonder what makes ‘tensor’ type special ? Because it has variadic size so we should be aware of tensor alloc/dealloc/ownership?
If so, how can I generate llvm-ir by specifying the mlir-opt command line flags?
And what is the function signature if I want to call this function from “C” ?
Thanks a lot!