apache / tvm

Open deep learning compiler stack for cpu, gpu and specialized accelerators

Home Page:https://tvm.apache.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Building for qualcomm hexagon dsp V66 architeture

chayliu-ecarx opened this issue · comments

commented

TVM Commit id: d0cbb02
Qualcomm Hexagon SDK version: V5.5

building as following:
cd apps/hexagon_api/build
cmake -DANDROID_ABI=arm64-v8a
-DANDROID_PLATFORM=android-28
-DUSE_ANDROID_TOOLCHAIN=Hexagon_SDK_5_5/tools/android-ndk-r25c/build/cmake/android.toolchain.cmake
-DUSE_HEXAGON_ARCH=v66
-DUSE_HEXAGON_SDK=Hexagon_SDK_5_5
-DUSE_HEXAGON_TOOLCHAIN=Hexagon_SDK_5_5/tools/HEXAGON_Tools/8.7.06/Tools
-DUSE_OUTPUT_BINARY_DIR=hexagon_api_build_output/ ..

with error message:
/qhl_hvx/inc/internal/qhmath_hvx_vector.h:910:40: error: use of undeclared identifier 'Q6_Vqf16_vadd_Vqf16Vhf'
/qhl_hvx/inc/internal/qhmath_hvx_vector.h:912:66: error: use of undeclared identifier 'Q6_Vhf_equals_Vqf16'
...

runtime/hexagon/ops/conv2d_fp16_hvx.cc:142:26: error: use of undeclared identifier 'Q6_Vqf16_vadd_Vqf16Vqf16'
HVX_Vector v_reduced = Q6_Vqf16_vadd_Vqf16Vqf16(v_res, v_rot);
runtime/hexagon/ops/conv2d_fp16_hvx.cc:345:39: error: use of undeclared identifier 'Q6_Vqf16_vadd_VhfVhf'
HVX_Vector out_vec_qf16 = Q6_Vqf16_vadd_VhfVhf(out_final, existing_out_vec);
...

@chayliu-ecarx Those errors are because there are fp16/fp32 HVX vector instructions introduced starting from v68 and Hexagon SDK 5.5. If possible try with an architecture >= v68 and the build should work.

If you would really want to support v66, there might be some CMake changes needed to support that, I'll try to push them as soon as possible so that the files that need the newer architecture features are not built when the architecture passed is v66.

commented

@quic-sanirudh thanks for your reply. Building with SDK5.5 and V68 succeed!. However, I do really need V66 supported.

I have test with SDK 4.5 the following errors is gone:
/qhl_hvx/inc/internal/qhmath_hvx_vector.h:910:40: error: use of undeclared identifier 'Q6_Vqf16_vadd_Vqf16Vhf'
/qhl_hvx/inc/internal/qhmath_hvx_vector.h:912:66: error: use of undeclared identifier 'Q6_Vhf_equals_Vqf16'

but the following errors still exist:
runtime/hexagon/ops/conv2d_fp16_hvx.cc:142:26: error: use of undeclared identifier 'Q6_Vqf16_vadd_Vqf16Vqf16'
HVX_Vector v_reduced = Q6_Vqf16_vadd_Vqf16Vqf16(v_res, v_rot);
runtime/hexagon/ops/conv2d_fp16_hvx.cc:345:39: error: use of undeclared identifier 'Q6_Vqf16_vadd_VhfVhf'
HVX_Vector out_vec_qf16 = Q6_Vqf16_vadd_VhfVhf(out_final, existing_out_vec);

@quic-sanirudh thanks for your reply. Building with SDK5.5 and V68 succeed!. However, I do really need V66 supported.

I have test with SDK 4.5 the following errors is gone: /qhl_hvx/inc/internal/qhmath_hvx_vector.h:910:40: error: use of undeclared identifier 'Q6_Vqf16_vadd_Vqf16Vhf' /qhl_hvx/inc/internal/qhmath_hvx_vector.h:912:66: error: use of undeclared identifier 'Q6_Vhf_equals_Vqf16'

but the following errors still exist: runtime/hexagon/ops/conv2d_fp16_hvx.cc:142:26: error: use of undeclared identifier 'Q6_Vqf16_vadd_Vqf16Vqf16' HVX_Vector v_reduced = Q6_Vqf16_vadd_Vqf16Vqf16(v_res, v_rot); runtime/hexagon/ops/conv2d_fp16_hvx.cc:345:39: error: use of undeclared identifier 'Q6_Vqf16_vadd_VhfVhf' HVX_Vector out_vec_qf16 = Q6_Vqf16_vadd_VhfVhf(out_final, existing_out_vec);

Yes, SDK 4.5 is a better support for that. The errors that exist is again because those files are linked into the runtime regardless of the architecture, which is a mistake and needs to be fixed in CMake. I'll push a patch to fix that.

@chayliu-ecarx I've raised the patch #17169 to fix this issue. If possible, please try it out in your setup and let me know if it works