Using OpenCL target in TVM auto-scheduler

Hi,

I am trying to use TVM’s new auto-scheduler feature according to Auto-scheduling Matrix Multiplication for CPU — tvm 0.8.dev0 documentation

This works fine, but I would like to use OpenCL as a backend. When changing

target = tvm.target.Target("llvm")

to

target = tvm.target.Target("opencl")

I get the following error:

Traceback (most recent call last):
  File "tune_matmul.py", line 54, in <module>
    task = tvm.auto_scheduler.SearchTask(func=matmul, args=(N, L, M, "float32"), target=target)
  File "/tvm/python/tvm/auto_scheduler/search_task.py", line 241, in __init__
    layout_rewrite_option,
  File "/tvm/python/tvm/_ffi/_ctypes/object.py", line 136, in __init_handle_by_constructor__
    handle = __init_by_constructor__(fconstructor, args)
  File "/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 260, in __init_handle_by_constructor__
    raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
  [bt] (4) /tvm/build/libtvm.so(TVMFuncCall+0x48) [0x2ad689d596d8]
  [bt] (3) /tvm/build/libtvm.so(+0x793c89) [0x2ad6891bfc89]
  [bt] (2) /tvm/build/libtvm.so(tvm::auto_scheduler::SearchTask::SearchTask(tvm::auto_scheduler::ComputeDAG, tvm::runtime::String,     tvm::Target, tvm::Target, tvm::runtime::Optional<tvm::auto_scheduler::HardwareParams>, tvm::auto_scheduler::LayoutRewriteOption)+0x36a) [0x2ad6891bf38a]
  [bt] (1) /tvm/build/libtvm.so(tvm::auto_scheduler::HardwareParamsNode::GetDefaultHardwareParams(tvm::Target const&, tvm::Target     const&)+0x6a8) [0x2ad6891bee18]
  [bt] (0) /tvm/build/libtvm.so(+0x7924f0) [0x2ad6891be4f0]
  File "/tvm/src/auto_scheduler/search_task.cc", line 107
TVMError: No default hardware parameters for opencl target device: ""

Can you help me sort this out? Many thanks in advance!

Can you try create

target_host = tvm.target.Target("llvm")

and when search task, add the target_host

task = tvm.auto_scheduler.SearchTask(func=matmul_add, args=(N, L, M, "float32"), target=target, target_host=target_host)

We only implement Mali / ROCM default parameter for now. you could refer the note part Auto-scheduling a Neural Network for mali GPU — tvm 0.8.dev0 documentation how to set your device opencl hardware parameter.

This works, many thanks!

Do you have any ideas about setting hardware parameters for adreno gpus? Thank you

Can I use opencl for amd gpu and not use rocm, now?

Auto-scheduling a Neural Network for mali GPU — tvm 0.15.dev0 documentation Please refer Note part: How to get the hardware parameters from remote device

of course yes, but be careful auto scheduler doesn’t consider matrix core.

Thanks for your reply. But, there are two different kind of amd gpu on the platform and I want to one of them for auto shedule. So, how can I set the target when using auto shedule for tuning.

Thanks.

Adreno GPUs give misleading information here. They report their warp/wave front sizes as 1.