I’m trying to get operation fusing to work with a new bitserial_conv2d relay op that I’ve added but am running into a bug that I can’t figure out.
When I register the bitserial_conv2d oppattern to be opaque, everything works exactly as expected. However, switching the pattern to out_elemwise_fusible causes even the simplest set of operations (in this case a bitserial_conv followed by an add) to spit out this error:
Traceback (most recent call last):
File "rpi_simple_test.py", line 48, in <module>
graph, lib, params = relay.build_module.build(y_func, target=target, params=params)
File "/home/jwfromm/tvm/python/tvm/relay/build_module.py", line 196, in build
params)
File "/home/jwfromm/tvm/python/tvm/relay/build_module.py", line 107, in build
self._build(func, target, target_host)
File "tvm/_ffi/_cython/./function.pxi", line 310, in tvm._ffi._cy3.core.FunctionBase.__call__
File "tvm/_ffi/_cython/./function.pxi", line 245, in tvm._ffi._cy3.core.FuncCall
File "tvm/_ffi/_cython/./function.pxi", line 234, in tvm._ffi._cy3.core.FuncCall3
File "tvm/_ffi/_cython/./base.pxi", line 170, in tvm._ffi._cy3.core.CALL
tvm._ffi.base.TVMError: Traceback (most recent call last):
[bt] (8) /home/jwfromm/tvm/build/libtvm.so(+0x4bcd8d) [0x7fa825b47d8d]
[bt] (7) /home/jwfromm/tvm/build/libtvm.so(+0x4bbfa8) [0x7fa825b46fa8]
[bt] (6) /home/jwfromm/tvm/build/libtvm.so(+0x4e73f6) [0x7fa825b723f6]
[bt] (5) /home/jwfromm/tvm/build/libtvm.so(+0x4e66f6) [0x7fa825b716f6]
[bt] (4) /home/jwfromm/tvm/build/libtvm.so(+0x4de213) [0x7fa825b69213]
[bt] (3) /home/jwfromm/tvm/build/libtvm.so(+0x4e184a) [0x7fa825b6c84a]
[bt] (2) /home/jwfromm/tvm/build/libtvm.so(+0x4bda4f) [0x7fa825b48a4f]
[bt] (1) /home/jwfromm/tvm/build/libtvm.so(+0x4c5890) [0x7fa825b50890]
[bt] (0) /home/jwfromm/tvm/build/libtvm.so(+0x964c8b) [0x7fa825fefc8b]
File "/home/jwfromm/tvm/python/tvm/relay/backend/_backend.py", line 52, in lower
f = _build.lower(sch, inputs, name=func_name)
File "/home/jwfromm/tvm/python/tvm/build_module.py", line 376, in lower
stmt = form_body(sch)
File "/home/jwfromm/tvm/python/tvm/build_module.py", line 325, in form_body
bounds = schedule.InferBound(sch)
File "tvm/_ffi/_cython/./function.pxi", line 310, in tvm._ffi._cy3.core.FunctionBase.__call__
File "tvm/_ffi/_cython/./function.pxi", line 245, in tvm._ffi._cy3.core.FuncCall
File "tvm/_ffi/_cython/./function.pxi", line 234, in tvm._ffi._cy3.core.FuncCall3
File "tvm/_ffi/_cython/./base.pxi", line 170, in tvm._ffi._cy3.core.CALL
[bt] (4) /home/jwfromm/tvm/build/libtvm.so(TVMFuncCall+0x61) [0x7fa825ff51f1]
[bt] (3) /home/jwfromm/tvm/build/libtvm.so(+0x19b792) [0x7fa825826792]
[bt] (2) /home/jwfromm/tvm/build/libtvm.so(+0x4753d5) [0x7fa825b003d5]
[bt] (1) /home/jwfromm/tvm/build/libtvm.so(+0x481faf) [0x7fa825b0cfaf]
[bt] (0) /home/jwfromm/tvm/build/libtvm.so(+0x155b13) [0x7fa8257e0b13]
File "/home/jwfromm/tvm/src/schedule/message_passing.cc", line 71
File "tvm/_ffi/_cython/./function.pxi", line 56, in tvm._ffi._cy3.core.tvm_callback
File "/home/jwfromm/tvm/python/tvm/relay/backend/_backend.py", line 60, in lower
raise RuntimeError(msg)
File "/home/jwfromm/tvm/python/tvm/relay/backend/_backend.py", line 52, in lower
f = _build.lower(sch, inputs, name=func_name)
File "/home/jwfromm/tvm/python/tvm/build_module.py", line 376, in lower
stmt = form_body(sch)
File "/home/jwfromm/tvm/python/tvm/build_module.py", line 325, in form_body
bounds = schedule.InferBound(sch)
File "tvm/_ffi/_cython/./function.pxi", line 310, in tvm._ffi._cy3.core.FunctionBase.__call__
File "tvm/_ffi/_cython/./function.pxi", line 245, in tvm._ffi._cy3.core.FuncCall
File "tvm/_ffi/_cython/./function.pxi", line 234, in tvm._ffi._cy3.core.FuncCall3
File "tvm/_ffi/_cython/./base.pxi", line 170, in tvm._ffi._cy3.core.CALL
[bt] (4) /home/jwfromm/tvm/build/libtvm.so(TVMFuncCall+0x61) [0x7fa825ff51f1]
[bt] (3) /home/jwfromm/tvm/build/libtvm.so(+0x19b792) [0x7fa825826792]
[bt] (2) /home/jwfromm/tvm/build/libtvm.so(+0x4753d5) [0x7fa825b003d5]
[bt] (1) /home/jwfromm/tvm/build/libtvm.so(+0x481faf) [0x7fa825b0cfaf]
[bt] (0) /home/jwfromm/tvm/build/libtvm.so(+0x155b13) [0x7fa8257e0b13]
File "/home/jwfromm/tvm/src/schedule/message_passing.cc", line 71
TVMError: Check failed: allow_missing:
During handling of the above exception, another exception occurred:
TVMError: Check failed: allow_missing:
Error during compile function
-----------------------------
v0.0.1
fn (%p0: Tensor[(1, 64, 64, 64), int16], %p1: Tensor[(3, 3, 64, 64), int16], %p2: int16, __dict__=meta[StrMap][0]) -> Tensor[(1, 62, 62, 64), int16] {
%0 = nn.bitserial_conv2d(%p0, %p1, channels=64, data_layout="NHWC", kernel_layout="", pack_dtype="uint8", out_dtype="int16") /* ty=Tensor[(1, 62, 62, 64), int16] */
add(%0, %p2) /* ty=Tensor[(1, 62, 62, 64), int16] */
}
/* meta data */
{
"root": 1,
"nodes": [
{
"type_key": ""
},
{
"type_key": "StrMap",
"keys": [
"StrMap"
],
"data": [2]
},
{
"type_key": "Array",
"data": [3]
},
{
"type_key": "StrMap",
"keys": [
"Primitive"
],
"data": [4]
},
{
"type_key": "IntImm",
"attrs": {
"dtype": "int32",
"value": "1"
}
}
],
"b64ndarrays": [],
"attrs": {"tvm_version": "0.6.dev"}
}
I’ve looked at the topi implementation and as far as I can tell the add is being scheduled correctly. I feel like I probably missed some sort of fused operation definition somewhere but I have no idea where. Does anyone have any tips that might help?