Fix cross queue dependency when command buffer already dispatched. #279
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Provide a brief overview of what your changes do, summarizing their effects
and consequences.
Reason for change
The UnitCL test USMBlockingFreeTest, MultipleQueueMultipleAlloc had previously been disabled due to sporadic fails. Tsan build showed that there was a dependency issue between the fill and copy commands.
This test did something like the following:
Q_A: Fill -> e[0] BufA 4096
Q_B: Fill -> e[1] BufB 4096
Q_C: e[0]->Memcpy from BufA 2048
Q_C: e[1]->Memcpy from BufB 2048
Description of change
Much of the core dependencies for command buffers is done in _cl_command_queue::getCommandBufferPending(). In order to capture event dependencies, semaphores are waited on from pending or dispatched command buffers. The code would check events and then check to see if they were in pending command buffers and if so would add semaphores wait from them. If it could not find a pending command buffer it would add the wait on any running command buffers. This generally worked but for cross queues it was not checking the running command buffers of that queue. This collates all the queues that events wait on treats them the same.
Additionally there is an early out for the case of a single pending command buffer but if there is any cross queue events, we cannot use this.