Skip to content

Revisit command-buffer simultaneous-use #891

@EwanC

Description

@EwanC

During the course of writing CTS test for cl_khr_command_buffer, in particular KhronosGroup/OpenCL-CTS#1584, questions have arisen about the behaviour of CL_COMMAND_BUFFER_CAPABILITY_SIMULTANEOUS_USE_KHR and how usable it is for developers.

E.g - Do the following examples exhibit simultaneous-use behaviour?

// Case 1: queue is an out-of-order queue.
// Note: No event dependencies!
clEnqueueCommandBufferKHR(1, &queue, cmdbuf, 0, NULL, NULL);
clEnqueueCommandBufferKHR(1, &queue, cmdbuf, 0, NULL, NULL);
clFinish(queue);

// Case 2: queue0 and queue1 are in-order queues.
clEnqueueCommandBufferKHR(1, &queue0, cmdbuf, 0, NULL, NULL);
clEnqueueCommandBufferKHR(1, &queue1, cmdbuf, 0, NULL, NULL);
clFlush(queue0); // these flushes may not be required
clFlush(queue1);
clFinish(queue0);
clFinish(queue1);

In my mind, a lot of the behaviour of simultaneous-use actually depends on whether a vendor implements queues eagerly or lazily. In lazy execution (what happens in Codeplay' implementation for example) we wouldn't start submitting anything until the clFinish()/cFlush(), so the pending count keeps on increasing until then, even for in-order queues. In an eager queue implementation, the first enqueue would be run straight away, and may indeed have finished by the time the host code calls the second command buffer.

Depending on an unreported implementation detail is hard for a user developing code to reason about
though, so maybe we can do better here. Before the cl_khr_command_buffer extension becomes final from provisional we should confirm if the currently specified behaviour is what we want, or whether we should revisit this property.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cl_khr_command_bufferRelating to the command-buffer family of extension

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions