mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-27 07:44:16 +08:00
fix: use condition variables instead of busy waits in worker threads
Resolves: NEO-16085, GSD-11678, HSD-14025819208 Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
49293fcac6
commit
452475a0b9
@@ -138,7 +138,8 @@ SubmissionStatus CommandStreamReceiver::submitBatchBuffer(BatchBuffer &batchBuff
|
||||
if (!isUpdateTagFromWaitEnabled()) {
|
||||
this->latestFlushedTaskCount = taskCount + 1;
|
||||
}
|
||||
taskCount++;
|
||||
|
||||
incrementTaskCountAndNotifyNewSubmission();
|
||||
|
||||
return retVal;
|
||||
}
|
||||
@@ -1263,5 +1264,17 @@ void CommandStreamReceiver::addToEvictionContainer(GraphicsAllocation &gfxAlloca
|
||||
this->getEvictionAllocations().push_back(&gfxAllocation);
|
||||
}
|
||||
|
||||
void CommandStreamReceiver::incrementTaskCountAndNotifyNewSubmission() {
|
||||
++taskCount;
|
||||
notifyNewSubmission();
|
||||
}
|
||||
|
||||
void CommandStreamReceiver::notifyNewSubmission() {
|
||||
if (directSubmissionControllerSyncData) {
|
||||
std::lock_guard<std::mutex> lock(directSubmissionControllerSyncData->mutex);
|
||||
directSubmissionControllerSyncData->condVar.notify_one();
|
||||
}
|
||||
}
|
||||
|
||||
std::function<void()> CommandStreamReceiver::debugConfirmationFunction = []() { std::cin.get(); };
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user