Dynamically Select -cl-std Option (#879)

* Dynamically select the `-cl-std` option on the basic `sizeof` and
`wg_barrier` tests to be one of `CL1.X`, `CL2.0` or `CL3.0`.
Use the most recent CL C standard supported on the device.
This commit is contained in:
Jack Frankland
2020-08-25 18:32:08 +02:00
committed by GitHub
parent faa6ad86c6
commit 0ba7cf1369
4 changed files with 163 additions and 8 deletions

View File

@@ -49,13 +49,8 @@ cl_int get_type_size( cl_context context, cl_command_queue queue, const char *ty
{
sizeof_kernel_code[0] = "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n";
}
bool deviceLt20 = false;
Version version = get_device_cl_version(device);
if (version < Version(2,0)) {
deviceLt20 = true;
}
cl_int err = create_single_kernel_helper_with_build_options(context, &p, &k, 4, sizeof_kernel_code, "test_sizeof", deviceLt20 ? "" : "-cl-std=CL2.0");
cl_int err = create_single_kernel_helper_with_build_options(
context, &p, &k, 4, sizeof_kernel_code, "test_sizeof", nullptr);
if( err )
return err;

View File

@@ -87,7 +87,9 @@ test_wg_barrier(cl_device_id device, cl_context context, cl_command_queue queue,
size_t max_threadgroup_size = 0;
MTdata d;
err = create_single_kernel_helper_with_build_options(context, &program, &kernel, 1, &wg_barrier_kernel_code, "compute_sum", "-cl-std=CL2.0" );
err = create_single_kernel_helper_with_build_options(
context, &program, &kernel, 1, &wg_barrier_kernel_code, "compute_sum",
nullptr);
test_error(err, "Failed to build kernel/program.");
err = clGetKernelWorkGroupInfo(kernel, device, CL_KERNEL_WORK_GROUP_SIZE,