[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

@@ -64,14 +64,13 @@ int test_constant(cl_device_id deviceID, cl_context context,
return 0;
}
#define TEST_CONSTANT(NAME, type, value) \
TEST_SPIRV_FUNC(op_constant_##NAME##_simple) \
{ \
std::vector<type> results(1024, (type)value); \
return test_constant(deviceID, context, queue, \
"constant_" #NAME "_simple", \
results); \
} \
#define TEST_CONSTANT(NAME, type, value) \
REGISTER_TEST(op_constant_##NAME##_simple) \
{ \
std::vector<type> results(1024, (type)value); \
return test_constant(deviceID, context, queue, \
"constant_" #NAME "_simple", results); \
}
// Boolean tests
TEST_CONSTANT(true , cl_int , 1 )
@@ -98,14 +97,14 @@ TEST_CONSTANT(short , cl_short , 32000 )
TEST_CONSTANT(float , cl_float , 3.1415927 )
TEST_CONSTANT(double , cl_double , 3.141592653589793)
TEST_SPIRV_FUNC(op_constant_int4_simple)
REGISTER_TEST(op_constant_int4_simple)
{
cl_int4 value = { { 123, 122, 121, 119 } };
std::vector<cl_int4> results(256, value);
return test_constant(deviceID, context, queue, "constant_int4_simple", results);
}
TEST_SPIRV_FUNC(op_constant_int3_simple)
REGISTER_TEST(op_constant_int3_simple)
{
cl_int3 value = { { 123, 122, 121, 0 } };
std::vector<cl_int3> results(256, value);
@@ -113,21 +112,21 @@ TEST_SPIRV_FUNC(op_constant_int3_simple)
results, isVectorNotEqual<cl_int3, 3>);
}
TEST_SPIRV_FUNC(op_constant_struct_int_float_simple)
REGISTER_TEST(op_constant_struct_int_float_simple)
{
AbstractStruct2<int, float> value = {1024, 3.1415};
std::vector<AbstractStruct2<int, float> > results(256, value);
return test_constant(deviceID, context, queue, "constant_struct_int_float_simple", results);
}
TEST_SPIRV_FUNC(op_constant_struct_int_char_simple)
REGISTER_TEST(op_constant_struct_int_char_simple)
{
AbstractStruct2<int, char> value = { 2100483600, (char)128 };
std::vector<AbstractStruct2<int, char> > results(256, value);
return test_constant(deviceID, context, queue, "constant_struct_int_char_simple", results);
}
TEST_SPIRV_FUNC(op_constant_struct_struct_simple)
REGISTER_TEST(op_constant_struct_struct_simple)
{
typedef AbstractStruct2<int, char> CustomType1;
typedef AbstractStruct2<cl_int2, CustomType1> CustomType2;
@@ -140,7 +139,7 @@ TEST_SPIRV_FUNC(op_constant_struct_struct_simple)
return test_constant(deviceID, context, queue, "constant_struct_struct_simple", results);
}
TEST_SPIRV_FUNC(op_constant_half_simple)
REGISTER_TEST(op_constant_half_simple)
{
PASSIVE_REQUIRE_FP16_SUPPORT(deviceID);
std::vector<cl_float> results(1024, 3.25);