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 @@ -313,6 +313,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill(
313313 numEventsInWaitList, cl_adapter::cast<const cl_event *>(phEventWaitList),
314314 &CopyEvent));
315315
316+ if (phEvent) {
317+ // Since we're releasing this in the callback above we need to retain it
318+ // here to keep the user copy alive.
319+ CL_RETURN_ON_FAILURE (clRetainEvent (CopyEvent));
320+ *phEvent = cl_adapter::cast<ur_event_handle_t >(CopyEvent);
321+ }
322+
316323 // This self destructs taking the event and allocation with it.
317324 auto Info = new AllocDeleterCallbackInfo (USMFree, CLContext, HostBuffer);
318325
@@ -327,12 +334,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill(
327334 clReleaseEvent (CopyEvent);
328335 CL_RETURN_ON_FAILURE (ClErr);
329336 }
330- if (phEvent) {
331- // Since we're releasing this in the callback above we need to retain it
332- // here to keep the user copy alive.
333- CL_RETURN_ON_FAILURE (clRetainEvent (CopyEvent));
334- *phEvent = cl_adapter::cast<ur_event_handle_t >(CopyEvent);
335- }
336337
337338 return UR_RESULT_SUCCESS;
338339}
You can’t perform that action at this time.
0 commit comments