Migrate half suite to the new test registration framework (#2329)

Contributes to #2181.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
This commit is contained in:
Ahmed Hesham
2025-03-11 22:00:23 +00:00
committed by GitHub
parent ba95285a0e
commit 641ffeaa67
4 changed files with 32 additions and 67 deletions

View File

@@ -22,7 +22,7 @@
#include "tests.h"
#include "harness/testHarness.h"
int test_roundTrip( cl_device_id device, cl_context context, cl_command_queue queue, int num_elements )
REGISTER_TEST(roundTrip)
{
int vectorSize, error;
uint64_t i, j;
@@ -400,5 +400,3 @@ exit:
return error;
}

View File

@@ -604,13 +604,6 @@ exit:
return error;
}
int test_vload_half( cl_device_id device, cl_context context, cl_command_queue queue, int num_elements )
{
return Test_vLoadHalf_private( device, false );
}
int test_vloada_half( cl_device_id device, cl_context context, cl_command_queue queue, int num_elements )
{
return Test_vLoadHalf_private( device, true );
}
REGISTER_TEST(vload_half) { return Test_vLoadHalf_private(device, false); }
REGISTER_TEST(vloada_half) { return Test_vLoadHalf_private(device, true); }

View File

@@ -247,89 +247,79 @@ static cl_half double2half_rtn(double f)
return cl_half_from_double(f, CL_HALF_RTN);
}
int test_vstore_half(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vstore_half)
{
switch (get_default_rounding_mode(deviceID))
switch (get_default_rounding_mode(device))
{
case CL_FP_ROUND_TO_ZERO:
return Test_vStoreHalf_private(deviceID, float2half_rtz,
return Test_vStoreHalf_private(device, float2half_rtz,
double2half_rte, "");
case 0: return -1;
default:
return Test_vStoreHalf_private(deviceID, float2half_rte,
return Test_vStoreHalf_private(device, float2half_rte,
double2half_rte, "");
}
}
int test_vstore_half_rte(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vstore_half_rte)
{
return Test_vStoreHalf_private(deviceID, float2half_rte, double2half_rte,
return Test_vStoreHalf_private(device, float2half_rte, double2half_rte,
"_rte");
}
int test_vstore_half_rtz(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vstore_half_rtz)
{
return Test_vStoreHalf_private(deviceID, float2half_rtz, double2half_rtz,
return Test_vStoreHalf_private(device, float2half_rtz, double2half_rtz,
"_rtz");
}
int test_vstore_half_rtp(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vstore_half_rtp)
{
return Test_vStoreHalf_private(deviceID, float2half_rtp, double2half_rtp,
return Test_vStoreHalf_private(device, float2half_rtp, double2half_rtp,
"_rtp");
}
int test_vstore_half_rtn(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vstore_half_rtn)
{
return Test_vStoreHalf_private(deviceID, float2half_rtn, double2half_rtn,
return Test_vStoreHalf_private(device, float2half_rtn, double2half_rtn,
"_rtn");
}
int test_vstorea_half(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vstorea_half)
{
switch (get_default_rounding_mode(deviceID))
switch (get_default_rounding_mode(device))
{
case CL_FP_ROUND_TO_ZERO:
return Test_vStoreaHalf_private(deviceID, float2half_rtz,
return Test_vStoreaHalf_private(device, float2half_rtz,
double2half_rte, "");
case 0: return -1;
default:
return Test_vStoreaHalf_private(deviceID, float2half_rte,
return Test_vStoreaHalf_private(device, float2half_rte,
double2half_rte, "");
}
}
int test_vstorea_half_rte(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vstorea_half_rte)
{
return Test_vStoreaHalf_private(deviceID, float2half_rte, double2half_rte,
return Test_vStoreaHalf_private(device, float2half_rte, double2half_rte,
"_rte");
}
int test_vstorea_half_rtz(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vstorea_half_rtz)
{
return Test_vStoreaHalf_private(deviceID, float2half_rtz, double2half_rtz,
return Test_vStoreaHalf_private(device, float2half_rtz, double2half_rtz,
"_rtz");
}
int test_vstorea_half_rtp(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vstorea_half_rtp)
{
return Test_vStoreaHalf_private(deviceID, float2half_rtp, double2half_rtp,
return Test_vStoreaHalf_private(device, float2half_rtp, double2half_rtp,
"_rtp");
}
int test_vstorea_half_rtn(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vstorea_half_rtn)
{
return Test_vStoreaHalf_private(deviceID, float2half_rtn, double2half_rtn,
return Test_vStoreaHalf_private(device, float2half_rtn, double2half_rtn,
"_rtn");
}

View File

@@ -53,24 +53,6 @@ int g_arrVecSizes[kVectorSizeCount+kStrangeVectorSizeCount];
int g_arrVecAligns[kLargestVectorSize+1];
static int arrStrangeVecSizes[kStrangeVectorSizeCount] = {3};
test_definition test_list[] = {
ADD_TEST( vload_half ),
ADD_TEST( vloada_half ),
ADD_TEST( vstore_half ),
ADD_TEST( vstorea_half ),
ADD_TEST( vstore_half_rte ),
ADD_TEST( vstorea_half_rte ),
ADD_TEST( vstore_half_rtz ),
ADD_TEST( vstorea_half_rtz ),
ADD_TEST( vstore_half_rtp ),
ADD_TEST( vstorea_half_rtp ),
ADD_TEST( vstore_half_rtn ),
ADD_TEST( vstorea_half_rtn ),
ADD_TEST( roundTrip ),
};
const int test_num = ARRAY_SIZE( test_list );
int main (int argc, const char **argv )
{
int error;
@@ -109,7 +91,9 @@ int main (int argc, const char **argv )
}
fflush( stdout );
error = runTestHarnessWithCheck( argCount, argList, test_num, test_list, true, 0, InitCL );
error = runTestHarnessWithCheck(
argCount, argList, test_registry::getInstance().num_tests(),
test_registry::getInstance().definitions(), true, 0, InitCL);
exit:
if(gQueue)
@@ -248,8 +232,8 @@ static void PrintUsage( void )
"1-12, default factor(%u)\n",
gWimpyReductionFactor);
vlog("\t\t-h\tHelp\n");
for (int i = 0; i < test_num; i++)
for (size_t i = 0; i < test_registry::getInstance().num_tests(); i++)
{
vlog("\t\t%s\n", test_list[i].name );
vlog("\t\t%s\n", test_registry::getInstance().definitions()[i].name);
}
}