aboutsummaryrefslogtreecommitdiff
path: root/test_conformance/subgroups/test_subgroup_shuffle_relative.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test_conformance/subgroups/test_subgroup_shuffle_relative.cpp')
-rw-r--r--test_conformance/subgroups/test_subgroup_shuffle_relative.cpp40
1 files changed, 13 insertions, 27 deletions
diff --git a/test_conformance/subgroups/test_subgroup_shuffle_relative.cpp b/test_conformance/subgroups/test_subgroup_shuffle_relative.cpp
index 6000c970..caa1dccc 100644
--- a/test_conformance/subgroups/test_subgroup_shuffle_relative.cpp
+++ b/test_conformance/subgroups/test_subgroup_shuffle_relative.cpp
@@ -15,37 +15,19 @@
//
#include "procs.h"
#include "subhelpers.h"
+#include "subgroup_common_kernels.h"
#include "subgroup_common_templates.h"
#include "harness/conversions.h"
#include "harness/typeWrappers.h"
namespace {
-static const char* shuffle_down_source =
- "__kernel void test_sub_group_shuffle_down(const __global Type *in, "
- "__global int4 *xy, __global Type *out)\n"
- "{\n"
- " int gid = get_global_id(0);\n"
- " XY(xy,gid);\n"
- " Type x = in[gid];\n"
- " out[gid] = sub_group_shuffle_down(x, xy[gid].z);"
- "}\n";
-static const char* shuffle_up_source =
- "__kernel void test_sub_group_shuffle_up(const __global Type *in, __global "
- "int4 *xy, __global Type *out)\n"
- "{\n"
- " int gid = get_global_id(0);\n"
- " XY(xy,gid);\n"
- " Type x = in[gid];\n"
- " out[gid] = sub_group_shuffle_up(x, xy[gid].z);"
- "}\n";
-
template <typename T> int run_shuffle_relative_for_type(RunTestForType rft)
{
- int error = rft.run_impl<T, SHF<T, ShuffleOp::shuffle_up>>(
- "test_sub_group_shuffle_up", shuffle_up_source);
+ int error =
+ rft.run_impl<T, SHF<T, ShuffleOp::shuffle_up>>("sub_group_shuffle_up");
error |= rft.run_impl<T, SHF<T, ShuffleOp::shuffle_down>>(
- "test_sub_group_shuffle_down", shuffle_down_source);
+ "sub_group_shuffle_down");
return error;
}
@@ -56,13 +38,17 @@ int test_subgroup_functions_shuffle_relative(cl_device_id device,
cl_command_queue queue,
int num_elements)
{
- std::vector<std::string> required_extensions = {
- "cl_khr_subgroup_shuffle_relative"
- };
+ if (!is_extension_available(device, "cl_khr_subgroup_shuffle_relative"))
+ {
+ log_info("cl_khr_subgroup_shuffle_relative is not supported on this "
+ "device, skipping test.\n");
+ return TEST_SKIPPED_ITSELF;
+ }
+
constexpr size_t global_work_size = 2000;
constexpr size_t local_work_size = 200;
- WorkGroupParams test_params(global_work_size, local_work_size,
- required_extensions);
+ WorkGroupParams test_params(global_work_size, local_work_size);
+ test_params.save_kernel_source(sub_group_generic_source);
RunTestForType rft(device, context, queue, num_elements, test_params);
int error = run_shuffle_relative_for_type<cl_int>(rft);