From ae217e8bd2de2ea7dc9a8d50574530a2a29e4be9 Mon Sep 17 00:00:00 2001 From: Jack Frankland <30410009+FranklandJack@users.noreply.github.com> Date: Wed, 2 Mar 2022 18:30:31 +0000 Subject: [PATCH] Check for non-uniform work-group support (#1383) Only run sub-group tests with non-uniform work-groups on OpenCL 3.0 and later if it is supported by the device. --- test_conformance/subgroups/test_workitem.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/test_conformance/subgroups/test_workitem.cpp b/test_conformance/subgroups/test_workitem.cpp index 7ffa6a7c..b69f3138 100644 --- a/test_conformance/subgroups/test_workitem.cpp +++ b/test_conformance/subgroups/test_workitem.cpp @@ -16,6 +16,7 @@ #include "procs.h" #include "harness/conversions.h" #include "harness/typeWrappers.h" +#include struct get_test_data { @@ -251,8 +252,21 @@ int test_work_item_functions(cl_device_id device, cl_context context, global = local * 5; - // Make sure we have a flexible range - global += 3 * local / 4; + // Non-uniform work-groups are an optional feature from 3.0 onward. + cl_bool device_supports_non_uniform_wg = CL_TRUE; + if (get_device_cl_version(device) >= Version(3, 0)) + { + error = clGetDeviceInfo( + device, CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT, sizeof(cl_bool), + &device_supports_non_uniform_wg, nullptr); + test_error(error, "clGetDeviceInfo failed"); + } + + if (device_supports_non_uniform_wg) + { + // Make sure we have a flexible range + global += 3 * local / 4; + } // Collect the data memset((void *)&result, 0xf0, sizeof(result)); @@ -327,4 +341,4 @@ int test_work_item_functions_ext(cl_device_id device, cl_context context, return test_work_item_functions(device, context, queue, num_elements, false); -} \ No newline at end of file +}