Skip to content

Commit

Permalink
Expose ROCm path option in top CMake
Browse files Browse the repository at this point in the history
This allows the compiler to compile against a custom ROCm location,
not just /opt/rocm.
This options is use during compilation of the ROCm ukernels.
  • Loading branch information
sogartar committed Mar 19, 2024
1 parent eb3dcb5 commit b7391fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ cmake_dependent_option(IREE_TARGET_BACKEND_VULKAN_SPIRV "Enables the 'vulkan-spi
# Default target backends that are not yet fully supported but are being brought up.
cmake_dependent_option(IREE_TARGET_BACKEND_ROCM "Enables the 'rocm' compiler target backend" ${IREE_TARGET_BACKEND_DEFAULTS} ${IREE_BUILD_COMPILER} OFF)

set(CMAKE_CXX_FLAGS_FASTBUILD "-gmlt" CACHE STRING "Flags used by the C++ compiler during fast builds." FORCE)
set(IREE_ROCM_PATH_DEFAULT "/opt/rocm")
set(IREE_ROCM_PATH "${IREE_ROCM_PATH_DEFAULT}" CACHE STRING "Path to ROCm installation.")

# Supported default target backends that are only available on certain
# platforms.
set(IREE_TARGET_BACKEND_CUDA_DEFAULT ${IREE_TARGET_BACKEND_DEFAULTS})
Expand Down
4 changes: 1 addition & 3 deletions compiler/plugins/target/ROCM/builtins/ukernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ endif()
# Check if HIP is installed on system.
# HIP is required to compile ukernels.
# TODO: We can do better than this and ensure that headers are always available.
if (NOT IREE_ROCM_PATH)
set(IREE_ROCM_PATH "/opt/rocm")
endif()
set (IREE_ROCM_VERSION "${IREE_ROCM_PATH}/.info/version")
if (NOT EXISTS ${IREE_ROCM_VERSION})
message(STATUS
Expand Down Expand Up @@ -57,6 +54,7 @@ function(iree_rocm_bitcode_library)
# Suppress warnings about missing path to rocm lib,
# and benign warning about ROCM version.
"-nogpulib"
"--rocm-path=${IREE_ROCM_PATH}"
"-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH"
# Avoid error caused by clang bundling.
"--offload-device-only"
Expand Down

0 comments on commit b7391fb

Please sign in to comment.