@@ -258,14 +258,12 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
258258 commandQueue.clearLastBcsPackets ();
259259 }
260260
261- bool isGpuHangDetected{false };
262-
263261 if (kernelOperation->blitPropertiesContainer .size () > 0 ) {
264262 const auto newTaskCount = bcsCsrForAuxTranslation->flushBcsTask (kernelOperation->blitPropertiesContainer , false , commandQueue.isProfilingEnabled (), commandQueue.getDevice ());
265- if (newTaskCount) {
266- commandQueue.updateBcsTaskCount (bcsCsrForAuxTranslation->getOsContext ().getEngineType (), * newTaskCount);
263+ if (newTaskCount <= CompletionStamp::notReady ) {
264+ commandQueue.updateBcsTaskCount (bcsCsrForAuxTranslation->getOsContext ().getEngineType (), newTaskCount);
267265 } else {
268- isGpuHangDetected = true ;
266+ completionStamp. taskCount = newTaskCount ;
269267 }
270268 }
271269 commandQueue.updateLatestSentEnqueueType (EnqueueProperties::Operation::GpuKernel);
@@ -277,11 +275,11 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
277275 if (printfHandler) {
278276 const auto waitStatus = commandQueue.waitUntilComplete (completionStamp.taskCount , {}, completionStamp.flushStamp , false );
279277 if (waitStatus == WaitStatus::GpuHang) {
280- isGpuHangDetected = true ;
278+ completionStamp. taskCount = CompletionStamp::gpuHang ;
281279 }
282280
283281 if (!printfHandler->printEnqueueOutput ()) {
284- isGpuHangDetected = true ;
282+ completionStamp. taskCount = CompletionStamp::gpuHang ;
285283 }
286284 }
287285
@@ -290,14 +288,10 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
290288 }
291289 surfaces.clear ();
292290
293- if (isGpuHangDetected) {
294- completionStamp.taskCount = CompletionStamp::gpuHang;
295- }
296-
297291 return completionStamp;
298292}
299293
300- bool CommandWithoutKernel::dispatchBlitOperation () {
294+ uint32_t CommandWithoutKernel::dispatchBlitOperation () {
301295 auto bcsCsr = kernelOperation->bcsCsr ;
302296 UNRECOVERABLE_IF (bcsCsr == nullptr );
303297
@@ -314,14 +308,14 @@ bool CommandWithoutKernel::dispatchBlitOperation() {
314308 }
315309
316310 const auto newTaskCount = bcsCsr->flushBcsTask (kernelOperation->blitPropertiesContainer , false , commandQueue.isProfilingEnabled (), commandQueue.getDevice ());
317- if (! newTaskCount) {
318- return false ;
311+ if (newTaskCount > CompletionStamp::notReady ) {
312+ return newTaskCount ;
319313 }
320314
321- commandQueue.updateBcsTaskCount (bcsCsr->getOsContext ().getEngineType (), * newTaskCount);
315+ commandQueue.updateBcsTaskCount (bcsCsr->getOsContext ().getEngineType (), newTaskCount);
322316 commandQueue.setLastBcsPacket (bcsCsr->getOsContext ().getEngineType ());
323317
324- return true ;
318+ return newTaskCount ;
325319}
326320
327321CompletionStamp &CommandWithoutKernel::submit (uint32_t taskLevel, bool terminated) {
@@ -420,8 +414,9 @@ CompletionStamp &CommandWithoutKernel::submit(uint32_t taskLevel, bool terminate
420414 }
421415
422416 if (kernelOperation->blitEnqueue ) {
423- if (!dispatchBlitOperation ()) {
424- completionStamp.taskCount = CompletionStamp::gpuHang;
417+ auto taskCount = dispatchBlitOperation ();
418+ if (taskCount > CompletionStamp::notReady) {
419+ completionStamp.taskCount = taskCount;
425420 }
426421 }
427422
0 commit comments