xuhuisheng / rocm-build

build scripts for ROCm
Apache License 2.0
181 stars 35 forks source link

19.hip.sh needs CMAKE_HIP_ARCHITECTURES set #21

Closed kroll-j closed 1 year ago

kroll-j commented 2 years ago

Environment

Hardware description
GPU gfx803
CPU ryzen7
Software version
OS debian bookworm
ROCm 4.3
Python 3.9.9
Linux 5.15.0-1-amd64
cmake 3.22.1

What is the expected behavior

What actually happens

How to reproduce

I get build errors for multiple targets like the following:

CMake Error in CMakeLists.txt:
  HIP_ARCHITECTURES is empty for target "directed_tests.hipEnvVar".

Found this: https://cmake.org/cmake/help/latest/prop_tgt/HIP_ARCHITECTURES.html

Adding -DCMAKE_HIP_ARCHITECTURES=$AMDGPU_TARGETS to the cmake command line seems to fix the issue:

cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DHIP_COMPILER=clang \
    -DHIP_PLATFORM=amd \
    -DROCM_PATH=$ROCM_INSTALL_DIR \
    -DHSA_PATH=$ROCM_INSTALL_DIR/hsa \
    -DCPACK_INSTALL_PREFIX=$ROCM_INSTALL_DIR/hip \
    -DCMAKE_PREFIX_PATH="$ROCM_BUILD_DIR/rocclr;$ROCM_INSTALL_DIR" \
    -DCMAKE_INSTALL_PREFIX=$ROCM_INSTALL_DIR/hip/ \
    -DCPACK_PACKAGING_INSTALL_PREFIX=$ROCM_INSTALL_DIR/hip/ \
    -DCPACK_GENERATOR=DEB \
    -DCMAKE_HIP_ARCHITECTURES=$AMDGPU_TARGETS \
    -G Ninja \
    $ROCM_GIT_DIR/HIP
kroll-j commented 2 years ago

Trying the feature/build branch now.

With the newer hip version, the build script also needs -DHIP_PLATFORM=amd \

xuhuisheng commented 2 years ago

CMAKE_HIP_ARCHITECTURES may be an issue for cmake-3.21. I find hip had turn off this param when cmake version greater than 3.21.

xuhuisheng commented 1 year ago

I will close this issue, if you still meet the problem, please reopen it.