Using OpenCL target in TVM auto-scheduler


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 ="llvm")


target ="opencl")

I get the following error:

Traceback (most recent call last):
  File "", line 54, in <module>
    task = tvm.auto_scheduler.SearchTask(func=matmul, args=(N, L, M, "float32"), target=target)
  File "/tvm/python/tvm/auto_scheduler/", line 241, in __init__
  File "/tvm/python/tvm/_ffi/_ctypes/", line 136, in __init_handle_by_constructor__
    handle = __init_by_constructor__(fconstructor, args)
  File "/tvm/python/tvm/_ffi/_ctypes/", 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/ [0x2ad689d596d8]
  [bt] (3) /tvm/build/ [0x2ad6891bfc89]
  [bt] (2) /tvm/build/, tvm::runtime::String,     tvm::Target, tvm::Target, tvm::runtime::Optional<tvm::auto_scheduler::HardwareParams>, tvm::auto_scheduler::LayoutRewriteOption)+0x36a) [0x2ad6891bf38a]
  [bt] (1) /tvm/build/ const&, tvm::Target     const&)+0x6a8) [0x2ad6891bee18]
  [bt] (0) /tvm/build/ [0x2ad6891be4f0]
  File "/tvm/src/auto_scheduler/", 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 ="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.