Error when target is "opencl"

ValueError: Direct host side access to device memory is detected in simple. Did you forget to bind?

I got an error when running this code

import tvm
import topi
import topi.nn

def generate_opencl():

    a = tvm.placeholder((16, 3, 255, 255), name="image")

  #  b = topi.transpose(a)
    b = tvm.placeholder((16, 3, 255, 255), name="bias")

    c = a + b

    s = tvm.create_schedule(c.op)

    target = "opencl"
    #target="llvm"
    target_host = "llvm"

    lib = tvm.build(s, [a, b, c], target, target_host, name='simple')

    if target == "llvm":
        print (lib.get_source())
    else:
        print (lib.imported_modules[0].get_source())
    return


if __name__ == "__main__":
    generate_opencl()

code version is 0c523787297039ce00b320c1d32e022e61e97ac2

I have enabled llvm and cuda in config.cmake, but I didn’t enable opencl runtime because some environment issue, does it matter?

If I set target to “cuda”, I got same error.

And I got same error with get_start.py if changing tgt to “opencl”

I think I have to bind at least one axis to a thread, like this:

s[c].bind(c.op.axis[0], tvm.thread_axis("blockIdx.x"))

Yes, you will need to bind threads for the schedule to work. You do not need to compile TVM with OpenCL support if you are compiling for a remote device (this remote device however needs to have the runtime compiled with OpenCL support).