tvm icon indicating copy to clipboard operation
tvm copied to clipboard

[Bug] IntImm Node signed integer indicates an error

Open yincs-intellif opened this issue 3 years ago • 4 comments
trafficstars

Current IntImm Node can't express negative number by hexadecimal. Eg: x = tvm.tir.const(0xFFFFFFFF, "int32") x.value should be -1 rather than 4294967295

Whether we need to consider this issue?

yincs-intellif avatar Jul 22 '22 10:07 yincs-intellif

It is currently undefined behavior. We haven’t had in-depth discussion whether or not it’s going to be an error. What do you think?

junrushao avatar Aug 01 '22 01:08 junrushao

Thanks a lot. I think we need to solve this issue, because we usually use hexadecimal in computer domain.

yincs-intellif avatar Aug 01 '22 01:08 yincs-intellif

Thanks for your feedbacks! The reason is that in tvm.tir.const(A, B), A is automatically converted to int64 and then sent to the C++ backend, while the backend method didn't check if A is within the range of B...

junrushao avatar Aug 02 '22 21:08 junrushao

CC: @tqchen

junrushao avatar Aug 02 '22 21:08 junrushao