Skip to content

Fix CTS api sub test failure for negative_get_command_queue_info#2634

Open
jujiang-del wants to merge 1 commit intoKhronosGroup:mainfrom
jujiang-del:dev/jujiang
Open

Fix CTS api sub test failure for negative_get_command_queue_info#2634
jujiang-del wants to merge 1 commit intoKhronosGroup:mainfrom
jujiang-del:dev/jujiang

Conversation

@jujiang-del
Copy link
Contributor

To fix a test failure in api sub-test "negative_get_command_queue_info".
The test code gets clGetDeviceInfo for the property CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES, when it create command queue for the device, "CL_QUEUE_ON_DEVICE" should be the correct input, instead of CL_QUEUE_PROPERTIES.

Comment on lines 437 to 447
const cl_queue_properties properties[] = {
CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0
CL_QUEUE_ON_DEVICE, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0
};
cl_int err = CL_INVALID_VALUE;
clCommandQueueWrapper cmd_queue = clCreateCommandQueueWithProperties(
context, device, properties, &err);
test_error(err, "clCreateCommandQueueWithProperties");
cl_uint queue_size = -1;
err = clGetCommandQueueInfo(cmd_queue, CL_QUEUE_SIZE,
sizeof(queue_size), &queue_size, nullptr);
test_failure_error_ret(err, CL_INVALID_COMMAND_QUEUE,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a correct change. Note that this is a negative test, so it is checking that the proper error code is returned. Specifically, it is testing that CL_INVALID_COMMAND_QUEUE is returned when querying CL_QUEUE_SIZE for a command-queue that is not a device command-queue, therefore the command-queue should not be created with the CL_QUEUE_ON_DEVICE property.

IMHO there are some improvements we could make to this test - for example, we could run this scenario on all OpenCL 2.x or newer device, not just those that support device command-queues - but I do think the test is fundamentally correct. Please let me know if you still believe otherwise - thanks1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If keep the original CL_QUEUE_PROPERTIES, the API clCreateCommandQueueWithProperties will fail and won't proceed to the following calls.

Copy link
Contributor

@bashbaug bashbaug Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the call with CL_QUEUE_PROPERTIES should succeed: It's creating a command queue with an array of properties, and the only property that is being passed is the CL_QUEUE_PROPERTIES bitfield with value CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE.

In other words, this is the equivalent of this call without using the array of properties:

        clCommandQueueWrapper cmd_queue = clCreateCommandQueue(
            context, device, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &err);

edit: fixed copy-paste error

I ran this test on our CPU device (which supports device queues) and it behaved as expected:

>>>> clCreateCommandQueueWithProperties: context = 0x5cea69aec7c8, device = 12th Gen Intel(R) Core(TM) i9-12900K (CL_DEVICE_TYPE_CPU) (0x5cea69c1dbe8), properties = [ CL_QUEUE_PROPERTIES = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE ]
<<<< clCreateCommandQueueWithProperties: returned 0x5cea6b7a8098 -> CL_SUCCESS
>>>> clGetCommandQueueInfo: command_queue = 0x5cea6b7a8098, param_name = CL_QUEUE_SIZE (00001094)
<<<< clGetCommandQueueInfo -> CL_INVALID_COMMAND_QUEUE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test code queries clGetDeviceInfo for the property CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES. When creating a command queue for the device, the correct flag to use is CL_QUEUE_ON_DEVICE. The runtime must validate that the device actually supports this capability. This requires carefully checking the value returned by clGetDeviceInfo.

When CL_QUEUE_PROPERTIES is incorrectly passed to clCreateCommandQueue, the call fails, and the subsequent negative test clGetCommandQueueInfo does not execute.

Additionally, several negative API test cases validate CL_QUEUE_PROPERTIES with the flag CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, including:

negative_create_command_queue

negative_create_command_queue_with_properties

After fully investigating and verifying the behavior, including applying the CTS patch and updating the OpenCL runtime validation, all 109 out of 109 tests now pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants