Skip to content

Commit e3eeee4

Browse files
committed
check that devices match in the command buffer emulation layer
This error condition specifically: CL_INVALID_DEVICE if any element of queues does not have the same device as the command-queue set on command_buffer creation at the same list index.
1 parent d52d882 commit e3eeee4

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎layers/10_cmdbufemu/emulate.cpp‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,14 @@ typedef struct _cl_command_buffer_khr
15031503
&cmdbuf_context,
15041504
nullptr);
15051505

1506+
cl_device_id cmdbuf_device = nullptr;
1507+
g_pNextDispatch->clGetCommandQueueInfo(
1508+
getQueue(),
1509+
CL_QUEUE_DEVICE,
1510+
sizeof(cmdbuf_device),
1511+
&cmdbuf_device,
1512+
nullptr);
1513+
15061514
for( cl_uint q = 0; q < num_queues && queues; q++ )
15071515
{
15081516
if( queues[q] == nullptr )
@@ -1521,6 +1529,18 @@ typedef struct _cl_command_buffer_khr
15211529
{
15221530
return CL_INVALID_CONTEXT;
15231531
}
1532+
1533+
cl_device_id queue_device = nullptr;
1534+
g_pNextDispatch->clGetCommandQueueInfo(
1535+
queues[q],
1536+
CL_QUEUE_DEVICE,
1537+
sizeof(queue_device),
1538+
&queue_device,
1539+
nullptr);
1540+
if( queue_device != cmdbuf_device )
1541+
{
1542+
return CL_INVALID_DEVICE;
1543+
}
15241544
}
15251545

15261546
// CL_INCOMPATIBLE_COMMAND_QUEUE_KHR if any element of queues is not compatible with the command-queue set on command_buffer creation at the same list index.

0 commit comments

Comments
 (0)