Can't use GPU (ARM Mali) of Hikey 970 board?


I can’t seem to access the GPU of the Hikey 970 (when I run the below script, I always get a message that says opencl/ Using CPU OpenCL device.

First I run:

sudo python -m tvm.exec.rpc_server --host --port=9090

On the Hikey board.

Then, on the host machine, I run the code from this tutorial:

import numpy as np

import tvm
from tvm import rpc
from tvm.contrib import util

n = tvm.convert(1024)
A = tvm.placeholder((n,), name='A')
B = tvm.compute((n,), lambda i: A[i] + 1.0, name='B')
s = tvm.create_schedule(B.op)

target ='opencl -device=mali')

#func =, [A, B], target=target, name='add_one')
# save the lib at a local temp folder
temp = util.tempdir()
#path = temp.relpath('lib.tar')

def run_opencl():
    # NOTE: This is the setting for my rk3399 board. You need to modify
    # them according to your environment.
    target_host = "llvm -target=aarch64-linux-gnu"
    opencl_device_host = ''
    opencl_device_port = 9090

    # create schedule for the above "add one" compute declaration
    s = tvm.create_schedule(B.op)
    xo, xi = s[B].split(B.op.axis[0], factor=32)
    s[B].bind(xo, tvm.thread_axis("blockIdx.x"))
    s[B].bind(xi, tvm.thread_axis("threadIdx.x"))
    func =, [A, B], target=target, target_host=target_host)

    remote = rpc.connect(opencl_device_host, opencl_device_port)

    # export and upload
    path = temp.relpath('lib_cl.tar')
    func = remote.load_module('lib_cl.tar')

    # run
    ctx =
    a = tvm.nd.array(np.random.uniform(size=1024).astype(A.dtype), ctx)
    b = tvm.nd.array(np.zeros(1024, dtype=A.dtype), ctx)
    func(a, b)
    np.testing.assert_equal(b.asnumpy(), a.asnumpy() + 1)
    print("OpenCP test passed!")


The output is always:

[16:50:53] /home/jack/work/tvm/src/runtime/opencl/ Using CPU OpenCL device
OpenCP test passed!

I have tried building just the runtime and also the whole of TVM on the board with USE_OPENCL ON.

Any ideas?