Fix race in events scenarios.

- It could happen that 2 threads try to update the same event within tree
- First thread starts to submit command, it releases cmdToSubmit
- Second thread doesn't see the command and follows
- Second thread thinks that it submitted the command so it follows to
subsequent steps which are child events notification
- We end up with corrupted enqueue sequence as child may submit prior to
parent.
- With this change each submit step is synchronized basing on task count
- When second thread enters submit command without task count being set
it wait for first thread to properly set it.

Change-Id: Ic2ddaea17f9af8cab6781320edae2c268dd0b189
Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
This commit is contained in:
Mrozek, Michal
2019-07-09 12:55:26 +02:00
committed by sys_ocldev
parent d724b9ab11
commit 6ffcd51847
5 changed files with 34 additions and 8 deletions

View File

@@ -146,11 +146,6 @@ bool CommandQueue::isQueueBlocked() {
UNRECOVERABLE_IF(this->virtualEvent == nullptr);
if (this->virtualEvent->isStatusCompletedByTermination(executionStatus) == false) {
//it may happen that virtual event is submitted but doesn't have task count assigned yet
if (this->virtualEvent->peekTaskCount() == Event::eventNotReady) {
return true;
}
taskCount = this->virtualEvent->peekTaskCount();
flushStamp->setStamp(this->virtualEvent->flushStamp->peekStamp());
taskLevel = this->virtualEvent->taskLevel;