Skip to content

Commit 9f631b9

Browse files
committed
Use reinterpret_cast for void* on AMD platform;
Signed-off-by: Lukas Sommer <[email protected]>
1 parent 17c2209 commit 9f631b9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sycl/plugins/hip/pi_hip.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,6 +2131,7 @@ pi_result hip_piMemGetInfo(pi_mem memObj, pi_mem_info queriedInfo,
21312131
/// \return PI_SUCCESS
21322132
pi_result hip_piextMemGetNativeHandle(pi_mem mem,
21332133
pi_native_handle *nativeHandle) {
2134+
#if defined(__HIP_PLATFORM_NVIDIA__)
21342135
if (sizeof(_pi_mem::mem_::buffer_mem_::native_type) >
21352136
sizeof(pi_native_handle)) {
21362137
// Check that all the upper bits that cannot be represented by
@@ -2145,6 +2146,12 @@ pi_result hip_piextMemGetNativeHandle(pi_mem mem,
21452146
}
21462147
}
21472148
*nativeHandle = static_cast<pi_native_handle>(mem->mem_.buffer_mem_.get());
2149+
#elif defined(__HIP_PLATFORM_AMD__)
2150+
*nativeHandle =
2151+
reinterpret_cast<pi_native_handle>(mem->mem_.buffer_mem_.get());
2152+
#else
2153+
#error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
2154+
#endif
21482155
return PI_SUCCESS;
21492156
}
21502157

0 commit comments

Comments
 (0)