ROCm / clr

MIT License
85 stars 35 forks source link

cmake error at embed PCH with tag rocm-5.7.0 #16

Closed JiaJiDuan closed 8 months ago

JiaJiDuan commented 8 months ago

I built the clr from source, using the tag rocm-5.7.0
cmake reports an error:

'sh' '-c' '/home/marco/workspace/clr/hipamd/src/hip_embed_pch.sh /home/marco/workspace/HIP/include /home/marco/workspace/clr/build/hipamd/include /home/marco/workspace/clr/hipamd/include /home/marco/rocm/lib/cmake/llvm/../../..' +/home/marco/rocm/lib/cmake/llvm/../../../bin/clang -O3 --rocm-path=/home/marco/workspace/clr/build/hipamd/include/.. -std=c++17 -nogpulib -isystem /home/marco/workspace/clr/build/hipamd/include -isystem /home/marco/workspace/HIP/include -isystem /home/marco/workspace/clr/hipamd/include --cuda-device-only --cuda-gpu-arch=gfx1030 -x hip /tmp/hip_pch.22317/hip_pch.h -E clang: error: cannot find HIP runtime; provide its path via '--rocm-path', or pass '-nogpuinc' to build without HIP runtime CMake Error at hipamd/src/CMakeLists.txt:182 (message): Failed to embed PCH

My cmake setting is
export HIP_DIR=/home/marco/workspace/HIP export HIPCC_DIR=/home/marco/workspace/HIPCC cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$ROCM_PATH -DCMAKE_PREFIX_PATH=$ROCM_PATH -DHIP_COMMON_DIR=$HIP_DIR -DHIP_PLATFORM=amd -DHIPCC_BIN_DIR=$HIPCC_DIR/build -DHIP_CATCH_TEST=0 -DCLR_BUILD_HIP=ON -DROCM_PATH=$ROCM_PATH

My llvm-project is also built from source code with tag rocm-5.7.0
I wonder how to fix it. If need more information, please let me know.

cjatin commented 8 months ago

can you try unsetting HIP_PATH when you build CLR from source and set it again after its done building?

So basically.

unset HIP_PATH cmake ... ninja install export HIP_PATH=install path

JiaJiDuan commented 8 months ago

unset HIP_PATH cmake ... ninja install export HIP_PATH=install path

@cjatin Great! This is the perfect solution to my problem. Thank you very much for your reply.
I will close this issue.

thesleort commented 8 months ago

Following this guide exactly, I get the exact same error? I have tried with both rocm-5.6.0, rocm-5.6.x, rocm-5.7.0, and rocm-5.7.1.

This is Ubuntu 22.04 LTS with rocm-hip-libraries installed.

I am not able to unset the "HIP_PATH" as I don't have it?

$ cmake .. -DCLR_BUILD_HIP=ON -DHIP_COMMON_DIR=/home/troels/Workspace/qtec-rocm/rocm-gfx902/hip -DHIPCC_BIN_DIR=/home/troels/Workspace/qtec-rocm/rocm-gfx902/HIPCC/build
-- HIPCC Binary Directory: /home/troels/Workspace/qtec-rocm/rocm-gfx902/HIPCC/build
-- HIP Common Directory: /home/troels/Workspace/qtec-rocm/rocm-gfx902/hip
-- HIPCC_BIN_DIR found at /home/troels/Workspace/qtec-rocm/rocm-gfx902/HIPCC/build
-- HIP_COMMON_DIR found at /home/troels/Workspace/qtec-rocm/rocm-gfx902/hip
-- Using CPACK_DEBIAN_PACKAGE_RELEASE local
-- CPACK_RPM_PACKAGE_RELEASE: local
-- HIP Platform: amd
-- HIP Runtime: rocclr
-- HIP Compiler: clang
-- ROCM Installation path(ROCM_PATH): /opt/rocm
-- HIP will be installed in: /home/troels/Workspace/qtec-rocm/rocm-gfx902/clr/build/install
'sh' '-c' '/home/troels/Workspace/qtec-rocm/rocm-gfx902/clr/hipamd/src/hip_embed_pch.sh /home/troels/Workspace/qtec-rocm/rocm-gfx902/hip/include /home/troels/Workspace/qtec-rocm/rocm-gfx902/clr/build/hipamd/include /home/troels/Workspace/qtec-rocm/rocm-gfx902/clr/hipamd/include /usr/lib/llvm-14/cmake/../../..'
+ /usr/lib/llvm-14/cmake/../../../bin/clang -O3 --rocm-path=/home/troels/Workspace/qtec-rocm/rocm-gfx902/clr/build/hipamd/include/.. -std=c++17 -nogpulib -isystem /home/troels/Workspace/qtec-rocm/rocm-gfx902/clr/build/hipamd/include -isystem /home/troels/Workspace/qtec-rocm/rocm-gfx902/hip/include -isystem /home/troels/Workspace/qtec-rocm/rocm-gfx902/clr/hipamd/include --cuda-device-only --cuda-gpu-arch=gfx1030 -x hip /tmp/hip_pch.2813737/hip_pch.h -E
In file included from /tmp/hip_pch.2813737/hip_pch.h:1:
/home/troels/Workspace/qtec-rocm/rocm-gfx902/hip/include/hip/hip_runtime.h:54:10: fatal error: 'thread' file not found
#include <thread>
         ^~~~~~~~
1 error generated when compiling for gfx1030.
CMake Error at hipamd/src/CMakeLists.txt:182 (message):
  Failed to embed PCH

-- Configuring incomplete, errors occurred!

CMakeOutput.log