Add device-side execution test for cl_khr_command_buffer#2657
Add device-side execution test for cl_khr_command_buffer#2657shajder wants to merge 2 commits intoKhronosGroup:mainfrom
Conversation
Adds a test verifying that a command-buffer can record and replay a kernel which performs device-side enqueue via enqueue_kernel()
EwanC
left a comment
There was a problem hiding this comment.
I haven't got a device handy that can run this test but LGTM
bashbaug
left a comment
There was a problem hiding this comment.
I didn't do a very thorough review but I did ensure that this test works on the Intel CPU OpenCL device when the OpenCL C version issue is fixed.
| error = create_single_kernel_helper_create_program(context, &program, 1, | ||
| &kernel_str); | ||
| test_error(error, "Failed to create program with source"); | ||
|
|
||
| error = clBuildProgram(program, 1, &device, nullptr, nullptr, nullptr); | ||
| test_error(error, "Failed to build program"); | ||
|
|
||
| kernel = clCreateKernel(program, "device_enqueue", &error); | ||
| test_error(error, "Failed to create device execution kernel"); |
There was a problem hiding this comment.
This is overly verbose and it doesn't work - device-side enqueue requires OpenCL C 2.0 or newer, and passing nullptr as build options means we're getting the default latest version of OpenCL C 1.x.
How about instead:
| error = create_single_kernel_helper_create_program(context, &program, 1, | |
| &kernel_str); | |
| test_error(error, "Failed to create program with source"); | |
| error = clBuildProgram(program, 1, &device, nullptr, nullptr, nullptr); | |
| test_error(error, "Failed to build program"); | |
| kernel = clCreateKernel(program, "device_enqueue", &error); | |
| test_error(error, "Failed to create device execution kernel"); | |
| error = create_single_kernel_helper(context, &program, &kernel, 1, | |
| &kernel_str, "device_enqueue"); | |
| test_error(error, "Failed to create test kernel"); |
|
|
||
| } // anonymous namespace | ||
|
|
||
| REGISTER_TEST(device_execution) |
There was a problem hiding this comment.
Nitpick: I think the name of this test is misleading, since almost all of the command buffer tests (except maybe the negative tests) are executing on the device.
Should the name of this test be "device_enqueue" instead?
Related to #1667