| 247 | } |
| 248 | |
| 249 | void generate_kernel_ws( cl_device_id device, cl_kernel kernel, WorkSizeInfo& ws) |
| 250 | { |
| 251 | size_t compile_work_group_size[MAX_WORK_DIM]; |
| 252 | |
| 253 | memset(&ws, 0, sizeof(WorkSizeInfo)); |
| 254 | ws.work_dim = 1; |
| 255 | ws.global_work_size[0] = (GLOBAL_WORK_SIZE <= 32) ? GLOBAL_WORK_SIZE : 32; // kernels limitations |
| 256 | ws.local_work_size[0] = ((GLOBAL_WORK_SIZE % 4) == 0) ? (GLOBAL_WORK_SIZE / 4) : (GLOBAL_WORK_SIZE / 2); |
| 257 | |
| 258 | //Check if the kernel was compiled with specific work group size |
| 259 | int error = clGetKernelWorkGroupInfo(kernel, device, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, sizeof(compile_work_group_size), &compile_work_group_size, NULL); |
| 260 | if( error != CL_SUCCESS ) |
| 261 | { |
| 262 | throw Exceptions::TestError("clGetKernelWorkGroupInfo failed\n", error); |
| 263 | } |
| 264 | |
| 265 | // if compile_work_group_size[0] is not 0 - use the compiled values |
| 266 | if ( 0 != compile_work_group_size[0] ) |
| 267 | { |
| 268 | // the kernel compiled with __attribute__((reqd_work_group_size(X, Y, Z))) |
| 269 | memcpy(ws.global_work_size, compile_work_group_size, sizeof(ws.global_work_size)); |
| 270 | |
| 271 | // Now, check the correctness of the local work size and fix it if necessary |
| 272 | for ( int i = 0; i < MAX_WORK_DIM; ++i ) |
| 273 | { |
| 274 | if ( ws.local_work_size[i] > compile_work_group_size[i] ) |
| 275 | { |
| 276 | ws.local_work_size[i] = compile_work_group_size[i]; |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | TestResult* TestResult::clone(cl_context ctx, const WorkSizeInfo& ws, const cl_kernel kernel, const cl_device_id device) const |
| 283 | { |
no test coverage detected