TVM runtime for Hexagon breaks in main branch

Hi,

I’m trying to get stuff in this article to work: TVM open source compiler now includes initial support for Qualcomm Hexagon DSP - Qualcomm Developer Network

But it seems that the build breaks in main branch, and it breaks in a way that I can’t fix…

Here is the reproduce step:

commit id: 7a6281e600e9796ec41e89b59f3736d455ee8255
mkdir build-hexagon
cd build-hexagon
cmake 
-DCMAKE_C_COMPILER=/path/to/hexagon-clang 
-DCMAKE_CXX_COMPILER=/path/to/hexagon-clang++ 
-DCMAKE_CXX_FLAGS='-stdlib=libc++ 
-I/path/to/computev66/include/posix 
-I/path/to/computev66/include/qurt 
-I/path/to/Hexagon_SDK/3.5.4/incs' 
-DUSE_HEXAGON_ARCH=v66 
-DUSE_RPC=OFF 
-DUSE_LLVM=OFF 
-DUSE_LIBBACKTRACE=OFF 
-DUSE_HEXAGON_DEVICE=OFF 
-DUSE_HEXAGON_SDK=/path/to/Hexagon_SDK/3.5.4 
..
make runtime

To bypass the issue, I switched back to a commit before hexagon_user_dma added:

f93b0c21d4433308b492e0e68d16277ec88b1ebf

Now at lease the build works. I can get the libtvm_runtime.so: ELF 32-bit LSB pie executable, QUALCOMM DSP6, version 1 (SYSV), dynamically linked, not stripped.

Could anyone help this, thanks a lot!

Though I can build the libtvm_runtime.so for Hexagon, it will fail with the same issue here: [Hexagon] sim_dev undefined symbol

I set the ADSP_LIBRARY_PATH as below and copied the libtvm_runtime.so there.

ADSP_LIBRARY_PATH=/root/Qualcomm/Hexagon_SDK/3.5.4/tools/HEXAGON_Tools/8.3.07/Tools/target/hexagon/lib/v66/G0/pic

From the log, I can see sim_dev found the correct libtvm_runtime.so, but the dlopen fails:

error loading TVM runtime: undefined symbol (0) /root/Qualcomm/Hexagon_SDK/3.5.4/tools/HEXAGON_Tools/8.3.07/Tools/target/hexagon/lib/v66/G0/pic/libtvm_runtime.so

Hexagon SDK 3.x is no longer supported. Please use SDK 4.0 or later.

The actual issue here is because you set USE_HEXAGON_ARCH to v66. The DMA instructions were added in v68. This is a bug—the DMA code should not be compiled when the target architecture is earlier than v68.

1 Like

I’ve created an issue here: https://github.com/apache/tvm/issues/10768.

Thanks for the quick reply. It saves my day…

But when I tried to download the latest Hexagon SDK. I noticed that it’s no longer available for a direct download as below:

Instead I need to download the Qualcomm Package Manager which is a desktop app with UI works only for Ubuntu16 & 18…

Do you happen to know any way to bypass that… (I’m working on a headless Debian)

I just figure out a way to get the standalone 4.x Hexagon SDK from MacOS.

Here are the steps for anyone who interested:

  1. Install Ubuntu 18.06 Desktop in VirtualBox or any other VMs
  2. Download the Qualcomm Package Manager from here: Hexagon SDK - Tools - Qualcomm Developer Network
  3. Sign in and install the Hexagon SDK 4.x
  4. Just compress & copy the installed folder(ex. /home/abc/Qualcomm/4.5.0.3) to your TVM develop environment.
  5. It works for the basic hexagon test code: test_target_codegen_hexagon.py
1 Like

Another way would be to uncompress the contents of the QPM .deb file, and use the qpm-cli executable from there. It’s a command line utility that allows you to use QPM without GUI.

1 Like