From 462ad3e20bd6225b6909691c14570d1d71eee55e Mon Sep 17 00:00:00 2001 From: tvukovic-amd Date: Wed, 16 Jul 2025 15:31:40 +0000 Subject: [PATCH] [ROCm][Windows] Fix finding ROCm/HIP version (#156486) This commit fixes Windows build issue related to trying to use rocm-core (rocm-core doesn't exist on HIP SDK) Pull Request resolved: https://github.com/pytorch/pytorch/pull/156486 Approved by: https://github.com/jeffdaily, https://github.com/stellaraccident --- cmake/public/LoadHIP.cmake | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/cmake/public/LoadHIP.cmake b/cmake/public/LoadHIP.cmake index cae0ca62f2361..132f9670ff34f 100644 --- a/cmake/public/LoadHIP.cmake +++ b/cmake/public/LoadHIP.cmake @@ -93,19 +93,16 @@ if(HIP_FOUND) # hip (lower-case) package. Both are probed above and will be in # ROCM_INCLUDE_DIRS if available. find_file(ROCM_VERSION_HEADER_PATH - NAMES rocm-core/rocm_version.h + NAMES rocm-core/rocm_version.h hip/hip_version.h NO_DEFAULT_PATH PATHS ${ROCM_INCLUDE_DIRS} ) - set(ROCM_LIB_NAME "ROCM") - if(NOT ROCM_VERSION_HEADER_PATH) - find_file(ROCM_VERSION_HEADER_PATH - NAMES hip/hip_version.h - NO_DEFAULT_PATH - PATHS ${ROCM_INCLUDE_DIRS} - ) + if(ROCM_VERSION_HEADER_PATH MATCHES "rocm-core/rocm_version.h$") + set(ROCM_LIB_NAME "ROCM") + else() set(ROCM_LIB_NAME "HIP") endif() + if(NOT ROCM_VERSION_HEADER_PATH) message(FATAL_ERROR "Could not find hip/hip_version.h or rocm-core/rocm_version.h in ${ROCM_INCLUDE_DIRS}") endif()