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 @@ -320,6 +320,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill(
320320 numEventsInWaitList, cl_adapter::cast<const cl_event *>(phEventWaitList),
321321 &CopyEvent));
322322
323+ if (phEvent) {
324+ // Since we're releasing this in the callback above we need to retain it
325+ // here to keep the user copy alive.
326+ CL_RETURN_ON_FAILURE (clRetainEvent (CopyEvent));
327+ *phEvent = cl_adapter::cast<ur_event_handle_t >(CopyEvent);
328+ }
329+
323330 // This self destructs taking the event and allocation with it.
324331 auto Info = new AllocDeleterCallbackInfo (USMFree, CLContext, HostBuffer);
325332
@@ -334,12 +341,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill(
334341 clReleaseEvent (CopyEvent);
335342 CL_RETURN_ON_FAILURE (ClErr);
336343 }
337- if (phEvent) {
338- // Since we're releasing this in the callback above we need to retain it
339- // here to keep the user copy alive.
340- CL_RETURN_ON_FAILURE (clRetainEvent (CopyEvent));
341- *phEvent = cl_adapter::cast<ur_event_handle_t >(CopyEvent);
342- }
343344
344345 return UR_RESULT_SUCCESS;
345346}
You can’t perform that action at this time.
0 commit comments