From 0a2b96a0a393f025d1a23736101968f6174dbd29 Mon Sep 17 00:00:00 2001 From: Jakub Chlanda Date: Fri, 8 Dec 2023 13:02:39 +0000 Subject: [PATCH 1/6] [HIP] Allow custom location of ROCm components Allow custom location of HIP/HSA include and HIP library directories using the following CMake variables: * `SYCL_BUILD_PI_HIP_HSA_INCLUDE_DIR`, * `SYCL_BUILD_PI_HIP_HSA_INCLUDE_DIR`, * `SYCL_BUILD_PI_HIP_LIB_DIR`. --- README.md | 4 ++++ source/adapters/hip/CMakeLists.txt | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1e9c47b755..fc6fa4822e 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,10 @@ List of options provided by CMake: | UR_ENABLE_COMGR | Enable comgr lib usage | AMD/NVIDIA | AMD | | UR_DPCXX | Path of the DPC++ compiler executable to build CTS device binaries | File path | `""` | | UR_SYCL_LIBRARY_DIR | Path of the SYCL runtime library directory to build CTS device binaries | Directory path | `""` | +| UR_HIP_ROCM_DIR | Path of the default ROCm HIP installation | Directory path | `/opt/rocm` | +| UR_HIP_INCLUDE_DIR | Path of the ROCm HIP include directory | Directory path | `${UR_HIP_ROCM_DIR}/include` | +| UR_HIP_HSA_INCLUDE_DIR | Path of the ROCm HSA include directory | Directory path | `${UR_HIP_ROCM_DIR}/hsa/include""` | +| UR_HIP_LIB_DIR | Path of the ROCm HIP library directory | Directory path | `${UR_HIP_ROCM_DIR}/lib""` | ### Additional make targets diff --git a/source/adapters/hip/CMakeLists.txt b/source/adapters/hip/CMakeLists.txt index 90a235ddeb..01b3fc8d9b 100644 --- a/source/adapters/hip/CMakeLists.txt +++ b/source/adapters/hip/CMakeLists.txt @@ -10,14 +10,14 @@ set(UR_HIP_PLATFORM "AMD" CACHE STRING "UR HIP platform, AMD or NVIDIA") # Set default ROCm installation directory set(UR_HIP_ROCM_DIR "/opt/rocm" CACHE STRING "ROCm installation dir") - -set(UR_HIP_INCLUDE_DIR "${UR_HIP_ROCM_DIR}/include") - +# Allow custom location of HIP/HSA include and HIP library directories +set(UR_HIP_INCLUDE_DIR "${UR_HIP_ROCM_DIR}/include" CACHE FILEPATH + "Custom ROCm HIP include dir") set(UR_HIP_HSA_INCLUDE_DIRS - "${UR_HIP_ROCM_DIR}/hsa/include;${UR_HIP_ROCM_DIR}/include") - -# Set HIP lib dir -set(UR_HIP_LIB_DIR "${UR_HIP_ROCM_DIR}/lib") + "${UR_HIP_ROCM_DIR}/hsa/include;${UR_HIP_ROCM_DIR}/include" CACHE FILEPATH + "Custom ROCm HSA include dir") +set(UR_HIP_LIB_DIR "${UR_HIP_ROCM_DIR}/lib" CACHE FILEPATH + "Custom ROCm HIP library dir") # Check if HIP library path exists (AMD platform only) if("${UR_HIP_PLATFORM}" STREQUAL "AMD") From 0dd9a24ab91562294b88dda80694dc4f02cb7d5c Mon Sep 17 00:00:00 2001 From: Jakub Chlanda Date: Thu, 14 Dec 2023 08:07:22 -0500 Subject: [PATCH 2/6] Force the setting of custom vars --- source/adapters/hip/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/adapters/hip/CMakeLists.txt b/source/adapters/hip/CMakeLists.txt index 01b3fc8d9b..21156ecf62 100644 --- a/source/adapters/hip/CMakeLists.txt +++ b/source/adapters/hip/CMakeLists.txt @@ -17,7 +17,7 @@ set(UR_HIP_HSA_INCLUDE_DIRS "${UR_HIP_ROCM_DIR}/hsa/include;${UR_HIP_ROCM_DIR}/include" CACHE FILEPATH "Custom ROCm HSA include dir") set(UR_HIP_LIB_DIR "${UR_HIP_ROCM_DIR}/lib" CACHE FILEPATH - "Custom ROCm HIP library dir") + "Custom ROCm HIP library dir" FORCE) # Check if HIP library path exists (AMD platform only) if("${UR_HIP_PLATFORM}" STREQUAL "AMD") From 7cbc2eca2a995536b463696edb556debd57b806d Mon Sep 17 00:00:00 2001 From: Jakub Chlanda Date: Mon, 18 Dec 2023 10:10:27 +0100 Subject: [PATCH 3/6] Update source/adapters/hip/CMakeLists.txt Co-authored-by: Andrey Alekseenko --- source/adapters/hip/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/adapters/hip/CMakeLists.txt b/source/adapters/hip/CMakeLists.txt index 21156ecf62..01b3fc8d9b 100644 --- a/source/adapters/hip/CMakeLists.txt +++ b/source/adapters/hip/CMakeLists.txt @@ -17,7 +17,7 @@ set(UR_HIP_HSA_INCLUDE_DIRS "${UR_HIP_ROCM_DIR}/hsa/include;${UR_HIP_ROCM_DIR}/include" CACHE FILEPATH "Custom ROCm HSA include dir") set(UR_HIP_LIB_DIR "${UR_HIP_ROCM_DIR}/lib" CACHE FILEPATH - "Custom ROCm HIP library dir" FORCE) + "Custom ROCm HIP library dir") # Check if HIP library path exists (AMD platform only) if("${UR_HIP_PLATFORM}" STREQUAL "AMD") From c71a83d290fa575dffe6bf346bf6338996b703be Mon Sep 17 00:00:00 2001 From: Jakub Chlanda Date: Tue, 19 Dec 2023 06:38:44 -0500 Subject: [PATCH 4/6] Use PATH --- source/adapters/hip/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/adapters/hip/CMakeLists.txt b/source/adapters/hip/CMakeLists.txt index 01b3fc8d9b..56e849593f 100644 --- a/source/adapters/hip/CMakeLists.txt +++ b/source/adapters/hip/CMakeLists.txt @@ -11,12 +11,12 @@ set(UR_HIP_PLATFORM "AMD" CACHE STRING "UR HIP platform, AMD or NVIDIA") # Set default ROCm installation directory set(UR_HIP_ROCM_DIR "/opt/rocm" CACHE STRING "ROCm installation dir") # Allow custom location of HIP/HSA include and HIP library directories -set(UR_HIP_INCLUDE_DIR "${UR_HIP_ROCM_DIR}/include" CACHE FILEPATH +set(UR_HIP_INCLUDE_DIR "${UR_HIP_ROCM_DIR}/include" CACHE PATH "Custom ROCm HIP include dir") set(UR_HIP_HSA_INCLUDE_DIRS "${UR_HIP_ROCM_DIR}/hsa/include;${UR_HIP_ROCM_DIR}/include" CACHE FILEPATH "Custom ROCm HSA include dir") -set(UR_HIP_LIB_DIR "${UR_HIP_ROCM_DIR}/lib" CACHE FILEPATH +set(UR_HIP_LIB_DIR "${UR_HIP_ROCM_DIR}/lib" CACHE PATH "Custom ROCm HIP library dir") # Check if HIP library path exists (AMD platform only) From a1e8fae2d2eb5a4bd0d57ca56e6c579aa4dd842a Mon Sep 17 00:00:00 2001 From: Jakub Chlanda Date: Tue, 9 Jan 2024 08:55:11 -0500 Subject: [PATCH 5/6] Check for the new (6.0.0) HSA include location --- source/adapters/hip/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/adapters/hip/CMakeLists.txt b/source/adapters/hip/CMakeLists.txt index 56e849593f..90162eb2de 100644 --- a/source/adapters/hip/CMakeLists.txt +++ b/source/adapters/hip/CMakeLists.txt @@ -31,7 +31,8 @@ if("${UR_HIP_PLATFORM}" STREQUAL "AMD") " please check ROCm installation.") endif() - # Check if HSA include path exists + # Check if HSA include path exists. In rocm-6.0.0 the layout of HSA + # directory has changed, check for the new location as well. foreach(D IN LISTS UR_HIP_HSA_INCLUDE_DIRS) if(EXISTS "${D}") set(UR_HIP_HSA_INCLUDE_DIR "${D}") From 66d52ace2d8ca79c3274c805caa495964c123680 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Wed, 10 Jan 2024 14:16:12 +0000 Subject: [PATCH 6/6] Also update README with UR_HIP_HSA_INCLUDE_DIRS change --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fc6fa4822e..57536f237a 100644 --- a/README.md +++ b/README.md @@ -139,8 +139,8 @@ List of options provided by CMake: | UR_SYCL_LIBRARY_DIR | Path of the SYCL runtime library directory to build CTS device binaries | Directory path | `""` | | UR_HIP_ROCM_DIR | Path of the default ROCm HIP installation | Directory path | `/opt/rocm` | | UR_HIP_INCLUDE_DIR | Path of the ROCm HIP include directory | Directory path | `${UR_HIP_ROCM_DIR}/include` | -| UR_HIP_HSA_INCLUDE_DIR | Path of the ROCm HSA include directory | Directory path | `${UR_HIP_ROCM_DIR}/hsa/include""` | -| UR_HIP_LIB_DIR | Path of the ROCm HIP library directory | Directory path | `${UR_HIP_ROCM_DIR}/lib""` | +| UR_HIP_HSA_INCLUDE_DIRS | Path of the ROCm HSA include directory | Directory path | `${UR_HIP_ROCM_DIR}/hsa/include;${UR_HIP_ROCM_DIR}/include` | +| UR_HIP_LIB_DIR | Path of the ROCm HIP library directory | Directory path | `${UR_HIP_ROCM_DIR}/lib` | ### Additional make targets