[RFC] Move logic for test registration to the test harness (#2151)

And use in device_timer suite.

Signed-off-by: Kévin Petit <kpet@free.fr>
This commit is contained in:
Kévin Petit
2024-11-26 17:55:09 +00:00
committed by GitHub
parent df5e87bf97
commit 0a1456d8f9
36 changed files with 307 additions and 352 deletions

View File

@@ -81,30 +81,32 @@ int test_selection_merge(cl_device_id deviceID,
return 0;
}
#define TEST_LOOP_BRANCH(control) \
TEST_SPIRV_FUNC(op_loop_merge_branch_##control) \
{ \
const int num = 1 << 10; \
RandomSeed seed(gRandomSeed); \
\
int rep = 4; \
std::vector<cl_int> in(rep * num); \
std::vector<cl_int> out(num); \
\
for (int i = 0; i < num; i++) { \
int res = 0; \
for (int j = 0; j < rep; j++) { \
cl_int val = genrand<cl_int>(seed) % 1024; \
res += val; \
in[j * num + i] = val; \
} \
out[i] = res; \
} \
\
return test_selection_merge(deviceID, context, queue, \
"loop_merge_branch_" #control, \
in, out, rep); \
} \
#define TEST_LOOP_BRANCH(control) \
REGISTER_TEST(op_loop_merge_branch_##control) \
{ \
const int num = 1 << 10; \
RandomSeed seed(gRandomSeed); \
\
int rep = 4; \
std::vector<cl_int> in(rep *num); \
std::vector<cl_int> out(num); \
\
for (int i = 0; i < num; i++) \
{ \
int res = 0; \
for (int j = 0; j < rep; j++) \
{ \
cl_int val = genrand<cl_int>(seed) % 1024; \
res += val; \
in[j * num + i] = val; \
} \
out[i] = res; \
} \
\
return test_selection_merge(deviceID, context, queue, \
"loop_merge_branch_" #control, in, out, \
rep); \
}
TEST_LOOP_BRANCH(none)
TEST_LOOP_BRANCH(unroll)