How to add floormod in relay and topi


#1

I found TVM::FloorMod included in the most recent code, So I wanted to look for the FloorMod front-end support, but After I have registered relay and topi for FloorMod , I find that the final calculation procedure calls is llvm

llvm::Value* CodeGenLLVM::VisitExpr_(const Mod* op) {

llvm::Value* a = MakeValue(op->a);

llvm::Value* b = MakeValue(op->b);

if (op->type.is_int()) {

return builder_->CreateSRem(a, b);

} else if (op->type.is_uint()) {

return builder_->CreateURem(a, b);

} else {

CHECK(op->type.is_float());

return builder_->CreateFRem(a, b);

}

}

in floormod if a*b<0 floormod(a,b)=a%b+b , so where should I do this in my code , I don’t think it’s in LLVM.
sorry I just touched on TVM, so can anyone help me?


#2

Am I making myself clear?Can anyone help me?


#3

We have not yet added the lowering support for floormod/div. so we still need to wait a few PRs to make use of it internally