Skip to content

Commit 999c682

Browse files
authored
[UR][HIP] Fix HIP adapter compilation on Windows (#17702)
I don't have access to a device to validate it's all perfect at runtime, but these fixes did let me build everything successfully, and the compiler was able to build Blender GPU kernels library on Windows, using HIP SDK 6.2.4 and VS2022 17.12.1.
1 parent 673f6e6 commit 999c682

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

unified-runtime/source/adapters/hip/CMakeLists.txt

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,21 @@ if("${UR_HIP_PLATFORM}" STREQUAL "AMD")
110110
# Import HIP runtime library
111111
add_library(rocmdrv SHARED IMPORTED GLOBAL)
112112

113-
set_target_properties(
114-
rocmdrv PROPERTIES
115-
IMPORTED_LOCATION "${UR_HIP_LIB_DIR}/libamdhip64.so"
116-
INTERFACE_INCLUDE_DIRECTORIES "${HIP_HEADERS}"
117-
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${HIP_HEADERS}"
118-
)
113+
if(WIN32)
114+
set_target_properties(
115+
rocmdrv PROPERTIES
116+
IMPORTED_IMPLIB "${UR_HIP_LIB_DIR}/amdhip64.lib"
117+
INTERFACE_INCLUDE_DIRECTORIES "${HIP_HEADERS}"
118+
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${HIP_HEADERS}"
119+
)
120+
else()
121+
set_target_properties(
122+
rocmdrv PROPERTIES
123+
IMPORTED_LOCATION "${UR_HIP_LIB_DIR}/libamdhip64.so"
124+
INTERFACE_INCLUDE_DIRECTORIES "${HIP_HEADERS}"
125+
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${HIP_HEADERS}"
126+
)
127+
endif()
119128

120129
if(UR_ENABLE_COMGR)
121130
set(UR_COMGR_VERSION5_HEADER "${UR_HIP_INCLUDE_DIR}/amd_comgr/amd_comgr.h")

unified-runtime/source/adapters/hip/context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName,
6161

6262
UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet);
6363

64-
switch (uint32_t{propName}) {
64+
switch (propName) {
6565
case UR_CONTEXT_INFO_NUM_DEVICES:
6666
return ReturnValue(static_cast<uint32_t>(hContext->Devices.size()));
6767
case UR_CONTEXT_INFO_DEVICES:

unified-runtime/source/adapters/hip/device.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "context.hpp"
1414
#include "event.hpp"
1515

16+
#include <array>
1617
#include <hip/hip_runtime.h>
1718
#include <sstream>
1819

unified-runtime/source/adapters/hip/kernel.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include <ur_api.h>
1313

14+
#include <array>
1415
#include <atomic>
1516
#include <cassert>
1617
#include <numeric>

0 commit comments

Comments
 (0)