Make fails during installation on ARM error: ‘amdgcn_s_barrier’ is not a member of ‘llvm::Intrinsic’

Hey,

I’m trying to install TVM (with LLVM) on new EulerOS aarch64 server. ‘Cmake’ works fine:

> gal@localhost build]$ cmake .. -- Build with RPC support... -- Build with Graph runtime support... -- Build VTA runtime with target: sim -- Use llvm-config=/home/gal/llvm/clang+llvm-10.0.0-aarch64-linux-gnu/bin/llvm-config /home/gal/llvm/clang+llvm-10.0.0-aarch64-linux-gnu/bin/llvm-config: /lib64/libtinfo.so.5: no version information available (required by /home/gal/llvm/clang+llvm-10.0.0-aarch64-linux-gnu/bin/llvm-config) /home/gal/llvm/clang+llvm-10.0.0-aarch64-linux-gnu/bin/llvm-config: /lib64/libtinfo.so.5: no version information available (required by /home/gal/llvm/clang+llvm-10.0.0-aarch64-linux-gnu/bin/llvm-config) /home/gal/llvm/clang+llvm-10.0.0-aarch64-linux-gnu/bin/llvm-config: /lib64/libtinfo.so.5: no version information available (required by /home/gal/llvm/clang+llvm-10.0.0-aarch64-linux-gnu/bin/llvm-config) /home/gal/llvm/clang+llvm-10.0.0-aarch64-linux-gnu/bin/llvm-config: /lib64/libtinfo.so.5: no version information available (required by /home/gal/llvm/clang+llvm-10.0.0-aarch64-linux-gnu/bin/llvm-config) -- /home/gal/llvm/clang+llvm-10.0.0-aarch64-linux-gnu/include -- Found LLVM_INCLUDE_DIRS=/home/gal/llvm/clang+llvm-10.0.0-aarch64-linux-gnu/include -- Found LLVM_DEFINITIONS= -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -- Found TVM_LLVM_VERSION=100 -- Build with LLVM -- Set TVM_LLVM_VERSION=100 -- Build with contrib.sort -- Build with contrib.hybriddump -- Performing Test SUPPORT_CXX14 -- Performing Test SUPPORT_CXX14 - Success -- Build with c++14 -- Build with thread support... -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE -- Configuring done -- Generating done -- Build files have been written to: /home/gal/code/TVM/tvm/build

but ‘make -j4’ command runs into error:

