diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl index 39c8bcd74f..ac907f5f85 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl @@ -69,6 +69,8 @@ ze_result_t CommandQueueHw::executeCommandLists( using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL; using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION; + auto lockCSR = csr->obtainUniqueOwnership(); + for (auto i = 0u; i < numCommandLists; i++) { auto commandList = CommandList::fromHandle(phCommandLists[i]); if (isCopyOnlyCommandQueue != commandList->isCopyOnly()) { diff --git a/shared/source/command_stream/command_stream_receiver.h b/shared/source/command_stream/command_stream_receiver.h index 754b39fb4b..155d5eb0d7 100644 --- a/shared/source/command_stream/command_stream_receiver.h +++ b/shared/source/command_stream/command_stream_receiver.h @@ -266,7 +266,7 @@ class CommandStreamReceiver { uint64_t totalMemoryUsed = 0u; // taskCount - # of tasks submitted - uint32_t taskCount = 0; + std::atomic taskCount{0}; uint32_t lastSentL3Config = 0; uint32_t latestSentStatelessMocsConfig = 0; diff --git a/shared/source/command_stream/command_stream_receiver_hw_base.inl b/shared/source/command_stream/command_stream_receiver_hw_base.inl index ce2f4797f8..87b9386f71 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -224,7 +224,7 @@ CompletionStamp CommandStreamReceiverHw::flushTask( args); this->latestSentTaskCount = taskCount + 1; - DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "taskCount", taskCount); + DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "taskCount", peekTaskCount()); if (DebugManager.flags.AddPatchInfoCommentsForAUBDump.get()) { flatBatchBufferHelper->setPatchInfoData(PatchInfoData(address, 0u, PatchInfoAllocationType::TagAddress, @@ -421,7 +421,7 @@ CompletionStamp CommandStreamReceiverHw::flushTask( MemorySynchronizationCommands::addPipeControl(commandStreamCSR, args); } this->taskLevel = taskLevel; - DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "this->taskCount", this->taskCount); + DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "this->taskCount", peekTaskCount()); } if (DebugManager.flags.ForcePipeControlPriorToWalker.get()) { @@ -545,7 +545,7 @@ CompletionStamp CommandStreamReceiverHw::flushTask( } ++taskCount; - DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "taskCount", taskCount); + DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "taskCount", peekTaskCount()); DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "Current taskCount:", tagAddress ? *tagAddress : 0); CompletionStamp completionStamp = {