What is default rounding mode in TVM?

Hi,

I’m new at TVM and working with TVM to compile and run onnx models. I have some questions about the rounding mode for floating-point arithmetic in TVM: Can one change the rounding mode in TVM? Also, what is the default rounding mode in TVM?

Thanks in advance

I run into this issue recently. ONNX and numpy.round is round to even, TVM doesn’t define round mode, it depends on intrinsic on each platform. CUDA/LLVM uses round to integer by default.

https://github.com/apache/tvm/pull/11446 solves the onnx issue. But TVM is still different from numpy

import numpy
print(numpy.round(0.5)) 

is 0.0

relay.round will get 1.

tir::round is round to nearest int, which is the same as most backend intrinsics

I happened to run into the same issue. IMO, if you really need roundeven, it is required to add the corresponding new intrinsic from backends like llvm.roundeven.

If it’s cuda, it will be consistent with cuda’s default rounding mode