Skip to content

Commit e0ba66b

Browse files
JackAKirkldrumm
authored andcommitted
HIP urContextGetNativeHandle unsupported.
Signed-off-by: JackAKirk <jack.kirk@codeplay.com>
1 parent da8d17a commit e0ba66b

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

source/adapters/hip/context.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,14 @@ urContextRetain(ur_context_handle_t hContext) {
108108
return UR_RESULT_SUCCESS;
109109
}
110110

111+
// urContextGetNativeHandle should not be implemented in the HIP backend.
112+
// hipCtx_t is not natively supported by amd devices, and more importantly does
113+
// not map to ur_context_handle_t in any way.
111114
UR_APIEXPORT ur_result_t UR_APICALL urContextGetNativeHandle(
112115
ur_context_handle_t hContext, ur_native_handle_t *phNativeContext) {
113-
// FIXME: this entry point has been deprecated in the SYCL RT and should be
114-
// changed to unsupported once the deprecation period has elapsed
115-
// The below is extremely dodgy but is the equivalent for what went before
116-
// for continuity: apparently some users may be somehow using this API
117-
// currently, despite it not being well defined. This API should not have been
118-
// implemented in the HIP backend. hipCtx_t is not natively supported by amd
119-
// devices and is meaningless for our purposes; all hipCtx_t APIs were added
120-
// for cuda compatibility only and are deprecated by HIP.
121-
122-
hipCtx_t *Ctx = nullptr;
123-
UR_CHECK_ERROR(
124-
hipDevicePrimaryCtxRetain(Ctx, hContext->getDevices()[0]->get()));
125-
*phNativeContext = reinterpret_cast<ur_native_handle_t>(Ctx);
126-
return UR_RESULT_SUCCESS;
116+
std::ignore = hContext;
117+
std::ignore = phNativeContext;
118+
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
127119
}
128120

129121
UR_APIEXPORT ur_result_t UR_APICALL urContextCreateWithNativeHandle(

test/adapters/hip/urContextGetNativeHandle.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urHipContextGetNativeHandleTest);
1010

1111
TEST_P(urHipContextGetNativeHandleTest, Success) {
1212
ur_native_handle_t native_context = 0;
13-
ASSERT_SUCCESS(urContextGetNativeHandle(context, &native_context));
14-
hipCtx_t hip_context = reinterpret_cast<hipCtx_t>(native_context);
15-
std::ignore = hip_context;
13+
auto status = urContextGetNativeHandle(context, &native_context);
14+
ASSERT_EQ(status, UR_RESULT_ERROR_UNSUPPORTED_FEATURE);
1615
}

0 commit comments

Comments
 (0)