@@ -228,7 +228,8 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
228228 }
229229
230230 auto &commandStream = *obtainCommandStream<commandType>(csrDeps, profilingRequired, perfCountersRequired, blitEnqueue, blockQueue,
231- multiDispatchInfo, blockedCommandsData, surfacesForResidency, numSurfaceForResidency);
231+ multiDispatchInfo, eventsRequest, blockedCommandsData, surfacesForResidency,
232+ numSurfaceForResidency);
232233 auto commandStreamStart = commandStream.getUsed ();
233234
234235 if (eventBuilder.getEvent () && getGpgpuCommandStreamReceiver ().peekTimestampPacketWriteEnabled ()) {
@@ -763,15 +764,16 @@ void CommandQueueHw<GfxFamily>::enqueueBlocked(
763764 eventBuilder = &internalEventBuilder;
764765 DBG_LOG (EventsDebugEnable, " enqueueBlocked" , " new virtualEvent" , eventBuilder->getEvent ());
765766 }
767+ auto outEvent = eventBuilder->getEvent ();
766768
767769 // update queue taskCount
768- taskCount = eventBuilder-> getEvent () ->getCompletionStamp ();
770+ taskCount = outEvent ->getCompletionStamp ();
769771
770- if (multiDispatchInfo.empty ()) {
771- DEBUG_BREAK_IF (!isCommandWithoutKernel (commandType));
772- auto cmd = std::make_unique<CommandMarker>(*this );
772+ std::unique_ptr<Command> command;
773+ bool storeTimestampPackets = blockedCommandsData && timestampPacketContainer;
773774
774- eventBuilder->getEvent ()->setCommand (std::move (cmd));
775+ if (multiDispatchInfo.empty ()) {
776+ command = std::make_unique<CommandMarker>(*this , blockedCommandsData);
775777 } else {
776778 // store task data in event
777779 std::vector<Surface *> allSurfaces;
@@ -788,28 +790,26 @@ void CommandQueueHw<GfxFamily>::enqueueBlocked(
788790 allSurfaces.push_back (surface->duplicate ());
789791 }
790792 PreemptionMode preemptionMode = PreemptionHelper::taskPreemptionMode (*device, multiDispatchInfo);
791- auto cmd = std::make_unique<CommandComputeKernel>(
792- *this ,
793- std::move (blockedCommandsData),
794- allSurfaces,
795- shouldFlushDC (commandType, printfHandler.get ()),
796- slmUsed,
797- commandType == CL_COMMAND_NDRANGE_KERNEL,
798- std::move (printfHandler),
799- preemptionMode,
800- multiDispatchInfo.peekMainKernel (),
801- (uint32_t )multiDispatchInfo.size ());
802-
803- if (timestampPacketContainer.get ()) {
804- for (cl_uint i = 0 ; i < eventsRequest.numEventsInWaitList ; i++) {
805- auto event = castToObjectOrAbort<Event>(eventsRequest.eventWaitList [i]);
806- event->incRefInternal ();
807- }
808- cmd->setTimestampPacketNode (*timestampPacketContainer, *previousTimestampPacketNodes);
793+ command = std::make_unique<CommandComputeKernel>(*this ,
794+ blockedCommandsData,
795+ allSurfaces,
796+ shouldFlushDC (commandType, printfHandler.get ()),
797+ slmUsed,
798+ commandType == CL_COMMAND_NDRANGE_KERNEL,
799+ std::move (printfHandler),
800+ preemptionMode,
801+ multiDispatchInfo.peekMainKernel (),
802+ (uint32_t )multiDispatchInfo.size ());
803+ }
804+ if (storeTimestampPackets) {
805+ for (cl_uint i = 0 ; i < eventsRequest.numEventsInWaitList ; i++) {
806+ auto event = castToObjectOrAbort<Event>(eventsRequest.eventWaitList [i]);
807+ event->incRefInternal ();
809808 }
810- cmd-> setEventsRequest (eventsRequest );
811- eventBuilder-> getEvent ()-> setCommand ( std::move (cmd) );
809+ command-> setTimestampPacketNode (*timestampPacketContainer, *previousTimestampPacketNodes );
810+ command-> setEventsRequest (eventsRequest );
812811 }
812+ outEvent->setCommand (std::move (command));
813813
814814 eventBuilder->addParentEvents (ArrayRef<const cl_event>(eventsRequest.eventWaitList , eventsRequest.numEventsInWaitList ));
815815 eventBuilder->addParentEvent (this ->virtualEvent );
@@ -819,7 +819,7 @@ void CommandQueueHw<GfxFamily>::enqueueBlocked(
819819 this ->virtualEvent ->decRefInternal ();
820820 }
821821
822- this ->virtualEvent = eventBuilder-> getEvent () ;
822+ this ->virtualEvent = outEvent ;
823823}
824824
825825template <typename GfxFamily>
0 commit comments