I’m trying to use autotvm on an android device with MALI GPU using opencl target.
The process can run, but I get a lot of warnings and performance is terrible:
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:262: No OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:250: Using CPU OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:262: No OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:250: Using CPU OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:262: No OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:250: Using CPU OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:262: No OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:250: Using CPU OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:262: No OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:250: Using CPU OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:262: No OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:250: Using CPU OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:262: No OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:250: Using CPU OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:262: No OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:250: Using CPU OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:262: No OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:250: Using CPU OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:262: No OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:250: Using CPU OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:262: No OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:250: Using CPU OpenCL device
[02:49:13] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:262: No OpenCL device
GFLOPS are extremely low for workloads where using a simple target llvm -device=arm_cpu -mtriple=arm64-linux-android can give much better performance.
So my questions are:
why do I get those warnings?
am I actually using the MALI GPU?
why performance are not good?
P.S. the autotuning process also makes the android RPC app crash continuously, thus the whole process is extremely hard to complete and very unreliable.
I’ve just tried with a different device (Adreno GPU) and to run the android_rpc app test python script and the result is the same on both devices:
Run CPU test ...
4.1698e-05 secs/op
[05:42:14] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:250: Using CPU OpenCL device
[05:42:14] /incubator-tvm/src/runtime/opencl/opencl_device_api.cc:262: No OpenCL device
Run GPU(OpenCL Flavor) test ...
0.000118109 secs/op
Have you built the libtvm_runtime.so with the correct arm OpenCL header and libOpenCL.so? If you want to cross build, you maybe need to turn on USE_OPENCL ON in the config.cmake and use -DOpenCL_INCLUDE_DIR=/arm/opencl_header_dir_path -D OpenCL_LIBRARY=/arm/opencl_library_path (see FindOpenCL — CMake 3.1.3 Documentation)
If you do it correctly, you still can not use OpenCL@GPU, I think you could consider writing one simple OpenCL C++ program and test it to make sure you could access GPU using OpenCL.
I’m compiling that code for Android (arm64-v8a) while including the openCL headers and linking to the same libOpenCL.so posted above.
Then pushing the executable to my device and running it.
When running the same test with tvm_rpc C++ RPC server, I get the same (good) log from the device, but I still get the bad log from my host machine.
If I set USE_OPENCL=OFF for my host machine build and rebuild TVM runtime, then those bad logs disappear and the good logs are still in my external device.
So my guess is that the bad logs were coming from my host machine that (correctly) doesn’t have any openCL device, while on my target device openCL has always been working fine. Thus I think USE_OPENCL should not be set to ON when building the TVM runtime on the host machine. This is still quite confused and confusing in the documentation imho.
hi, have you already solve this problem, I meet the same problem with the same warning.
And I think if we want to cross compile a model for gpu, we should not turn USE_OPENCL OFF.