OPENCL EXTENSION cl_khr_fp64 is not supported by some OpenCL device. tvm.topi.ceil_log2 is part of argwhere. When it comes to dynamic shape, ceil_log2 would return cast(tvm.tir.ceil(tvm.tir.log2(cast(x, “float64”))), x.dtype).
so I added a condition in python/tvm/topi/math.py to make ceil_log2 return cast(tvm.tir.ceil(tvm.tir.log2(cast(x, “float32”))), x.dtype) and made it work.
if "opencl" in tvm.target.Target.current().kind.name:
if isinstance(x, tvm.tir.expr.Var):
if ("any_dim" in x.name) & ("int32" in x.dtype):
return cast(tvm.tir.ceil(tvm.tir.log2(cast(x, "float32"))), x.dtype)
The default data type of any_dim is int32, so I think some values close to 2,147,483,647 would be converted into wrong values in float32.
In this case, what reasonable changes should I make?