[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

@@ -150,30 +150,28 @@ int test_fmath(cl_device_id deviceID,
return 0;
}
#define TEST_FMATH_FUNC(TYPE, FUNC, MODE) \
TEST_SPIRV_FUNC(op_##FUNC##_##TYPE##_##MODE) \
{ \
if (sizeof(cl_##TYPE) == 2) { \
PASSIVE_REQUIRE_FP16_SUPPORT(deviceID); \
} \
const int num = 1 << 20; \
std::vector<cl_##TYPE> lhs(num); \
std::vector<cl_##TYPE> rhs(num); \
\
RandomSeed seed(gRandomSeed); \
\
for (int i = 0; i < num; i++) { \
lhs[i] = genrandReal<cl_##TYPE>(seed); \
rhs[i] = genrandReal<cl_##TYPE>(seed); \
} \
\
const char *mode = #MODE; \
return test_fmath(deviceID, context, queue, \
#FUNC "_" #TYPE, \
#FUNC, \
#TYPE, \
mode[0] == 'f', \
lhs, rhs); \
#define TEST_FMATH_FUNC(TYPE, FUNC, MODE) \
REGISTER_TEST(op_##FUNC##_##TYPE##_##MODE) \
{ \
if (sizeof(cl_##TYPE) == 2) \
{ \
PASSIVE_REQUIRE_FP16_SUPPORT(deviceID); \
} \
const int num = 1 << 20; \
std::vector<cl_##TYPE> lhs(num); \
std::vector<cl_##TYPE> rhs(num); \
\
RandomSeed seed(gRandomSeed); \
\
for (int i = 0; i < num; i++) \
{ \
lhs[i] = genrandReal<cl_##TYPE>(seed); \
rhs[i] = genrandReal<cl_##TYPE>(seed); \
} \
\
const char *mode = #MODE; \
return test_fmath(deviceID, context, queue, #FUNC "_" #TYPE, #FUNC, \
#TYPE, mode[0] == 'f', lhs, rhs); \
}
#define TEST_FMATH_MODE(TYPE, MODE) \