[ 77%] Building CXX object CMakeFiles/tvm.dir/src/codegen/llvm/codegen_cpu.cc.o [ 78%] Building CXX object CMakeFiles/tvm.dir/src/codegen/llvm/codegen_llvm.cc.o /home/gal/code/TVM/tvm/src/codegen/llvm/codegen_amdgpu.cc: In member function ‘virtual llvm::Value* tvm::codegen::CodeGenAMDGPU::GetThreadIndex(const tvm::IterVar&)’: /home/gal/code/TVM/tvm/src/codegen/llvm/codegen_amdgpu.cc:135:56: error: ‘amdgcn_workitem_id_x’ is not a member of ‘llvm::Intrinsic’ llvm::Intrinsic::ID intrin_id = ::llvm::Intrinsic::amdgcn_workitem_id_x; ^~~~~~~~~~~~~~~~~~~~ /home/gal/code/TVM/tvm/src/codegen/llvm/codegen_amdgpu.cc:138:48: error: ‘amdgcn_workitem_id_x’ is not a member of ‘llvm::Intrinsic’ case 0: intrin_id = ::llvm::Intrinsic::amdgcn_workitem_id_x; break; ^~~~~~~~~~~~~~~~~~~~ /home/gal/code/TVM/tvm/src/codegen/llvm/codegen_amdgpu.cc:139:48: error: ‘amdgcn_workitem_id_y’ is not a member of ‘llvm::Intrinsic’ case 1: intrin_id = ::llvm::Intrinsic::amdgcn_workitem_id_y; break; ^~~~~~~~~~~~~~~~~~~~ /home/gal/code/TVM/tvm/src/codegen/llvm/codegen_amdgpu.cc:140:48: error: ‘amdgcn_workitem_id_z’ is not a member of ‘llvm::Intrinsic’ case 2: intrin_id = ::llvm::Intrinsic::amdgcn_workitem_id_z; break; ^~~~~~~~~~~~~~~~~~~~ /home/gal/code/TVM/tvm/src/codegen/llvm/codegen_amdgpu.cc:146:48: error: ‘amdgcn_workgroup_id_x’ is not a member of ‘llvm::Intrinsic’ case 0: intrin_id = ::llvm::Intrinsic::amdgcn_workgroup_id_x; break; ^~~~~~~~~~~~~~~~~~~~~ /home/gal/code/TVM/tvm/src/codegen/llvm/codegen_amdgpu.cc:147:48: error: ‘amdgcn_workgroup_id_y’ is not a member of ‘llvm::Intrinsic’ case 1: intrin_id = ::llvm::Intrinsic::amdgcn_workgroup_id_y; break; ^~~~~~~~~~~~~~~~~~~~~ /home/gal/code/TVM/tvm/src/codegen/llvm/codegen_amdgpu.cc:148:48: error: ‘amdgcn_workgroup_id_z’ is not a member of ‘llvm::Intrinsic’ case 2: intrin_id = ::llvm::Intrinsic::amdgcn_workgroup_id_z; break; ^~~~~~~~~~~~~~~~~~~~~ /home/gal/code/TVM/tvm/src/codegen/llvm/codegen_amdgpu.cc: In member function ‘virtual llvm::Value* tvm::codegen::CodeGenAMDGPU::CreateStorageSync(const tvm::ir::Call*)’: /home/gal/code/TVM/tvm/src/codegen/llvm/codegen_amdgpu.cc:163:30: error: ‘amdgcn_s_barrier’ is not a member of ‘llvm::Intrinsic’ ::llvm::Intrinsic::amdgcn_s_barrier); ^~~~~~~~~~~~~~~~ /home/gal/code/TVM/tvm/src/codegen/llvm/codegen_arm.cc: In member function ‘tvm::Expr tvm::codegen::CodeGenARM::ARMPopcount(const tvm::ir::Call*)’: /home/gal/code/TVM/tvm/src/codegen/llvm/codegen_arm.cc:61:57: error: ‘arm_neon_vpaddlu’ is not a member of ‘llvm::Intrinsic’ ::llvm::Intrinsic::ID vpaddlu_id = ::llvm::Intrinsic::arm_neon_vpaddlu; ^~~~~~~~~~~~~~~~ make[2]: *** [CMakeFiles/tvm.dir/build.make:2923: CMakeFiles/tvm.dir/src/codegen/llvm/codegen_amdgpu.cc.o] Error 1 make[2]: *** Waiting for unfinished jobs… make[2]: *** [CMakeFiles/tvm.dir/build.make:2936: CMakeFiles/tvm.dir/src/codegen/llvm/codegen_arm.cc.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:285: CMakeFiles/tvm.dir/all] Error 2 make: *** [Makefile:130: all] Error 2

Please let me know if you need any further detail to figure out what’s missing here.

Thank you!

It is likely due to your llvm was not built with AMDGPU support while TVM by default enables AMD codegen. If you rebuild LLVM with AMDGPU support, the error should go away.

Thanks @tqchen. I downloaded and compiled LLVM-10.0.0 with AMDGPU support as described here

cmake $LLVM_SRC_DIR -DCMAKE_BUILD_TYPE=Release
-DLLVM_TARGETS_TO_BUILD=“ARM;AMDGPU;AArch64”

However, I am still getting the same error. I’m working on EulerOS - which I believe is similar to CentosOS. What do you suggest?

Thanks @tqchen. I downloaded and compiled LLVM-10.0.0 as described here with

cmake $LLVM_SRC_DIR -DCMAKE_BUILD_TYPE=Release
-DLLVM_TARGETS_TO_BUILD=“ARM;AMDGPU;AArch64”

And set the path to …/bin/llvm-config as explained in TVM docs but I’m still getting exactly the same error.

I can report however that TVM does compile without the set(USE_LLVM /path/to/your/llvm/bin/llvm-config flag.

Is there a way to compile TVM without AMDGPU - I do not need it. Otherwise waiting to hear your suggestions how best proceed. Thank you.

You can try to temporarily remove the amd gpu codegen file and it should be able to compile

You seem to be compiling an old version of TVM. Newer clangs have reorganized the include files that contain intrinsic definitions, and there were corresponding changes in TVM as well. If the TVM that you’re using doesn’t have these modifications, compilation will fail.

You can try to fix it in your sources: find file llvm_common.h, and add the following:

#if TVM_LLVM_VERSION >= 100
#include <llvm/IR/IntrinsicsAMDGPU.h>
#include <llvm/IR/IntrinsicsARM.h>
#include <llvm/IR/IntrinsicsNVPTX.h>
#include <llvm/IR/IntrinsicsX86.h>
#endif

Thanks @tqchen & @kparzysz! Finally managed to get it to build by downloading LLVM7 through YUM and specifying set(USE_LLVM ON) in config.cmake:

All tests pass too fyi