Skip to content

Commit da8d17a

Browse files
JackAKirkldrumm
authored andcommitted
Use hipDevicePrimaryCtxRetain, get device "ctxt".
Signed-off-by: JackAKirk <jack.kirk@codeplay.com>
1 parent b9b1e91 commit da8d17a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source/adapters/hip/context.cpp

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

111-
UR_APIEXPORT ur_result_t UR_APICALL
112-
urContextGetNativeHandle([[maybe_unused]] ur_context_handle_t hContext,
113-
ur_native_handle_t *phNativeContext) {
111+
UR_APIEXPORT ur_result_t UR_APICALL urContextGetNativeHandle(
112+
ur_context_handle_t hContext, ur_native_handle_t *phNativeContext) {
114113
// FIXME: this entry point has been deprecated in the SYCL RT and should be
115114
// changed to unsupported once the deprecation period has elapsed
116115
// The below is extremely dodgy but is the equivalent for what went before
@@ -121,7 +120,8 @@ urContextGetNativeHandle([[maybe_unused]] ur_context_handle_t hContext,
121120
// for cuda compatibility only and are deprecated by HIP.
122121

123122
hipCtx_t *Ctx = nullptr;
124-
UR_CHECK_ERROR(hipCtxGetCurrent(Ctx));
123+
UR_CHECK_ERROR(
124+
hipDevicePrimaryCtxRetain(Ctx, hContext->getDevices()[0]->get()));
125125
*phNativeContext = reinterpret_cast<ur_native_handle_t>(Ctx);
126126
return UR_RESULT_SUCCESS;
127127
}

0 commit comments

Comments
 (0)