I tried like this:
import tvm
def great(shape, dtype):
data1 = tvm.placeholder(shape, name="data1", dtype=dtype)
data2 = tvm.placeholder(shape, name="data2", dtype=dtype)
out = tvm.compute(shape, lambda *indice: tvm.select(data1(*indice) > data2(*indice), True, False), name = "out")
s = tvm.create_schedule(out.op)
print(tvm.lower(s, [data1, data2, out], simple_mode = True))
great((3,128), "float16")
There was an error:
Traceback (most recent call last):
File "test_greater.py", line 23, in <module>
great((3,128), "float16")
File "test_greater.py", line 19, in great
mod = tvm.build(s, [data1, data2, out], "cce", name = "great_cce")
File "/home1/repotvm/nnvm/tvm/python/tvm/build_module.py", line 423, in build
binds=binds)
File "/home1/repotvm/nnvm/tvm/python/tvm/build_module.py", line 372, in lower
return ir_pass.MakeAPI(stmt, name, arg_list, 0, cfg.restricted_func)
File "/home1/repotvm/nnvm/tvm/python/tvm/_ffi/function.py", line 280, in my_api_func
return flocal(*args)
File "/home1/repotvm/nnvm/tvm/python/tvm/_ffi/_ctypes/function.py", line 183, in __call
/** Construct a boolean type */
inline Type Bool(int lanes = 1) {
return UInt(1, lanes);
}```__
ctypes.byref(ret_val), ctypes.byref(ret_tcode)))
File "/home1/repotvm/nnvm/tvm/python/tvm/_ffi/base.py", line 66, in check_call
raise TVMError(py_str(_LIB.TVMGetLastError()))
tvm._ffi.base.TVMError: [14:43:59] include/tvm/./expr.h:68: Check failed: data_bits % 8 == 0U (1 vs. 0) Need to load/store by multiple of bytes
I found that the length of “bool” is 1, so how can i fix this?
in tvm\HalideIR\src\base\Type.h
/** Construct a boolean type */
inline Type Bool(int lanes = 1) {
return UInt(1, lanes);
}