mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Migrate relationals suite to the new test registration framework (#2312)
Contributes to #2181. Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
This commit is contained in:
@@ -14,15 +14,9 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
#include "harness/compat.h"
|
#include "harness/compat.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "procs.h"
|
|
||||||
#include "harness/testHarness.h"
|
#include "harness/testHarness.h"
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#include "testBase.h"
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if DENSE_PACK_VECS
|
#if DENSE_PACK_VECS
|
||||||
const int g_vector_aligns[] = {0, 1, 2, 3, 4,
|
const int g_vector_aligns[] = {0, 1, 2, 3, 4,
|
||||||
@@ -44,32 +38,9 @@ const int g_vector_allocs[] = {0, 1, 2, 4, 4,
|
|||||||
16, 16, 16, 16};
|
16, 16, 16, 16};
|
||||||
|
|
||||||
|
|
||||||
test_definition test_list[] = {
|
|
||||||
ADD_TEST( relational_any ),
|
|
||||||
ADD_TEST( relational_all ),
|
|
||||||
ADD_TEST( relational_bitselect ),
|
|
||||||
ADD_TEST( relational_select_signed ),
|
|
||||||
ADD_TEST( relational_select_unsigned ),
|
|
||||||
|
|
||||||
ADD_TEST( relational_isequal ),
|
|
||||||
ADD_TEST( relational_isnotequal ),
|
|
||||||
ADD_TEST( relational_isgreater ),
|
|
||||||
ADD_TEST( relational_isgreaterequal ),
|
|
||||||
ADD_TEST( relational_isless ),
|
|
||||||
ADD_TEST( relational_islessequal ),
|
|
||||||
ADD_TEST( relational_islessgreater ),
|
|
||||||
|
|
||||||
ADD_TEST( shuffle_copy ),
|
|
||||||
ADD_TEST( shuffle_function_call ),
|
|
||||||
ADD_TEST( shuffle_array_cast ),
|
|
||||||
ADD_TEST( shuffle_built_in ),
|
|
||||||
ADD_TEST( shuffle_built_in_dual_input ),
|
|
||||||
};
|
|
||||||
|
|
||||||
const int test_num = ARRAY_SIZE( test_list );
|
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
int main(int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
return runTestHarness(argc, argv, test_num, test_list, false, 0);
|
return runTestHarness(argc, argv, test_registry::getInstance().num_tests(),
|
||||||
|
test_registry::getInstance().definitions(), false, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
//
|
|
||||||
// Copyright (c) 2017 The Khronos Group Inc.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
//
|
|
||||||
#include "harness/errorHelpers.h"
|
|
||||||
#include "harness/kernelHelpers.h"
|
|
||||||
#include "harness/typeWrappers.h"
|
|
||||||
#include "harness/conversions.h"
|
|
||||||
#include "harness/mt19937.h"
|
|
||||||
|
|
||||||
// The number of errors to print out for each test in the shuffle tests
|
|
||||||
#define MAX_ERRORS_TO_PRINT 1
|
|
||||||
|
|
||||||
extern const int g_vector_aligns[];
|
|
||||||
extern const int g_vector_allocs[];
|
|
||||||
|
|
||||||
#define DENSE_PACK_VECS 1
|
|
||||||
|
|
||||||
extern int create_program_and_kernel(const char *source, const char *kernel_name, cl_program *program_ret, cl_kernel *kernel_ret);
|
|
||||||
|
|
||||||
extern int test_relational_any(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_relational_all(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_relational_bitselect(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_relational_select_signed(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_relational_select_unsigned(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
|
|
||||||
extern int test_relational_isequal(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_relational_isnotequal(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_relational_isgreater(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_relational_isgreaterequal(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_relational_isless(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_relational_islessequal(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_relational_islessgreater(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
|
|
||||||
extern int test_shuffles(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_shuffles_16(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_shuffles_dual(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_shuffle_copy(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_shuffle_function_call(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_shuffle_array_cast(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_shuffle_built_in(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_shuffle_built_in_dual_input(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2017 The Khronos Group Inc.
|
// Copyright (c) 2017 The Khronos Group Inc.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
@@ -17,15 +17,21 @@
|
|||||||
#define _testBase_h
|
#define _testBase_h
|
||||||
|
|
||||||
#include "harness/compat.h"
|
#include "harness/compat.h"
|
||||||
|
#include "harness/testHarness.h"
|
||||||
|
#include "harness/typeWrappers.h"
|
||||||
|
#include "harness/conversions.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "procs.h"
|
// The number of errors to print out for each test in the shuffle tests
|
||||||
|
#define MAX_ERRORS_TO_PRINT 1
|
||||||
|
|
||||||
|
extern const int g_vector_aligns[];
|
||||||
|
extern const int g_vector_allocs[];
|
||||||
|
|
||||||
|
#define DENSE_PACK_VECS 1
|
||||||
|
|
||||||
#endif // _testBase_h
|
#endif // _testBase_h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -596,48 +596,42 @@ cl_int IsLessGreaterFPTest::SetUp(int elements)
|
|||||||
return RelationalsFPTest::SetUp(elements);
|
return RelationalsFPTest::SetUp(elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_relational_isequal(cl_device_id device, cl_context context,
|
REGISTER_TEST(relational_isequal)
|
||||||
cl_command_queue queue, int numElements)
|
|
||||||
{
|
{
|
||||||
return MakeAndRunTest<IsEqualFPTest>(device, context, queue, numElements);
|
return MakeAndRunTest<IsEqualFPTest>(device, context, queue, num_elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_relational_isnotequal(cl_device_id device, cl_context context,
|
REGISTER_TEST(relational_isnotequal)
|
||||||
cl_command_queue queue, int numElements)
|
|
||||||
{
|
{
|
||||||
return MakeAndRunTest<IsNotEqualFPTest>(device, context, queue,
|
return MakeAndRunTest<IsNotEqualFPTest>(device, context, queue,
|
||||||
numElements);
|
num_elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_relational_isgreater(cl_device_id device, cl_context context,
|
REGISTER_TEST(relational_isgreater)
|
||||||
cl_command_queue queue, int numElements)
|
|
||||||
{
|
{
|
||||||
return MakeAndRunTest<IsGreaterFPTest>(device, context, queue, numElements);
|
return MakeAndRunTest<IsGreaterFPTest>(device, context, queue,
|
||||||
|
num_elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_relational_isgreaterequal(cl_device_id device, cl_context context,
|
REGISTER_TEST(relational_isgreaterequal)
|
||||||
cl_command_queue queue, int numElements)
|
|
||||||
{
|
{
|
||||||
return MakeAndRunTest<IsGreaterEqualFPTest>(device, context, queue,
|
return MakeAndRunTest<IsGreaterEqualFPTest>(device, context, queue,
|
||||||
numElements);
|
num_elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_relational_isless(cl_device_id device, cl_context context,
|
REGISTER_TEST(relational_isless)
|
||||||
cl_command_queue queue, int numElements)
|
|
||||||
{
|
{
|
||||||
return MakeAndRunTest<IsLessFPTest>(device, context, queue, numElements);
|
return MakeAndRunTest<IsLessFPTest>(device, context, queue, num_elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_relational_islessequal(cl_device_id device, cl_context context,
|
REGISTER_TEST(relational_islessequal)
|
||||||
cl_command_queue queue, int numElements)
|
|
||||||
{
|
{
|
||||||
return MakeAndRunTest<IsLessEqualFPTest>(device, context, queue,
|
return MakeAndRunTest<IsLessEqualFPTest>(device, context, queue,
|
||||||
numElements);
|
num_elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_relational_islessgreater(cl_device_id device, cl_context context,
|
REGISTER_TEST(relational_islessgreater)
|
||||||
cl_command_queue queue, int numElements)
|
|
||||||
{
|
{
|
||||||
return MakeAndRunTest<IsLessGreaterFPTest>(device, context, queue,
|
return MakeAndRunTest<IsLessGreaterFPTest>(device, context, queue,
|
||||||
numElements);
|
num_elements);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ int anyVerifyFn( ExplicitType vecType, unsigned int vecSize, void *inData )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_relational_any(cl_device_id device, cl_context context, cl_command_queue queue, int numElements )
|
REGISTER_TEST(relational_any)
|
||||||
{
|
{
|
||||||
ExplicitType vecType[] = { kChar, kShort, kInt, kLong };
|
ExplicitType vecType[] = { kChar, kShort, kInt, kLong };
|
||||||
unsigned int vecSizes[] = { 1, 2, 3, 4, 8, 16, 0 };
|
unsigned int vecSizes[] = { 1, 2, 3, 4, 8, 16, 0 };
|
||||||
@@ -268,7 +268,7 @@ int allVerifyFn( ExplicitType vecType, unsigned int vecSize, void *inData )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_relational_all(cl_device_id device, cl_context context, cl_command_queue queue, int numElements )
|
REGISTER_TEST(relational_all)
|
||||||
{
|
{
|
||||||
ExplicitType vecType[] = { kChar, kShort, kInt, kLong };
|
ExplicitType vecType[] = { kChar, kShort, kInt, kLong };
|
||||||
unsigned int vecSizes[] = { 1, 2, 3, 4, 8, 16, 0 };
|
unsigned int vecSizes[] = { 1, 2, 3, 4, 8, 16, 0 };
|
||||||
@@ -526,7 +526,7 @@ void bitselect_verify_fn( ExplicitType vecType, ExplicitType testVecType, unsign
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_relational_bitselect(cl_device_id device, cl_context context, cl_command_queue queue, int numElements )
|
REGISTER_TEST(relational_bitselect)
|
||||||
{
|
{
|
||||||
constexpr ExplicitType vecType[] = { kChar, kUChar, kShort, kUShort,
|
constexpr ExplicitType vecType[] = { kChar, kUChar, kShort, kUShort,
|
||||||
kInt, kUInt, kLong, kULong,
|
kInt, kUInt, kLong, kULong,
|
||||||
@@ -626,7 +626,7 @@ void select_signed_verify_fn( ExplicitType vecType, ExplicitType testVecType, un
|
|||||||
memcpy( outData, ( yep ) ? inDataB : inDataA, get_explicit_type_size( vecType ) );
|
memcpy( outData, ( yep ) ? inDataB : inDataA, get_explicit_type_size( vecType ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_relational_select_signed(cl_device_id device, cl_context context, cl_command_queue queue, int numElements )
|
REGISTER_TEST(relational_select_signed)
|
||||||
{
|
{
|
||||||
constexpr ExplicitType vecType[] = { kChar, kUChar, kShort, kUShort,
|
constexpr ExplicitType vecType[] = { kChar, kUChar, kShort, kUShort,
|
||||||
kInt, kUInt, kLong, kULong,
|
kInt, kUInt, kLong, kULong,
|
||||||
@@ -732,7 +732,7 @@ void select_unsigned_verify_fn( ExplicitType vecType, ExplicitType testVecType,
|
|||||||
memcpy( outData, ( yep ) ? inDataB : inDataA, get_explicit_type_size( vecType ) );
|
memcpy( outData, ( yep ) ? inDataB : inDataA, get_explicit_type_size( vecType ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_relational_select_unsigned(cl_device_id device, cl_context context, cl_command_queue queue, int numElements )
|
REGISTER_TEST(relational_select_unsigned)
|
||||||
{
|
{
|
||||||
constexpr ExplicitType vecType[] = { kChar, kUChar, kShort, kUShort,
|
constexpr ExplicitType vecType[] = { kChar, kUChar, kShort, kUShort,
|
||||||
kInt, kUInt, kLong, kULong,
|
kInt, kUInt, kLong, kULong,
|
||||||
|
|||||||
@@ -926,33 +926,32 @@ int test_shuffle_random(cl_device_id device, cl_context context, cl_command_queu
|
|||||||
return totalError;
|
return totalError;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_shuffle_copy(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems)
|
REGISTER_TEST(shuffle_copy)
|
||||||
{
|
{
|
||||||
RandomSeed seed(gRandomSeed);
|
RandomSeed seed(gRandomSeed);
|
||||||
return test_shuffle_random( device, context, queue, kNormalMode, seed );
|
return test_shuffle_random( device, context, queue, kNormalMode, seed );
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_shuffle_function_call(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems)
|
REGISTER_TEST(shuffle_function_call)
|
||||||
{
|
{
|
||||||
RandomSeed seed(gRandomSeed);
|
RandomSeed seed(gRandomSeed);
|
||||||
return test_shuffle_random( device, context, queue, kFunctionCallMode, seed );
|
return test_shuffle_random( device, context, queue, kFunctionCallMode, seed );
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_shuffle_array_cast(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems)
|
REGISTER_TEST(shuffle_array_cast)
|
||||||
{
|
{
|
||||||
RandomSeed seed(gRandomSeed);
|
RandomSeed seed(gRandomSeed);
|
||||||
return test_shuffle_random( device, context, queue, kArrayAccessMode, seed );
|
return test_shuffle_random( device, context, queue, kArrayAccessMode, seed );
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_shuffle_built_in(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems)
|
REGISTER_TEST(shuffle_built_in)
|
||||||
{
|
{
|
||||||
RandomSeed seed(gRandomSeed);
|
RandomSeed seed(gRandomSeed);
|
||||||
return test_shuffle_random( device, context, queue, kBuiltInFnMode, seed );
|
return test_shuffle_random( device, context, queue, kBuiltInFnMode, seed );
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_shuffle_built_in_dual_input(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems)
|
REGISTER_TEST(shuffle_built_in_dual_input)
|
||||||
{
|
{
|
||||||
RandomSeed seed(gRandomSeed);
|
RandomSeed seed(gRandomSeed);
|
||||||
return test_shuffle_random( device, context, queue, kBuiltInDualInputFnMode, seed );
|
return test_shuffle_random( device, context, queue, kBuiltInDualInputFnMode, seed );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user