mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Migrate commonfns suite to new test registration framework (#2197)
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "procs.h"
|
||||
#include "test_base.h"
|
||||
#include "harness/kernelHelpers.h"
|
||||
|
||||
@@ -36,17 +35,6 @@ static void initVecSizes() {
|
||||
}
|
||||
}
|
||||
|
||||
test_definition test_list[] = {
|
||||
ADD_TEST(clamp), ADD_TEST(degrees), ADD_TEST(fmax),
|
||||
ADD_TEST(fmaxf), ADD_TEST(fmin), ADD_TEST(fminf),
|
||||
ADD_TEST(max), ADD_TEST(maxf), ADD_TEST(min),
|
||||
ADD_TEST(minf), ADD_TEST(mix), ADD_TEST(mixf),
|
||||
ADD_TEST(radians), ADD_TEST(step), ADD_TEST(stepf),
|
||||
ADD_TEST(smoothstep), ADD_TEST(smoothstepf), ADD_TEST(sign),
|
||||
};
|
||||
|
||||
const int test_num = ARRAY_SIZE( test_list );
|
||||
|
||||
test_status InitCL(cl_device_id device)
|
||||
{
|
||||
if (is_extension_available(device, "cl_khr_fp16"))
|
||||
@@ -79,6 +67,7 @@ int main(int argc, const char *argv[])
|
||||
BaseFunctionTest::type2name[sizeof(float)] = "float";
|
||||
BaseFunctionTest::type2name[sizeof(double)] = "double";
|
||||
|
||||
return runTestHarnessWithCheck(argc, argv, test_num, test_list, false, 0,
|
||||
InitCL);
|
||||
return runTestHarnessWithCheck(
|
||||
argc, argv, test_registry::getInstance().num_tests(),
|
||||
test_registry::getInstance().definitions(), false, 0, InitCL);
|
||||
}
|
||||
|
||||
@@ -1,49 +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/testHarness.h"
|
||||
#include "harness/kernelHelpers.h"
|
||||
#include "harness/errorHelpers.h"
|
||||
#include "harness/conversions.h"
|
||||
#include "harness/mt19937.h"
|
||||
|
||||
#define kVectorSizeCount 5
|
||||
#define kStrangeVectorSizeCount 1
|
||||
#define kTotalVecCount (kVectorSizeCount + kStrangeVectorSizeCount)
|
||||
|
||||
extern int g_arrVecSizes[kVectorSizeCount + kStrangeVectorSizeCount];
|
||||
// int g_arrStrangeVectorSizes[kStrangeVectorSizeCount] = {3};
|
||||
|
||||
extern int test_clamp(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_degrees(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_fmax(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_fmaxf(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_fmin(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_fminf(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_max(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_maxf(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_min(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_minf(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_mix(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_mixf(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
extern int test_radians(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_step(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_stepf(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_smoothstep(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_smoothstepf(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_sign(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
|
||||
|
||||
@@ -24,9 +24,17 @@
|
||||
#include <CL/cl_half.h>
|
||||
#include <CL/cl_ext.h>
|
||||
|
||||
#include "harness/conversions.h"
|
||||
#include "harness/mt19937.h"
|
||||
#include "harness/testHarness.h"
|
||||
#include "harness/typeWrappers.h"
|
||||
|
||||
#define kVectorSizeCount 5
|
||||
#define kStrangeVectorSizeCount 1
|
||||
#define kTotalVecCount (kVectorSizeCount + kStrangeVectorSizeCount)
|
||||
|
||||
extern int g_arrVecSizes[kVectorSizeCount + kStrangeVectorSizeCount];
|
||||
|
||||
template <typename T>
|
||||
using VerifyFuncBinary = int (*)(const T *const, const T *const, const T *const,
|
||||
const int num, const int vs, const int vp);
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "harness/typeWrappers.h"
|
||||
#include "harness/stringHelpers.h"
|
||||
|
||||
#include "procs.h"
|
||||
#include "test_base.h"
|
||||
|
||||
const char *binary_fn_code_pattern =
|
||||
@@ -319,58 +318,50 @@ cl_int MinTest::Run()
|
||||
return error;
|
||||
}
|
||||
|
||||
int test_min(cl_device_id device, cl_context context, cl_command_queue queue,
|
||||
int n_elems)
|
||||
REGISTER_TEST(min)
|
||||
{
|
||||
return MakeAndRunTest<MinTest>(device, context, queue, n_elems, "min",
|
||||
return MakeAndRunTest<MinTest>(device, context, queue, num_elements, "min",
|
||||
true);
|
||||
}
|
||||
|
||||
int test_minf(cl_device_id device, cl_context context, cl_command_queue queue,
|
||||
int n_elems)
|
||||
REGISTER_TEST(minf)
|
||||
{
|
||||
return MakeAndRunTest<MinTest>(device, context, queue, n_elems, "min",
|
||||
return MakeAndRunTest<MinTest>(device, context, queue, num_elements, "min",
|
||||
false);
|
||||
}
|
||||
|
||||
int test_fmin(cl_device_id device, cl_context context, cl_command_queue queue,
|
||||
int n_elems)
|
||||
REGISTER_TEST(fmin)
|
||||
{
|
||||
return MakeAndRunTest<MinTest>(device, context, queue, n_elems, "fmin",
|
||||
return MakeAndRunTest<MinTest>(device, context, queue, num_elements, "fmin",
|
||||
true);
|
||||
}
|
||||
|
||||
int test_fminf(cl_device_id device, cl_context context, cl_command_queue queue,
|
||||
int n_elems)
|
||||
REGISTER_TEST(fminf)
|
||||
{
|
||||
return MakeAndRunTest<MinTest>(device, context, queue, n_elems, "fmin",
|
||||
return MakeAndRunTest<MinTest>(device, context, queue, num_elements, "fmin",
|
||||
false);
|
||||
}
|
||||
|
||||
int test_max(cl_device_id device, cl_context context, cl_command_queue queue,
|
||||
int n_elems)
|
||||
REGISTER_TEST(max)
|
||||
{
|
||||
return MakeAndRunTest<MaxTest>(device, context, queue, n_elems, "max",
|
||||
return MakeAndRunTest<MaxTest>(device, context, queue, num_elements, "max",
|
||||
true);
|
||||
}
|
||||
|
||||
int test_maxf(cl_device_id device, cl_context context, cl_command_queue queue,
|
||||
int n_elems)
|
||||
REGISTER_TEST(maxf)
|
||||
{
|
||||
return MakeAndRunTest<MaxTest>(device, context, queue, n_elems, "max",
|
||||
return MakeAndRunTest<MaxTest>(device, context, queue, num_elements, "max",
|
||||
false);
|
||||
}
|
||||
|
||||
int test_fmax(cl_device_id device, cl_context context, cl_command_queue queue,
|
||||
int n_elems)
|
||||
REGISTER_TEST(fmax)
|
||||
{
|
||||
return MakeAndRunTest<MaxTest>(device, context, queue, n_elems, "fmax",
|
||||
return MakeAndRunTest<MaxTest>(device, context, queue, num_elements, "fmax",
|
||||
true);
|
||||
}
|
||||
|
||||
int test_fmaxf(cl_device_id device, cl_context context, cl_command_queue queue,
|
||||
int n_elems)
|
||||
REGISTER_TEST(fmaxf)
|
||||
{
|
||||
return MakeAndRunTest<MaxTest>(device, context, queue, n_elems, "fmax",
|
||||
return MakeAndRunTest<MaxTest>(device, context, queue, num_elements, "fmax",
|
||||
false);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "harness/deviceInfo.h"
|
||||
#include "harness/typeWrappers.h"
|
||||
|
||||
#include "procs.h"
|
||||
#include "test_base.h"
|
||||
|
||||
#ifndef M_PI
|
||||
@@ -308,8 +307,7 @@ cl_int ClampTest::Run()
|
||||
return error;
|
||||
}
|
||||
|
||||
int test_clamp(cl_device_id device, cl_context context, cl_command_queue queue,
|
||||
int n_elems)
|
||||
REGISTER_TEST(clamp)
|
||||
{
|
||||
return MakeAndRunTest<ClampTest>(device, context, queue, n_elems);
|
||||
return MakeAndRunTest<ClampTest>(device, context, queue, num_elements);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "harness/stringHelpers.h"
|
||||
|
||||
#include "procs.h"
|
||||
#include "test_base.h"
|
||||
|
||||
|
||||
@@ -302,16 +301,14 @@ cl_int MixTest::Run()
|
||||
return error;
|
||||
}
|
||||
|
||||
int test_mix(cl_device_id device, cl_context context, cl_command_queue queue,
|
||||
int n_elems)
|
||||
REGISTER_TEST(mix)
|
||||
{
|
||||
return MakeAndRunTest<MixTest>(device, context, queue, n_elems, "mix",
|
||||
return MakeAndRunTest<MixTest>(device, context, queue, num_elements, "mix",
|
||||
true);
|
||||
}
|
||||
|
||||
int test_mixf(cl_device_id device, cl_context context, cl_command_queue queue,
|
||||
int n_elems)
|
||||
REGISTER_TEST(mixf)
|
||||
{
|
||||
return MakeAndRunTest<MixTest>(device, context, queue, n_elems, "mix",
|
||||
return MakeAndRunTest<MixTest>(device, context, queue, num_elements, "mix",
|
||||
false);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "harness/stringHelpers.h"
|
||||
|
||||
#include "procs.h"
|
||||
#include "test_base.h"
|
||||
|
||||
const char *smoothstep_fn_code_pattern =
|
||||
@@ -317,16 +316,14 @@ cl_int SmoothstepTest::Run()
|
||||
return error;
|
||||
}
|
||||
|
||||
int test_smoothstep(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue, int n_elems)
|
||||
REGISTER_TEST(smoothstep)
|
||||
{
|
||||
return MakeAndRunTest<SmoothstepTest>(device, context, queue, n_elems,
|
||||
return MakeAndRunTest<SmoothstepTest>(device, context, queue, num_elements,
|
||||
"smoothstep", true);
|
||||
}
|
||||
|
||||
int test_smoothstepf(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue, int n_elems)
|
||||
REGISTER_TEST(smoothstepf)
|
||||
{
|
||||
return MakeAndRunTest<SmoothstepTest>(device, context, queue, n_elems,
|
||||
return MakeAndRunTest<SmoothstepTest>(device, context, queue, num_elements,
|
||||
"smoothstep", false);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "harness/stringHelpers.h"
|
||||
|
||||
#include "procs.h"
|
||||
#include "test_base.h"
|
||||
|
||||
const char *step_fn_code_pattern = "%s\n" /* optional pragma */
|
||||
@@ -268,16 +267,14 @@ cl_int StepTest::Run()
|
||||
return error;
|
||||
}
|
||||
|
||||
int test_step(cl_device_id device, cl_context context, cl_command_queue queue,
|
||||
int n_elems)
|
||||
REGISTER_TEST(step)
|
||||
{
|
||||
return MakeAndRunTest<StepTest>(device, context, queue, n_elems, "step",
|
||||
true);
|
||||
return MakeAndRunTest<StepTest>(device, context, queue, num_elements,
|
||||
"step", true);
|
||||
}
|
||||
|
||||
int test_stepf(cl_device_id device, cl_context context, cl_command_queue queue,
|
||||
int n_elems)
|
||||
REGISTER_TEST(stepf)
|
||||
{
|
||||
return MakeAndRunTest<StepTest>(device, context, queue, n_elems, "step",
|
||||
false);
|
||||
return MakeAndRunTest<StepTest>(device, context, queue, num_elements,
|
||||
"step", false);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "harness/stringHelpers.h"
|
||||
#include "harness/typeWrappers.h"
|
||||
|
||||
#include "procs.h"
|
||||
#include "test_base.h"
|
||||
|
||||
#ifndef M_PI
|
||||
@@ -385,22 +384,20 @@ cl_int SignTest::Run()
|
||||
return error;
|
||||
}
|
||||
|
||||
int test_degrees(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue, int n_elems)
|
||||
REGISTER_TEST(degrees)
|
||||
{
|
||||
return MakeAndRunTest<DegreesTest>(device, context, queue, n_elems,
|
||||
return MakeAndRunTest<DegreesTest>(device, context, queue, num_elements,
|
||||
"degrees");
|
||||
}
|
||||
|
||||
int test_radians(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue, int n_elems)
|
||||
REGISTER_TEST(radians)
|
||||
{
|
||||
return MakeAndRunTest<RadiansTest>(device, context, queue, n_elems,
|
||||
return MakeAndRunTest<RadiansTest>(device, context, queue, num_elements,
|
||||
"radians");
|
||||
}
|
||||
|
||||
int test_sign(cl_device_id device, cl_context context, cl_command_queue queue,
|
||||
int n_elems)
|
||||
REGISTER_TEST(sign)
|
||||
{
|
||||
return MakeAndRunTest<SignTest>(device, context, queue, n_elems, "sign");
|
||||
return MakeAndRunTest<SignTest>(device, context, queue, num_elements,
|
||||
"sign");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user