[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
This commit is contained in:
tvukovic-amd
2025-07-16 15:31:40 +00:00
committed by PyTorch MergeBot
parent 06a67a8948
commit a23f4471b9

View File

@ -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()