Skip to content

Commit

Permalink
Switch from using hipcc to using Clang compiler initial implementation (
Browse files Browse the repository at this point in the history
  • Loading branch information
lawruble13 authored Feb 22, 2024
1 parent d26de79 commit b567a3c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .jenkins/common.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def runCompileCommand(platform, project, jobName, boolean debug=false, boolean s
mkdir -p build/${buildTypeDir} && cd build/${buildTypeDir}
# gfxTargetParser reads gfxarch and adds target features such as xnack
${auxiliary.gfxTargetParser()}
${cmake} -DCMAKE_CXX_COMPILER=/opt/rocm/bin/hipcc ${buildTypeArg} ${buildStatic} ${amdgpuTargets} ${codeCovFlag} -DBUILD_TEST=ON -DBUILD_BENCHMARK=ON ../..
${cmake} --toolchain=toolchain-linux.cmake ${buildTypeArg} ${buildStatic} ${amdgpuTargets} ${codeCovFlag} -DBUILD_TEST=ON -DBUILD_BENCHMARK=ON ../..
make -j\$(nproc)
"""

Expand Down
10 changes: 5 additions & 5 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ fi
# BUILD_BENCHMARK - off by default.
#
# ! IMPORTANT !
# On ROCm platform set C++ compiler to HIPCC. You can do it by adding 'CXX=<path-to-hipcc>'
# before 'cmake' or setting cmake option 'CMAKE_CXX_COMPILER' to path to the HIPCC compiler.
# On ROCm platform set C++ compiler to clang++ >= 17. You can do it by adding 'CXX=<path-to-clang>'
# before 'cmake' or setting cmake option 'CMAKE_CXX_COMPILER' to path to the clang++ compiler.
#

compiler="hipcc"
cmake_common_options="${cmake_common_options} --toolchain=toolchain-linux.cmake"

cmake_executable="cmake"

Expand All @@ -169,15 +169,15 @@ else
fi

if [[ "${build_relocatable}" == true ]]; then
CXX=${rocm_path}/bin/$compiler ${cmake_executable} -DCMAKE_INSTALL_PREFIX="${rocm_path}" \
${cmake_executable} -DCMAKE_INSTALL_PREFIX="${rocm_path}" \
-DBUILD_TEST=ON -DBUILD_BENCHMARK=ON ${cmake_common_options} \
-DCMAKE_PREFIX_PATH="${rocm_path};${rocm_path}/hip" \
-DCMAKE_SHARED_LINKER_FLAGS="${rocm_rpath}" \
-DROCM_DISABLE_LDCONFIG=ON \
-DCMAKE_MODULE_PATH="${rocm_path}/lib/cmake/hip;${rocm_path}/hip/cmake" \
../../. # or cmake-gui ../.
else
CXX=${rocm_path}/bin/$compiler ${cmake_executable} ${clients} ${cmake_common_options} ../../. # or cmake-gui ../.
${cmake_executable} ${clients} ${cmake_common_options} ../../. # or cmake-gui ../.
fi
check_exit_code "$?"

Expand Down
16 changes: 11 additions & 5 deletions toolchain-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@
if (DEFINED ENV{ROCM_PATH})
set(rocm_bin "$ENV{ROCM_PATH}/bin")
else()
set(ROCM_PATH "/opt/rocm" CACHE PATH "Path to the ROCm installation.")
set(rocm_bin "/opt/rocm/bin")
endif()

if (NOT DEFINED ENV{CXX})
set(CMAKE_CXX_COMPILER "${rocm_bin}/amdclang++")
else()
set(CMAKE_CXX_COMPILER "$ENV{CXX}")
endif()

# set(CMAKE_CXX_COMPILER "hipcc")
# set(CMAKE_C_COMPILER "hipcc")
set(CMAKE_CXX_COMPILER "${rocm_bin}/hipcc")
set(CMAKE_C_COMPILER "${rocm_bin}/hipcc")

if (NOT DEFINED ENV{CC})
set(CMAKE_C_COMPILER "${rocm_bin}/amdclang")
else()
set(CMAKE_C_COMPILER "$ENV{CC}")
endif()

0 comments on commit b567a3c

Please sign in to comment.