Skip to content

Commit 93a1561

Browse files
committed
optimize the in-order command buffer case
If there is only one command-queue associated with the command-buffer (so there are no cross-queue dependencies), and if the command-queue is an in-order queue (so there are no intra-queue dependencies), then we don't need to track dependencies within the command-buffer.
1 parent 5ad3dd0 commit 93a1561

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

layers/10_cmdbufemu/emulate.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,10 +1510,13 @@ typedef struct _cl_command_buffer_khr
15101510
NextSyncPoint.fetch_add(1, std::memory_order_relaxed) :
15111511
0;
15121512

1513-
command->addDependencies(
1514-
num_sync_points,
1515-
wait_list,
1516-
syncPoint);
1513+
// We only need to add dependencies if there is more than one queue (so
1514+
// we have possible cross-queue dependencies) or the queue is an
1515+
// out-of-order queue (so we have possible intra-queue dependencies).
1516+
if( Queues.size() > 1 || !IsInOrder[0] )
1517+
{
1518+
command->addDependencies(num_sync_points, wait_list, syncPoint);
1519+
}
15171520

15181521
if( sync_point != nullptr )
15191522
{

0 commit comments

Comments
 (0)