@@ -753,6 +753,7 @@ bool CHIPEventOpenCL::wait() {
753753}
754754
755755bool CHIPEventOpenCL::updateFinishStatus (bool ThrowErrorIfNotReady) {
756+ logTrace (" CHIPEventOpenCL::updateFinishStatus()" );
756757 if (ThrowErrorIfNotReady && this ->ClEvent == nullptr )
757758 CHIPERR_LOG_AND_THROW (" OpenCL has not been initialized cl_event is null" ,
758759 hipErrorNotReady);
@@ -1088,6 +1089,7 @@ struct HipStreamCallbackData {
10881089 void *UserData;
10891090 hipStreamCallback_t Callback;
10901091 std::shared_ptr<chipstar::Event> CallbackFinishEvent;
1092+ std::shared_ptr<chipstar::Event> CallbackCompleted;
10911093};
10921094
10931095void CL_CALLBACK pfn_notify (cl_event Event, cl_int CommandExecStatus,
@@ -1105,7 +1107,7 @@ void CL_CALLBACK pfn_notify(cl_event Event, cl_int CommandExecStatus,
11051107 CL_COMPLETE);
11061108 CHIPERR_CHECK_LOG_AND_THROW_TABLE (clSetUserEventStatus);
11071109 }
1108- // delete Cbo;
1110+ delete Cbo;
11091111}
11101112
11111113void CHIPQueueOpenCL::MemMap (const chipstar::AllocationInfo *AllocInfo,
@@ -1219,10 +1221,10 @@ void CHIPQueueOpenCL::addCallback(hipStreamCallback_t Callback,
12191221 // finishing the user CB's execution.
12201222
12211223 HipStreamCallbackData *Cb = new HipStreamCallbackData{
1222- this , hipSuccess, UserData, Callback, CallbackEvent};
1224+ this , hipSuccess, UserData, Callback, CallbackEvent, nullptr };
12231225
12241226 std::vector<std::shared_ptr<chipstar::Event>> WaitForEventsCBB{CallbackEvent};
1225- auto CallbackCompleted = enqueueBarrier (WaitForEventsCBB);
1227+ Cb-> CallbackCompleted = enqueueBarrier (WaitForEventsCBB);
12261228
12271229 // We know that the callback won't be yet launched since it's depending
12281230 // on the barrier which waits for the user event.
@@ -1232,7 +1234,7 @@ void CHIPQueueOpenCL::addCallback(hipStreamCallback_t Callback,
12321234 CL_COMPLETE, pfn_notify, Cb);
12331235 CHIPERR_CHECK_LOG_AND_THROW_TABLE (clSetEventCallback);
12341236
1235- updateLastEvent (CallbackCompleted);
1237+ updateLastEvent (Cb-> CallbackCompleted );
12361238
12371239 // Now the CB can start executing in the background:
12381240 clSetUserEventStatus (
@@ -1241,7 +1243,7 @@ void CHIPQueueOpenCL::addCallback(hipStreamCallback_t Callback,
12411243 CHIPERR_CHECK_LOG_AND_THROW_TABLE (clSetUserEventStatus);
12421244
12431245 return ;
1244- };
1246+ }
12451247
12461248std::shared_ptr<chipstar::Event> CHIPQueueOpenCL::enqueueMarkerImpl () {
12471249 std::shared_ptr<chipstar::Event> MarkerEvent =
@@ -1409,8 +1411,7 @@ CHIPQueueOpenCL::~CHIPQueueOpenCL() {
14091411 logTrace (" ~CHIPQueueOpenCL() {}" , (void *)this );
14101412}
14111413
1412- std::shared_ptr<chipstar::Event>
1413- CHIPQueueOpenCL::memCopyAsyncImpl (void *Dst, const void *Src, size_t Size,
1414+ std::shared_ptr<chipstar::Event> CHIPQueueOpenCL::memCopyAsyncImpl (void *Dst, const void *Src, size_t Size,
14141415 hipMemcpyKind Kind) {
14151416 std::shared_ptr<chipstar::Event> Event =
14161417 static_cast <CHIPBackendOpenCL *>(Backend)->createEventShared (
0 commit comments