How to cross compile OpenCL on Mac for rk3399?

I’m trying to cross compile model into .so library on Mac for RK3399. I want to use Mali GPU, so I’m compiling with following targets:

target = tvm.target.create('opencl -device=mali')
target_host = 'llvm -target=armv8l-linux-gnueabihf'

model building:

with autotvm.apply_history_best(log_file):
    print("Compile...")
    with relay.build_config(opt_level=3):
        graph, lib, params = relay.build_module.build(func, target=target,  params=params, target_host=target_host)

this works fine, but when I try to build .so library:

path2gcc = '/usr/local/opt/arm-linux-gnueabihf-binutils/bin/arm-linux-gnueabihf-ld'
lib.export_library("net.so", tvm.contrib.cc.create_shared, cc=path2gcc)

I get an error:

RuntimeError: Compilation error: /var/folders/g8/z53bs1_52d70xg35xsywk069x3wmdg/T/tmpmdoiucg_/devc.cc: file not recognized: file format not recognized

ARM cc works fine, what should I add to cc for Mali GPU?

1 Like

os.environ[“TVM_NDK_CC"] = /path/to/ndk_cc lib.export_library(“net.so”, ndk.create_shared)