I want to build topi conv, so I wrote such code
input_shape=(1, 3, 224, 224)
filter_shape=(10, 3, 5, 5)
strides=(1, 1)
paddings=(2, 2)
dilations=(1, 1)
A = te.placeholder(input_shape)
W = te.placeholder(filter_shape)
with tvm.target.Target("cuda"):
C = topi.nn.conv2d_nchw(A, W, strides, paddings, dilations)
s = topi.cuda.schedule_conv2d_nchw(C)
func = tvm.build(s, [A, W, C])
print(func.imported_modules[0].get_source())
and I got such error
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
in
10 with tvm.target.Target("cuda"):
11 C = topi.nn.conv2d_nchw(A, W, strides, paddings, dilations)
---> 12 s = topi.cuda.schedule_conv2d_nchw(C)
13 func = tvm.build(s, [A, W, C])
14
/opt/apache-tvm-src-v0.10.0/python/tvm/autotvm/task/topi_integration.py in wrapper(outs, *args, **kwargs)
235 if workload is None:
236 raise RuntimeError(
--> 237 f"Cannot find TOPI workload {task_name}. "
238 "Is it registered with `register_topi_compute`?"
239 )
RuntimeError: Cannot find TOPI workload conv2d_nchw.cuda. Is it registered with `register_topi_compute`?
but this bug disappeared when I changed topi.nn.conv2d_nchw to topi.cuda.conv2d_nchw. I’m new to tvm so I don’t really know the difference between the two api. I try to find answer in tvm doc, but I can’t find any information about topi.cuda.conv2d_nchw and topi.cuda.schedule_xxx
Can someone tell me the answer?Besides, I really want to know if I want to use topi, do I need autotvm to tune it?In my shallow knowledge, topi should be something with schedule template for autotvm, and the final code need to be tuned.