diff --git a/test_conformance/subgroups/subgroup_common_templates.h b/test_conformance/subgroups/subgroup_common_templates.h index 64b4b971..fc0b03b5 100644 --- a/test_conformance/subgroups/subgroup_common_templates.h +++ b/test_conformance/subgroups/subgroup_common_templates.h @@ -63,6 +63,13 @@ static cl_uint4 generate_bit_mask(cl_uint subgroup_local_id, // only 4 work_items from subgroup enter the code (are active) template struct BC { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + log_info(" sub_group_%s(%s)...%s\n", operation_names(operation), + TypeManager::name(), extra_text); + } + static void gen(Ty *x, Ty *t, cl_int *m, const WorkGroupParams &test_params) { int i, ii, j, k, n; @@ -76,8 +83,6 @@ template struct BC int last_subgroup_size = 0; ii = 0; - log_info(" sub_group_%s(%s)...\n", operation_names(operation), - TypeManager::name()); if (non_uniform_size) { ng++; @@ -286,8 +291,6 @@ template struct BC y += nw; m += 4 * nw; } - log_info(" sub_group_%s(%s)... passed\n", operation_names(operation), - TypeManager::name()); return TEST_PASS; } }; @@ -437,6 +440,13 @@ void genrand(Ty *x, Ty *t, cl_int *m, int ns, int nw, int ng) template struct SHF { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + log_info(" sub_group_%s(%s)...%s\n", operation_names(operation), + TypeManager::name(), extra_text); + } + static void gen(Ty *x, Ty *t, cl_int *m, const WorkGroupParams &test_params) { int i, ii, j, k, l, n, delta; @@ -447,8 +457,6 @@ template struct SHF int d = ns > 100 ? 100 : ns; ii = 0; ng = ng / nw; - log_info(" sub_group_%s(%s)...\n", operation_names(operation), - TypeManager::name()); for (k = 0; k < ng; ++k) { // for each work_group for (j = 0; j < nj; ++j) @@ -560,26 +568,29 @@ template struct SHF y += nw; m += 4 * nw; } - log_info(" sub_group_%s(%s)... passed\n", operation_names(operation), - TypeManager::name()); return TEST_PASS; } }; template struct SCEX_NU { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + std::string func_name = (test_params.all_work_item_masks.size() > 0 + ? "sub_group_non_uniform_scan_exclusive" + : "sub_group_scan_exclusive"); + log_info(" %s_%s(%s)...%s\n", func_name.c_str(), + operation_names(operation), TypeManager::name(), + extra_text); + } + static void gen(Ty *x, Ty *t, cl_int *m, const WorkGroupParams &test_params) { int nw = test_params.local_workgroup_size; int ns = test_params.subgroup_size; int ng = test_params.global_workgroup_size; ng = ng / nw; - std::string func_name; - test_params.work_items_mask.any() - ? func_name = "sub_group_non_uniform_scan_exclusive" - : func_name = "sub_group_scan_exclusive"; - log_info(" %s_%s(%s)...\n", func_name.c_str(), - operation_names(operation), TypeManager::name()); genrand(x, t, m, ns, nw, ng); } @@ -595,11 +606,9 @@ template struct SCEX_NU Ty tr, rr; ng = ng / nw; - std::string func_name; - test_params.work_items_mask.any() - ? func_name = "sub_group_non_uniform_scan_exclusive" - : func_name = "sub_group_scan_exclusive"; - + std::string func_name = (test_params.all_work_item_masks.size() > 0 + ? "sub_group_non_uniform_scan_exclusive" + : "sub_group_scan_exclusive"); // for uniform case take into consideration all workitems if (!work_items_mask.any()) @@ -656,8 +665,6 @@ template struct SCEX_NU m += 4 * nw; } - log_info(" %s_%s(%s)... passed\n", func_name.c_str(), - operation_names(operation), TypeManager::name()); return TEST_PASS; } }; @@ -665,20 +672,24 @@ template struct SCEX_NU // Test for scan inclusive non uniform functions template struct SCIN_NU { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + std::string func_name = (test_params.all_work_item_masks.size() > 0 + ? "sub_group_non_uniform_scan_inclusive" + : "sub_group_scan_inclusive"); + log_info(" %s_%s(%s)...%s\n", func_name.c_str(), + operation_names(operation), TypeManager::name(), + extra_text); + } + static void gen(Ty *x, Ty *t, cl_int *m, const WorkGroupParams &test_params) { int nw = test_params.local_workgroup_size; int ns = test_params.subgroup_size; int ng = test_params.global_workgroup_size; ng = ng / nw; - std::string func_name; - test_params.work_items_mask.any() - ? func_name = "sub_group_non_uniform_scan_inclusive" - : func_name = "sub_group_scan_inclusive"; - genrand(x, t, m, ns, nw, ng); - log_info(" %s_%s(%s)...\n", func_name.c_str(), - operation_names(operation), TypeManager::name()); } static test_status chk(Ty *x, Ty *y, Ty *mx, Ty *my, cl_int *m, @@ -694,10 +705,9 @@ template struct SCIN_NU Ty tr, rr; ng = ng / nw; - std::string func_name; - work_items_mask.any() - ? func_name = "sub_group_non_uniform_scan_inclusive" - : func_name = "sub_group_scan_inclusive"; + std::string func_name = (test_params.all_work_item_masks.size() > 0 + ? "sub_group_non_uniform_scan_inclusive" + : "sub_group_scan_inclusive"); // for uniform case take into consideration all workitems if (!work_items_mask.any()) @@ -771,8 +781,6 @@ template struct SCIN_NU m += 4 * nw; } - log_info(" %s_%s(%s)... passed\n", func_name.c_str(), - operation_names(operation), TypeManager::name()); return TEST_PASS; } }; @@ -780,6 +788,16 @@ template struct SCIN_NU // Test for reduce non uniform functions template struct RED_NU { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + std::string func_name = (test_params.all_work_item_masks.size() > 0 + ? "sub_group_non_uniform_reduce" + : "sub_group_reduce"); + log_info(" %s_%s(%s)...%s\n", func_name.c_str(), + operation_names(operation), TypeManager::name(), + extra_text); + } static void gen(Ty *x, Ty *t, cl_int *m, const WorkGroupParams &test_params) { @@ -787,13 +805,6 @@ template struct RED_NU int ns = test_params.subgroup_size; int ng = test_params.global_workgroup_size; ng = ng / nw; - std::string func_name; - - test_params.work_items_mask.any() - ? func_name = "sub_group_non_uniform_reduce" - : func_name = "sub_group_reduce"; - log_info(" %s_%s(%s)...\n", func_name.c_str(), - operation_names(operation), TypeManager::name()); genrand(x, t, m, ns, nw, ng); } @@ -809,9 +820,9 @@ template struct RED_NU ng = ng / nw; Ty tr, rr; - std::string func_name; - work_items_mask.any() ? func_name = "sub_group_non_uniform_reduce" - : func_name = "sub_group_reduce"; + std::string func_name = (test_params.all_work_item_masks.size() > 0 + ? "sub_group_non_uniform_reduce" + : "sub_group_reduce"); for (k = 0; k < ng; ++k) { @@ -875,8 +886,6 @@ template struct RED_NU m += 4 * nw; } - log_info(" %s_%s(%s)... passed\n", func_name.c_str(), - operation_names(operation), TypeManager::name()); return TEST_PASS; } }; diff --git a/test_conformance/subgroups/subhelpers.h b/test_conformance/subgroups/subhelpers.h index bd4b6d61..30105a57 100644 --- a/test_conformance/subgroups/subhelpers.h +++ b/test_conformance/subgroups/subhelpers.h @@ -1380,23 +1380,45 @@ template struct test const char *kname, const char *src, WorkGroupParams test_params) { + Fns::log_test(test_params, ""); + test_status combined_error = TEST_SKIPPED_ITSELF; for (auto &mask : test_params.all_work_item_masks) { test_params.work_items_mask = mask; - test_status error = run(device, context, queue, num_elements, kname, - src, test_params); + test_status error = do_run(device, context, queue, num_elements, + kname, src, test_params); if (error == TEST_FAIL || (error == TEST_PASS && combined_error != TEST_FAIL)) combined_error = error; } + + if (combined_error == TEST_PASS) + { + Fns::log_test(test_params, " passed"); + } return combined_error; }; - static test_status run(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements, - const char *kname, const char *src, - WorkGroupParams test_params) + static int run(cl_device_id device, cl_context context, + cl_command_queue queue, int num_elements, const char *kname, + const char *src, WorkGroupParams test_params) + { + Fns::log_test(test_params, ""); + + int error = do_run(device, context, queue, num_elements, kname, src, + test_params); + + if (error == TEST_PASS) + { + Fns::log_test(test_params, " passed"); + } + return error; + }; + static test_status do_run(cl_device_id device, cl_context context, + cl_command_queue queue, int num_elements, + const char *kname, const char *src, + WorkGroupParams test_params) { size_t tmp; cl_int error; @@ -1442,16 +1464,14 @@ template struct test log_info("Data type not supported : %s\n", TypeManager::name()); return TEST_SKIPPED_ITSELF; } - else + + if (strstr(TypeManager::name(), "double")) { - if (strstr(TypeManager::name(), "double")) - { - kernel_sstr << "#pragma OPENCL EXTENSION cl_khr_fp64: enable\n"; - } - else if (strstr(TypeManager::name(), "half")) - { - kernel_sstr << "#pragma OPENCL EXTENSION cl_khr_fp16: enable\n"; - } + kernel_sstr << "#pragma OPENCL EXTENSION cl_khr_fp64: enable\n"; + } + else if (strstr(TypeManager::name(), "half")) + { + kernel_sstr << "#pragma OPENCL EXTENSION cl_khr_fp16: enable\n"; } error = clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(platform), diff --git a/test_conformance/subgroups/test_barrier.cpp b/test_conformance/subgroups/test_barrier.cpp index b570e922..d415eefb 100644 --- a/test_conformance/subgroups/test_barrier.cpp +++ b/test_conformance/subgroups/test_barrier.cpp @@ -59,6 +59,17 @@ static const char *gbar_source = // barrier test functions template struct BAR { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + if (Which == 0) + log_info(" sub_group_barrier(CLK_LOCAL_MEM_FENCE)...%s\n", + extra_text); + else + log_info(" sub_group_barrier(CLK_GLOBAL_MEM_FENCE)...%s\n", + extra_text); + } + static void gen(cl_int *x, cl_int *t, cl_int *m, const WorkGroupParams &test_params) { @@ -103,11 +114,6 @@ template struct BAR ng = ng / nw; cl_int tr, rr; - if (Which == 0) - log_info(" sub_group_barrier(CLK_LOCAL_MEM_FENCE)...\n"); - else - log_info(" sub_group_barrier(CLK_GLOBAL_MEM_FENCE)...\n"); - for (k = 0; k < ng; ++k) { // Map to array indexed to array indexed by local ID and sub group diff --git a/test_conformance/subgroups/test_ifp.cpp b/test_conformance/subgroups/test_ifp.cpp index f6c5227d..f2bd5b92 100644 --- a/test_conformance/subgroups/test_ifp.cpp +++ b/test_conformance/subgroups/test_ifp.cpp @@ -225,6 +225,12 @@ void run_insts(cl_int *x, cl_int *p, int n) struct IFP { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + log_info(" independent forward progress...%s\n", extra_text); + } + static void gen(cl_int *x, cl_int *t, cl_int *, const WorkGroupParams &test_params) { @@ -258,8 +264,6 @@ struct IFP // We need at least 2 sub groups per group for this test if (nj == 1) return TEST_SKIPPED_ITSELF; - log_info(" independent forward progress...\n"); - for (k = 0; k < ng; ++k) { run_insts(x, t, nj); diff --git a/test_conformance/subgroups/test_subgroup.cpp b/test_conformance/subgroups/test_subgroup.cpp index eefca5f8..aa9b32cb 100644 --- a/test_conformance/subgroups/test_subgroup.cpp +++ b/test_conformance/subgroups/test_subgroup.cpp @@ -24,6 +24,13 @@ namespace { // Any/All test functions template struct AA { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + log_info(" sub_group_%s...%s\n", operation_names(operation), + extra_text); + } + static void gen(cl_int *x, cl_int *t, cl_int *m, const WorkGroupParams &test_params) { @@ -35,7 +42,6 @@ template struct AA int e; ng = ng / nw; ii = 0; - log_info(" sub_group_%s...\n", operation_names(operation)); for (k = 0; k < ng; ++k) { for (j = 0; j < nj; ++j) @@ -124,7 +130,6 @@ template struct AA y += nw; m += 4 * nw; } - log_info(" sub_group_%s... passed\n", operation_names(operation)); return TEST_PASS; } }; diff --git a/test_conformance/subgroups/test_subgroup_ballot.cpp b/test_conformance/subgroups/test_subgroup_ballot.cpp index e742aa3b..837988ea 100644 --- a/test_conformance/subgroups/test_subgroup_ballot.cpp +++ b/test_conformance/subgroups/test_subgroup_ballot.cpp @@ -23,6 +23,12 @@ namespace { // Test for ballot functions template struct BALLOT { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + log_info(" sub_group_ballot...%s\n", extra_text); + } + static void gen(Ty *x, Ty *t, cl_int *m, const WorkGroupParams &test_params) { // no work here @@ -30,7 +36,6 @@ template struct BALLOT int lws = test_params.local_workgroup_size; int sbs = test_params.subgroup_size; int non_uniform_size = gws % lws; - log_info(" sub_group_ballot...\n"); } static test_status chk(Ty *x, Ty *y, Ty *mx, Ty *my, cl_int *m, @@ -92,7 +97,6 @@ template struct BALLOT y += lws; m += 4 * lws; } - log_info(" sub_group_ballot... passed\n"); return TEST_PASS; } }; @@ -100,6 +104,13 @@ template struct BALLOT // Test for bit extract ballot functions template struct BALLOT_BIT_EXTRACT { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + log_info(" sub_group_ballot_%s(%s)...%s\n", operation_names(operation), + TypeManager::name(), extra_text); + } + static void gen(Ty *x, Ty *t, cl_int *m, const WorkGroupParams &test_params) { int wi_id, sb_id, wg_id, l; @@ -110,8 +121,6 @@ template struct BALLOT_BIT_EXTRACT int wg_number = gws / lws; int limit_sbs = sbs > 100 ? 100 : sbs; int non_uniform_size = gws % lws; - log_info(" sub_group_%s(%s)...\n", operation_names(operation), - TypeManager::name()); for (wg_id = 0; wg_id < wg_number; ++wg_id) { // for each work_group @@ -251,21 +260,24 @@ template struct BALLOT_BIT_EXTRACT y += lws; m += 4 * lws; } - log_info(" sub_group_%s(%s)... passed\n", operation_names(operation), - TypeManager::name()); return TEST_PASS; } }; template struct BALLOT_INVERSE { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + log_info(" sub_group_inverse_ballot...%s\n", extra_text); + } + static void gen(Ty *x, Ty *t, cl_int *m, const WorkGroupParams &test_params) { int gws = test_params.global_workgroup_size; int lws = test_params.local_workgroup_size; int sbs = test_params.subgroup_size; int non_uniform_size = gws % lws; - log_info(" sub_group_inverse_ballot...\n"); // no work here } @@ -341,7 +353,6 @@ template struct BALLOT_INVERSE m += 4 * lws; } - log_info(" sub_group_inverse_ballot... passed\n"); return TEST_PASS; } }; @@ -350,6 +361,13 @@ template struct BALLOT_INVERSE // Test for bit count/inclusive and exclusive scan/ find lsb msb ballot function template struct BALLOT_COUNT_SCAN_FIND { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + log_info(" sub_group_%s(%s)...%s\n", operation_names(operation), + TypeManager::name(), extra_text); + } + static void gen(Ty *x, Ty *t, cl_int *m, const WorkGroupParams &test_params) { int wi_id, wg_id, sb_id; @@ -362,8 +380,6 @@ template struct BALLOT_COUNT_SCAN_FIND int last_subgroup_size = 0; int current_sbs = 0; - log_info(" sub_group_%s(%s)...\n", operation_names(operation), - TypeManager::name()); if (non_uniform_size) { wg_number++; @@ -562,8 +578,6 @@ template struct BALLOT_COUNT_SCAN_FIND y += lws; m += 4 * lws; } - log_info(" sub_group_ballot_%s(%s)... passed\n", - operation_names(operation), TypeManager::name()); return TEST_PASS; } }; @@ -571,6 +585,13 @@ template struct BALLOT_COUNT_SCAN_FIND // test mask functions template struct SMASK { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + log_info(" get_sub_group_%s_mask...%s\n", operation_names(operation), + extra_text); + } + static void gen(Ty *x, Ty *t, cl_int *m, const WorkGroupParams &test_params) { int wi_id, wg_id, l, sb_id; @@ -579,7 +600,6 @@ template struct SMASK int sbs = test_params.subgroup_size; int sb_number = (lws + sbs - 1) / sbs; int wg_number = gws / lws; - log_info(" get_sub_group_%s_mask...\n", operation_names(operation)); for (wg_id = 0; wg_id < wg_number; ++wg_id) { // for each work_group for (sb_id = 0; sb_id < sb_number; ++sb_id) @@ -655,8 +675,6 @@ template struct SMASK y += lws; m += 4 * lws; } - log_info(" get_sub_group_%s_mask... passed\n", - operation_names(operation)); return TEST_PASS; } }; diff --git a/test_conformance/subgroups/test_subgroup_clustered_reduce.cpp b/test_conformance/subgroups/test_subgroup_clustered_reduce.cpp index ad9e1ff2..f5872006 100644 --- a/test_conformance/subgroups/test_subgroup_clustered_reduce.cpp +++ b/test_conformance/subgroups/test_subgroup_clustered_reduce.cpp @@ -38,15 +38,20 @@ __kernel void test_%s(const __global Type *in, __global int4 *xy, __global Type // Test for reduce cluster functions template struct RED_CLU { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + log_info(" sub_group_clustered_reduce_%s(%s, %d bytes) ...%s\n", + operation_names(operation), TypeManager::name(), + sizeof(Ty), extra_text); + } + static void gen(Ty *x, Ty *t, cl_int *m, const WorkGroupParams &test_params) { int nw = test_params.local_workgroup_size; int ns = test_params.subgroup_size; int ng = test_params.global_workgroup_size; ng = ng / nw; - log_info(" sub_group_clustered_reduce_%s(%s, %d bytes) ...\n", - operation_names(operation), TypeManager::name(), - sizeof(Ty)); genrand(x, t, m, ns, nw, ng); } @@ -124,9 +129,6 @@ template struct RED_CLU y += nw; m += 4 * nw; } - log_info(" sub_group_clustered_reduce_%s(%s, %d bytes) ... passed\n", - operation_names(operation), TypeManager::name(), - sizeof(Ty)); return TEST_PASS; } }; diff --git a/test_conformance/subgroups/test_subgroup_non_uniform_vote.cpp b/test_conformance/subgroups/test_subgroup_non_uniform_vote.cpp index b21a9f7e..3f0985e2 100644 --- a/test_conformance/subgroups/test_subgroup_non_uniform_vote.cpp +++ b/test_conformance/subgroups/test_subgroup_non_uniform_vote.cpp @@ -22,6 +22,15 @@ namespace { template struct VOTE { + static void log_test(const WorkGroupParams &test_params, + const char *extra_text) + { + log_info(" sub_group_%s%s(%s)...%s\n", + (operation == NonUniformVoteOp::elect) ? "" : "non_uniform_", + operation_names(operation), TypeManager::name(), + extra_text); + } + static void gen(T *x, T *t, cl_int *m, const WorkGroupParams &test_params) { int i, ii, j, k, n; @@ -34,10 +43,6 @@ template struct VOTE int last_subgroup_size = 0; ii = 0; - log_info(" sub_group_%s%s(%s)... \n", - (operation == NonUniformVoteOp::elect) ? "" : "non_uniform_", - operation_names(operation), TypeManager::name()); - if (operation == NonUniformVoteOp::elect) return; for (k = 0; k < ng; ++k) @@ -192,9 +197,6 @@ template struct VOTE m += 4 * nw; } - log_info(" sub_group_%s%s(%s)... passed\n", - (operation == NonUniformVoteOp::elect) ? "" : "non_uniform_", - operation_names(operation), TypeManager::name()); return TEST_PASS; } };