ROCm / hcc

HCC is an Open Source, Optimizing C++ Compiler for Heterogeneous Compute currently for the ROCm GPU Computing Platform
https://github.com/RadeonOpenCompute/hcc/wiki
Other
428 stars 107 forks source link

HCC build HIP from source at ARM64 Ubuntu 16.04 error out #800

Open wormwang opened 6 years ago

wormwang commented 6 years ago

export HIP_PLATFORM=hcc cmake -DHSA_PATH=/opt/hsa-rocr-dev/hsa -DHCC_HOME=/opt/rocm/hcc -DCMAKE_INSTALL_PREFIX=/opt/rocm/hip -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS= "-v" ..

make

fatal error: error in backend: Unsupported calling convention. clang-7: error: clang frontend command failed with exit code 70 (use -v to see invocation) HCC clang version 7.0.0 (https://github.com/RadeonOpenCompute/hcc-clang-upgrade.git 05eee4ea8aedc4a168d11fbbf5095646702f83f2) (https://github.com/RadeonOpenCompute/llvm.git b25febceadb1ffabf9cd9bc0fd41e3cb8d4e9b80) (based on HCC 1.2.18262-a743e2b-05eee4e-b25febc ) Target: aarch64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/rocm/hcc/bin clang-7: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script. clang-7: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs. clang-7: error: HC host assembler command failed with exit code 70 (use -v to see invocation) HCC clang version 7.0.0 (https://github.com/RadeonOpenCompute/hcc-clang-upgrade.git 05eee4ea8aedc4a168d11fbbf5095646702f83f2) (https://github.com/RadeonOpenCompute/llvm.git b25febceadb1ffabf9cd9bc0fd41e3cb8d4e9b80) (based on HCC 1.2.18262-a743e2b-05eee4e-b25febc ) Target: aarch64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/rocm/hcc/bin clang-7: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script. clang-7: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang-7: note: diagnostic msg: /tmp/hip_memory-aca24d.cpp clang-7: note: diagnostic msg: /tmp/hip_memory-ed9ecb.cpp clang-7: note: diagnostic msg: /tmp/hip_memory-aca24d.sh clang-7: note: diagnostic msg:


CMakeFiles/hip_hcc_static.dir/build.make:230: recipe for target 'CMakeFiles/hip_hcc_static.dir/src/hip_memory.cpp.o' failed make[2]: [CMakeFiles/hip_hcc_static.dir/src/hip_memory.cpp.o] Error 70 CMakeFiles/Makefile2:3354: recipe for target 'CMakeFiles/hip_hcc_static.dir/all' failed make[1]: [CMakeFiles/hip_hcc_static.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2

wormwang commented 6 years ago

make log

[ 15%] Building CXX object CMakeFiles/hip_hcc_static.dir/src/hip_memory.cpp.o HCC clang version 7.0.0 (https://github.com/RadeonOpenCompute/hcc-clang-upgrade.git 05eee4ea8aedc4a168d11fbbf5095646702f83f2) (https://github.com/RadeonOpenCompute/llvm.git b25febceadb1ffabf9cd9bc0fd41e3cb8d4e9b80) (based on HCC 1.2.18262-a743e2b-05eee4e-b25febc ) Target: aarch64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/rocm/hcc/bin Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/5 Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/5.4.0 Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/6 Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/6.0.0 Selected GCC installation: /usr/lib/gcc/aarch64-linux-gnu/5.4.0 Candidate multilib: .;@m64 Selected multilib: .;@m64 Found HCC installation: /opt/rocm/hcc/bin/.. "/opt/rocm/hcc/bin/clang-7" -cc1 -DKALMAR_HC=1 -DHCC_HC=1 -triple aarch64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier -main-file-name hip_memory.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu generic -target-feature +neon -target-abi aapcs -fallow-half-arguments-and-returns -dwarf-column-info -debugger-tuning=gdb -v -coverage-notes-file /root/ROCm/HIP/build/CMakeFiles/hip_hcc_static.dir/src/hip_memory.cpp.gcno -resource-dir /opt/rocm/hcc/lib/clang/7.0.0 -I/opt/rocm/hcc/bin/../include -I/opt/rocm/hcc/bin/../hcc/include -I /root/ROCm/HIP/include -I /root/ROCm/HIP/tests/src -D HIP_VERSION_MAJOR=1 -D HIP_VERSION_MINOR=5 -D HIP_VERSION_PATCH=18231 -I /opt/rocm/hcc/include -I /opt/rocm/include -I /opt/hsa-rocr-dev/hsa/include -D NDEBUG -internal-isystem /usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/c++/5.4.0 -internal-isystem /usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/aarch64-linux-gnu/c++/5.4.0 -internal-isystem /usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/aarch64-linux-gnu/c++/5.4.0 -internal-isystem /usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward -internal-isystem /usr/local/include -internal-isystem /opt/rocm/hcc/lib/clang/7.0.0/include -internal-externc-isystem /usr/include/aarch64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -std=c++amp -fdeprecated-macro -fdebug-compilation-dir /root/ROCm/HIP/build -ferror-limit 19 -fmessage-length 201 -fno-signed-char -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -famp -fhsa-ext -o /tmp/hip_memory-cfe7cd.s -x hc-host /root/ROCm/HIP/src/hip_memory.cpp -emit-llvm-bc clang -cc1 version 7.0.0 based upon HCC 1.2.18262-a743e2b-05eee4e-b25febc default target aarch64-unknown-linux-gnu ignoring nonexistent directory "/opt/rocm/hcc/bin/../hcc/include" ignoring nonexistent directory "/include" ignoring duplicate directory "/opt/rocm/hcc/bin/../include" ignoring duplicate directory "/usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/aarch64-linux-gnu/c++/5.4.0"

include "..." search starts here:

include <...> search starts here:

/opt/rocm/hcc/bin/../include /root/ROCm/HIP/include /root/ROCm/HIP/tests/src /opt/rocm/include /opt/hsa-rocr-dev/hsa/include /usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/c++/5.4.0 /usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/aarch64-linux-gnu/c++/5.4.0 /usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward /usr/local/include /opt/rocm/hcc/lib/clang/7.0.0/include /usr/include/aarch64-linux-gnu /usr/include End of search list. "/opt/rocm/hcc/bin/hc-host-assemble" /tmp/hip_memory-cfe7cd.s CMakeFiles/hip_hcc_static.dir/src/hip_memory.cpp.o -v -DHIP_VERSION_MAJOR=1 -DHIP_VERSION_MINOR=5 -DHIP_VERSION_PATCH=18231 -fPIC -O3 -DNDEBUG -famp HCC clang version 7.0.0 (https://github.com/RadeonOpenCompute/hcc-clang-upgrade.git 05eee4ea8aedc4a168d11fbbf5095646702f83f2) (https://github.com/RadeonOpenCompute/llvm.git b25febceadb1ffabf9cd9bc0fd41e3cb8d4e9b80) (based on HCC 1.2.18262-a743e2b-05eee4e-b25febc ) Target: aarch64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/rocm/hcc/bin Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/5 Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/5.4.0 Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/6 Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/6.0.0 Selected GCC installation: /usr/lib/gcc/aarch64-linux-gnu/5.4.0 Candidate multilib: .;@m64 Selected multilib: .;@m64 Found HCC installation: /opt/rocm/hcc/bin/.. "/opt/rocm/hcc/bin/clang-7" -cc1 -DKALMAR_AMP=1 -DHCC_AMP=1 -triple aarch64-unknown-linux-gnu -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name hip_memory-cfe7cd.s.bc -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu generic -target-feature +neon -target-abi aapcs -fallow-half-arguments-and-returns -dwarf-column-info -debugger-tuning=gdb -v -coverage-notes-file /root/ROCm/HIP/build/CMakeFiles/hip_hcc_static.dir/src/hip_memory.cpp.gcno -resource-dir /opt/rocm/hcc/lib/clang/7.0.0 -O3 -fdebug-compilation-dir /root/ROCm/HIP/build -ferror-limit 19 -fmessage-length 201 -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -famp -o CMakeFiles/hip_hcc_static.dir/src/hip_memory.cpp.o -x ir /tmp/hip_memory-cfe7cd.s.bc clang -cc1 version 7.0.0 based upon HCC 1.2.18262-a743e2b-05eee4e-b25febc default target aarch64-unknown-linux-gnu fatal error: error in backend: Unsupported calling convention. clang-7: error: clang frontend command failed with exit code 70 (use -v to see invocation) HCC clang version 7.0.0 (https://github.com/RadeonOpenCompute/hcc-clang-upgrade.git 05eee4ea8aedc4a168d11fbbf5095646702f83f2) (https://github.com/RadeonOpenCompute/llvm.git b25febceadb1ffabf9cd9bc0fd41e3cb8d4e9b80) (based on HCC 1.2.18262-a743e2b-05eee4e-b25febc ) Target: aarch64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/rocm/hcc/bin clang-7: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script. clang-7: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs. "/opt/rocm/hcc/bin/clang-7" -cc1 -DKALMAR_HC=1 -DHCC_HC=1 -famp-is-device -fno-builtin -fno-common -O2 -triple amdgcn--amdhsa-hcc -aux-triple aarch64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier -main-file-name hip_memory.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fmath-errno -no-integrated-as -mconstructor-aliases -fuse-init-array -v -coverage-notes-file /root/ROCm/HIP/build/CMakeFiles/hip_hcc_static.dir/src/hip_memory.cpp.gcno -resource-dir /opt/rocm/hcc/lib/clang/7.0.0 -I/opt/rocm/hcc/bin/../include -I/opt/rocm/hcc/bin/../hcc/include -I /root/ROCm/HIP/include -I /root/ROCm/HIP/tests/src -D HIP_VERSION_MAJOR=1 -D HIP_VERSION_MINOR=5 -D HIP_VERSION_PATCH=18231 -I /opt/rocm/hcc/include -I /opt/rocm/include -I /opt/hsa-rocr-dev/hsa/include -D NDEBUG -internal-isystem /usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/c++/5.4.0 -internal-isystem /usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/aarch64-linux-gnu/c++/5.4.0 -internal-isystem /usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/aarch64-linux-gnu/c++/5.4.0 -internal-isystem /usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward -internal-isystem /usr/local/include -internal-isystem /opt/rocm/hcc/lib/clang/7.0.0/include -internal-externc-isystem /usr/include/aarch64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -std=c++amp -fdeprecated-macro -fno-dwarf-directory-asm -fdebug-compilation-dir /root/ROCm/HIP/build -ferror-limit 19 -fmessage-length 201 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -famp -fhsa-ext -o /tmp/hip_memory-34005a.s -x hc-kernel /root/ROCm/HIP/src/hip_memory.cpp -emit-llvm-bc clang -cc1 version 7.0.0 based upon HCC 1.2.18262-a743e2b-05eee4e-b25febc default target aarch64-unknown-linux-gnu ignoring nonexistent directory "/opt/rocm/hcc/bin/../hcc/include" ignoring nonexistent directory "/include" ignoring duplicate directory "/opt/rocm/hcc/bin/../include" ignoring duplicate directory "/usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/aarch64-linux-gnu/c++/5.4.0" ignoring duplicate directory "/usr/local/include" ignoring duplicate directory "/opt/rocm/hcc/lib/clang/7.0.0/include" ignoring duplicate directory "/usr/include"

include "..." search starts here:

include <...> search starts here:

/opt/rocm/hcc/bin/../include /root/ROCm/HIP/include /root/ROCm/HIP/tests/src /opt/rocm/include /opt/hsa-rocr-dev/hsa/include /usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/c++/5.4.0 /usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/aarch64-linux-gnu/c++/5.4.0 /usr/lib/gcc/aarch64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward /usr/local/include /opt/rocm/hcc/lib/clang/7.0.0/include /usr/include/aarch64-linux-gnu /usr/include End of search list. "/opt/rocm/hcc/bin/hc-kernel-assemble" /tmp/hip_memory-34005a.s CMakeFiles/hip_hcc_static.dir/src/hip_memory.cpp.o clang-7: error: HC host assembler command failed with exit code 70 (use -v to see invocation) HCC clang version 7.0.0 (https://github.com/RadeonOpenCompute/hcc-clang-upgrade.git 05eee4ea8aedc4a168d11fbbf5095646702f83f2) (https://github.com/RadeonOpenCompute/llvm.git b25febceadb1ffabf9cd9bc0fd41e3cb8d4e9b80) (based on HCC 1.2.18262-a743e2b-05eee4e-b25febc ) Target: aarch64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/rocm/hcc/bin clang-7: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script. clang-7: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang-7: note: diagnostic msg: /tmp/hip_memory-29ac5b.cpp clang-7: note: diagnostic msg: /tmp/hip_memory-1b69cb.cpp clang-7: note: diagnostic msg: /tmp/hip_memory-29ac5b.sh clang-7: note: diagnostic msg:


CMakeFiles/hip_hcc_static.dir/build.make:230: recipe for target 'CMakeFiles/hip_hcc_static.dir/src/hip_memory.cpp.o' failed make[2]: [CMakeFiles/hip_hcc_static.dir/src/hip_memory.cpp.o] Error 70 CMakeFiles/Makefile2:3354: recipe for target 'CMakeFiles/hip_hcc_static.dir/all' failed make[1]: [CMakeFiles/hip_hcc_static.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2

Jorghi12 commented 6 years ago

What branch of HCC are you building from?

wormwang commented 6 years ago

based on HCC 1.2.18262-a743e2b-05eee4e-b25febc

wormwang commented 6 years ago

The root cause is https://github.com/RadeonOpenCompute/llvm/blob/ef2df73ef5543d71c75aa206c33b5b3f2591b008/lib/Target/AArch64/AArch64ISelLowering.cpp#L2881

The error is cause by

/// Selects the correct CCAssignFn for a given CallingConvention value. *CCAssignFn AArch64TargetLowering::CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg) const {** switch (CC) { default: report_fatal_error("Unsupported calling convention."); case CallingConv::WebKit_JS: return CC_AArch64_WebKit_JS; case CallingConv::GHC: return CC_AArch64_GHC; case CallingConv::C: case CallingConv::Fast: case CallingConv::PreserveMost: case CallingConv::CXX_FAST_TLS: case CallingConv::Swift: if (Subtarget->isTargetWindows() && IsVarArg) return CC_AArch64_Win64_VarArg; if (!Subtarget->isTargetDarwin()) return CC_AArch64_AAPCS; return IsVarArg ? CC_AArch64_DarwinPCS_VarArg : CC_AArch64_DarwinPCS; case CallingConv::Win64: return IsVarArg ? CC_AArch64_Win64_VarArg : CC_AArch64_AAPCS; } }

kylin0061 commented 3 years ago

The root cause is https://github.com/RadeonOpenCompute/llvm/blob/ef2df73ef5543d71c75aa206c33b5b3f2591b008/lib/Target/AArch64/AArch64ISelLowering.cpp#L2881

The error is cause by

/// Selects the correct CCAssignFn for a given CallingConvention value. *_CCAssignFn _AArch64TargetLowering::CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg) const {__ switch (CC) { default: report_fatal_error("Unsupported calling convention."); case CallingConv::WebKit_JS: return CC_AArch64_WebKit_JS; case CallingConv::GHC: return CC_AArch64_GHC; case CallingConv::C: case CallingConv::Fast: case CallingConv::PreserveMost: case CallingConv::CXX_FAST_TLS: case CallingConv::Swift: if (Subtarget->isTargetWindows() && IsVarArg) return CC_AArch64_Win64_VarArg; if (!Subtarget->isTargetDarwin()) return CC_AArch64_AAPCS; return IsVarArg ? CC_AArch64_DarwinPCS_VarArg : CC_AArch64_DarwinPCS; case CallingConv::Win64: return IsVarArg ? CC_AArch64_Win64_VarArg : CC_AArch64_AAPCS; } }

what did you do after? I meet the same problem.thanks