File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill(
298298 numEventsInWaitList, cl_adapter::cast<const cl_event *>(phEventWaitList),
299299 &CopyEvent));
300300
301+ if (phEvent) {
302+ // Since we're releasing this in the callback above we need to retain it
303+ // here to keep the user copy alive.
304+ CL_RETURN_ON_FAILURE (clRetainEvent (CopyEvent));
305+ *phEvent = cl_adapter::cast<ur_event_handle_t >(CopyEvent);
306+ }
307+
301308 // This self destructs taking the event and allocation with it.
302309 auto Info = new AllocDeleterCallbackInfo (USMFree, CLContext, HostBuffer);
303310
@@ -312,12 +319,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill(
312319 clReleaseEvent (CopyEvent);
313320 CL_RETURN_ON_FAILURE (ClErr);
314321 }
315- if (phEvent) {
316- // Since we're releasing this in the callback above we need to retain it
317- // here to keep the user copy alive.
318- CL_RETURN_ON_FAILURE (clRetainEvent (CopyEvent));
319- *phEvent = cl_adapter::cast<ur_event_handle_t >(CopyEvent);
320- }
321322
322323 return UR_RESULT_SUCCESS;
323324}
You can’t perform that action at this time.
0 commit comments