Many time, when I use relax.build() API to deploy a AI Model, Error occur in tvm::codegen::CodeGenLLVM::Verify() after tvm::codegen::CodeGenLLVM::Finish(). there are generally two type errors in LLVM Side: a):operator are not of the same type! E.G:
Both operands to ICmp instruction are not of the same type!
%109 = icmp eq i32 %1, i64 1
Both operands to ICmp instruction are not of the same type!
%119 = icmp eq i32 %1, i64 1
b):Found return instr that returns non-void in Function of void return type! E.G:
Found return instr that returns non-void in Function of void return type!
ret i32 %12
voidFound return instr that returns non-void in Function of void return type!
ret i32 %74
voidFound return instr that returns non-void in Function of void return type!
ret i32 %9
void
I have commit this kind issue, see Int32/Int64 issue when codegen into llvm::Function?
in my limited knowledge, we could transform the Primfunc to Legal Form before we download it to llvm::Funtion. Yes, I had found some kind Pass in tir/transform, such as tir.transform.NarrowDataType(), tir.transform.ForceNarrowIndexToInt32(), etc, but which have’t nicely solved my diffculty.
Is there any idea to the above issues?