@@ -174,7 +174,7 @@ void L0DeviceTy::reportDeviceInfo() const {
174174 DP (" -- Max clock frequency (MHz) : %" PRIu32 " \n " , getClockRate ());
175175}
176176
177- Error L0DeviceTy::internalInit ( ) {
177+ Error L0DeviceTy::initImpl (GenericPluginTy &Plugin ) {
178178 const auto &Options = getPlugin ().getOptions ();
179179
180180 uint32_t Count = 1 ;
@@ -219,10 +219,6 @@ Error L0DeviceTy::internalInit() {
219219 return Plugin::success ();
220220}
221221
222- Error L0DeviceTy::initImpl (GenericPluginTy &Plugin) {
223- return Plugin::success ();
224- }
225-
226222Error L0DeviceTy::deinitImpl () {
227223 for (auto &PGM : Programs)
228224 if (auto Err = PGM.deinit ())
@@ -293,7 +289,8 @@ Error L0DeviceTy::synchronizeImpl(__tgt_async_info &AsyncInfo,
293289 CALL_ZE_RET_ERROR (zeEventHostSynchronize, KE, UINT64_MAX);
294290 }
295291 for (auto &Event : WaitEvents) {
296- releaseEvent (Event);
292+ if (auto Err = releaseEvent (Event))
293+ return Err;
297294 }
298295 } else { // Async
299296 // Wait for all events. We should wait and reset events in reverse order
@@ -308,7 +305,8 @@ Error L0DeviceTy::synchronizeImpl(__tgt_async_info &AsyncInfo,
308305 if (*Itr == AsyncQueue->KernelEvent )
309306 WaitDone = true ;
310307 }
311- releaseEvent (*Itr);
308+ if (auto Err = releaseEvent (*Itr))
309+ return Err;
312310 }
313311 }
314312 }
@@ -507,13 +505,13 @@ Error L0DeviceTy::dataExchangeImpl(const void *SrcPtr, GenericDeviceTy &DstDev,
507505 const bool UseCopyEngine = getZeDevice () != L0DstDev.getZeDevice ();
508506
509507 if (asyncEnabled () && AsyncInfoWrapper.hasQueue ()) {
510- if (enqueueMemCopyAsync (DstPtr, SrcPtr, Size,
511- (__tgt_async_info *)AsyncInfoWrapper))
512- return Plugin::error (ErrorCode::UNKNOWN, " dataExchangeImpl failed " ) ;
508+ if (auto Err = enqueueMemCopyAsync (DstPtr, SrcPtr, Size,
509+ (__tgt_async_info *)AsyncInfoWrapper))
510+ return Err ;
513511 } else {
514- if (enqueueMemCopy (DstPtr, SrcPtr, Size,
515- /* AsyncInfo */ nullptr , UseCopyEngine))
516- return Plugin::error (ErrorCode::UNKNOWN, " dataExchangeImpl failed " ) ;
512+ if (auto Err = enqueueMemCopy (DstPtr, SrcPtr, Size,
513+ /* AsyncInfo */ nullptr , UseCopyEngine))
514+ return Err ;
517515 }
518516 return Plugin::success ();
519517}
@@ -708,7 +706,10 @@ Error L0DeviceTy::enqueueMemCopyAsync(void *Dst, const void *Src, size_t Size,
708706 bool CopyTo) {
709707 const bool Ordered =
710708 (getPlugin ().getOptions ().CommandMode == CommandModeTy::AsyncOrdered);
711- ze_event_handle_t SignalEvent = getEvent ();
709+ auto EventOrErr = getEvent ();
710+ if (!EventOrErr)
711+ return EventOrErr.takeError ();
712+ ze_event_handle_t SignalEvent = *EventOrErr;
712713 size_t NumWaitEvents = 0 ;
713714 ze_event_handle_t *WaitEvents = nullptr ;
714715 AsyncQueueTy *AsyncQueue = reinterpret_cast <AsyncQueueTy *>(AsyncInfo->Queue );
@@ -734,7 +735,10 @@ Error L0DeviceTy::enqueueMemFill(void *Ptr, const void *Pattern,
734735 size_t PatternSize, size_t Size) {
735736 if (useImmForCopy ()) {
736737 const auto CmdList = getImmCopyCmdList ();
737- auto Event = getEvent ();
738+ auto EventOrErr = getEvent ();
739+ if (!EventOrErr)
740+ return EventOrErr.takeError ();
741+ ze_event_handle_t Event = *EventOrErr;
738742 CALL_ZE_RET_ERROR (zeCommandListAppendMemoryFill, CmdList, Ptr, Pattern,
739743 PatternSize, Size, Event, 0 , nullptr );
740744 CALL_ZE_RET_ERROR (zeEventHostSynchronize, Event, UINT64_MAX);
0 commit comments