Hello.
Could you please help me in creating a new mlir::FuncOp and insert it in a ModuleOp.
The FuncOp needs to have a certain name and certain signature, and a certain body I need to create also.
Could you please help me with an example for this task.
Thank you very much,
Alex
llvm-project/Utils.cpp at main Ā· llvm/llvm-project Ā· GitHub shows you relevant code.
Details are:
- You need to set the insertion point to inside of the ModuleOp. This function does this by setting the insertion point just before another function
- You create a FunctionType and then create a FuncOp with that signature (and name).
- You can then create a Block inside of the FuncOp to put any code that you want.
1 Like
Hello. I receive the following error when I create a FuncOp without a body:
error: ābuiltin.funcā op symbol declaration cannot have public visibility
convert_sw_layers_to_Affine2.mlir:5:1: note: see current operation: ābuiltin.funcā() ({
}) {sym_name = āCos0ā, type = (memref<1000xf16>, memref<1000xf16>) ā ()} : () ā ()
Does anybody know why this happens?
Thank you very much,
Alex
Hello. I got away from the above error (error: ābuiltin.funcā op symbol declaration cannot have public visibility) by adding the FuncOp a body and the FunctionType a return type.
So, I solved this problem.
Thank you,
Alex