From a6d3445f3489a3112c998f7c377196d00454b15c Mon Sep 17 00:00:00 2001 From: ldrumm Date: Fri, 22 Dec 2023 17:07:14 +0000 Subject: [PATCH] [SYCL][hip] Fix HSA headers lookup (#12234) ROCm installations prior to v6 don't respect the traditional installation layout and install the HSA headers to `$PREFIX/hsa/include/hsa` whereas in rocm6 it looks like they're putting it in the right place at `$PREFIX/include/hsa`. That cleanup from AMD is good news, but it means that our workarounds now break and we need to check both places. This is a companion to https://github.com/oneapi-src/unified-runtime/pull/1208 --- sycl/plugins/hip/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sycl/plugins/hip/CMakeLists.txt b/sycl/plugins/hip/CMakeLists.txt index 146b0619ac348..7bb8638d9aa13 100644 --- a/sycl/plugins/hip/CMakeLists.txt +++ b/sycl/plugins/hip/CMakeLists.txt @@ -24,7 +24,14 @@ else() endif() if("${SYCL_BUILD_PI_HIP_HSA_INCLUDE_DIR}" STREQUAL "") - set(PI_HIP_HSA_INCLUDE_DIR "${SYCL_BUILD_PI_HIP_ROCM_DIR}/hsa/include") + # pre v6 versions of ROCM prefix their include directory with /hsa but this + # was fixed in v6 to act like a well-behaved package + foreach (SUF hsa/include include) + if (EXISTS "${SYCL_BUILD_PI_HIP_ROCM_DIR}/${SUF}") + set(PI_HIP_HSA_INCLUDE_DIR "${SYCL_BUILD_PI_HIP_ROCM_DIR}/${SUF}") + break() + endif() + endforeach() else() set(PI_HIP_HSA_INCLUDE_DIR "${SYCL_BUILD_PI_HIP_INCLUDE_DIR}") endif()