Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cross queue dependency when command buffer already dispatched. #279

Merged

Conversation

coldav
Copy link
Collaborator

@coldav coldav commented Jan 4, 2024

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.

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

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. 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.
@coldav coldav merged commit 8b5a48a into uxlfoundation:main Jan 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants