Migrate integer_ops suite to the new test registration framework (#2332)

Contributes to https://github.com/KhronosGroup/OpenCL-CTS/issues/2181.

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
This commit is contained in:
Michael Rizkalla
2025-03-23 15:12:34 +00:00
committed by GitHub
parent a9507ce33f
commit e36da9798e
19 changed files with 399 additions and 599 deletions

View File

@@ -17,142 +17,13 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "procs.h"
#include "harness/testHarness.h" #include "harness/testHarness.h"
#include "harness/mt19937.h"
#if !defined(_WIN32) #if !defined(_WIN32)
#include <unistd.h> #include <unistd.h>
#endif #endif
test_definition test_list[] = {
ADD_TEST(integer_clz),
ADD_TEST_VERSION(integer_ctz, Version(2, 0)),
ADD_TEST(integer_hadd),
ADD_TEST(integer_rhadd),
ADD_TEST(integer_mul_hi),
ADD_TEST(integer_rotate),
ADD_TEST(integer_clamp),
ADD_TEST(integer_mad_sat),
ADD_TEST(integer_mad_hi),
ADD_TEST(integer_min),
ADD_TEST(integer_max),
ADD_TEST(integer_upsample),
ADD_TEST(integer_abs),
ADD_TEST(integer_abs_diff),
ADD_TEST(integer_add_sat),
ADD_TEST(integer_sub_sat),
ADD_TEST(integer_addAssign),
ADD_TEST(integer_subtractAssign),
ADD_TEST(integer_multiplyAssign),
ADD_TEST(integer_divideAssign),
ADD_TEST(integer_moduloAssign),
ADD_TEST(integer_andAssign),
ADD_TEST(integer_orAssign),
ADD_TEST(integer_exclusiveOrAssign),
ADD_TEST(unary_ops_increment),
ADD_TEST(unary_ops_decrement),
ADD_TEST(unary_ops_full),
ADD_TEST(integer_mul24),
ADD_TEST(integer_mad24),
ADD_TEST(extended_bit_ops_extract),
ADD_TEST(extended_bit_ops_insert),
ADD_TEST(extended_bit_ops_reverse),
ADD_TEST(long_math),
ADD_TEST(long_logic),
ADD_TEST(long_shift),
ADD_TEST(long_compare),
ADD_TEST(ulong_math),
ADD_TEST(ulong_logic),
ADD_TEST(ulong_shift),
ADD_TEST(ulong_compare),
ADD_TEST(int_math),
ADD_TEST(int_logic),
ADD_TEST(int_shift),
ADD_TEST(int_compare),
ADD_TEST(uint_math),
ADD_TEST(uint_logic),
ADD_TEST(uint_shift),
ADD_TEST(uint_compare),
ADD_TEST(short_math),
ADD_TEST(short_logic),
ADD_TEST(short_shift),
ADD_TEST(short_compare),
ADD_TEST(ushort_math),
ADD_TEST(ushort_logic),
ADD_TEST(ushort_shift),
ADD_TEST(ushort_compare),
ADD_TEST(char_math),
ADD_TEST(char_logic),
ADD_TEST(char_shift),
ADD_TEST(char_compare),
ADD_TEST(uchar_math),
ADD_TEST(uchar_logic),
ADD_TEST(uchar_shift),
ADD_TEST(uchar_compare),
ADD_TEST(popcount),
// Quick
ADD_TEST(quick_long_math),
ADD_TEST(quick_long_logic),
ADD_TEST(quick_long_shift),
ADD_TEST(quick_long_compare),
ADD_TEST(quick_ulong_math),
ADD_TEST(quick_ulong_logic),
ADD_TEST(quick_ulong_shift),
ADD_TEST(quick_ulong_compare),
ADD_TEST(quick_int_math),
ADD_TEST(quick_int_logic),
ADD_TEST(quick_int_shift),
ADD_TEST(quick_int_compare),
ADD_TEST(quick_uint_math),
ADD_TEST(quick_uint_logic),
ADD_TEST(quick_uint_shift),
ADD_TEST(quick_uint_compare),
ADD_TEST(quick_short_math),
ADD_TEST(quick_short_logic),
ADD_TEST(quick_short_shift),
ADD_TEST(quick_short_compare),
ADD_TEST(quick_ushort_math),
ADD_TEST(quick_ushort_logic),
ADD_TEST(quick_ushort_shift),
ADD_TEST(quick_ushort_compare),
ADD_TEST(quick_char_math),
ADD_TEST(quick_char_logic),
ADD_TEST(quick_char_shift),
ADD_TEST(quick_char_compare),
ADD_TEST(quick_uchar_math),
ADD_TEST(quick_uchar_logic),
ADD_TEST(quick_uchar_shift),
ADD_TEST(quick_uchar_compare),
ADD_TEST(vector_scalar),
ADD_TEST(integer_dot_product),
};
const int test_num = ARRAY_SIZE(test_list);
void fill_test_values( cl_long *outBufferA, cl_long *outBufferB, size_t numElements, MTdata d ) void fill_test_values( cl_long *outBufferA, cl_long *outBufferB, size_t numElements, MTdata d )
{ {
static const cl_long sUniqueValues[] = { 0x3333333333333333LL, 0x5555555555555555LL, 0x9999999999999999LL, 0xaaaaaaaaaaaaaaaaLL, 0xccccccccccccccccLL, static const cl_long sUniqueValues[] = { 0x3333333333333333LL, 0x5555555555555555LL, 0x9999999999999999LL, 0xaaaaaaaaaaaaaaaaLL, 0xccccccccccccccccLL,
@@ -218,6 +89,7 @@ void fill_test_values( cl_long *outBufferA, cl_long *outBufferB, size_t numEleme
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);
} }

View File

@@ -1,156 +0,0 @@
//
// Copyright (c) 2017-2022 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/testHarness.h"
#include "harness/mt19937.h"
// The number of errors to print out for each test
#define MAX_ERRORS_TO_PRINT 10
extern const size_t vector_aligns[];
extern int create_program_and_kernel(const char *source, const char *kernel_name, cl_program *program_ret, cl_kernel *kernel_ret);
extern void fill_test_values( cl_long *outBufferA, cl_long *outBufferB, size_t numElements, MTdata d );
extern int test_popcount(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_clz(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_ctz(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_hadd(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_rhadd(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_mul_hi(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_rotate(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_clamp(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_mad_sat(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_mad_hi(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_min(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_max(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_upsample(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_addAssign(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_subtractAssign(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_multiplyAssign(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_divideAssign(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_moduloAssign(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_andAssign(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_orAssign(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_exclusiveOrAssign(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_abs(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_abs_diff(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_add_sat(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_sub_sat(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_mul24(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_mad24(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_extended_bit_ops_extract(cl_device_id device_id,
cl_context context,
cl_command_queue commands,
int num_elements);
extern int test_extended_bit_ops_insert(cl_device_id device_id,
cl_context context,
cl_command_queue commands,
int num_elements);
extern int test_extended_bit_ops_reverse(cl_device_id device_id,
cl_context context,
cl_command_queue commands,
int num_elements);
extern int test_long_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_long_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_long_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_long_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_ulong_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_ulong_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_ulong_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_ulong_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_int_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_int_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_int_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_int_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_uint_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_uint_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_uint_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_uint_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_short_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_short_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_short_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_short_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_ushort_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_ushort_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_ushort_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_ushort_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_char_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_char_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_char_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_char_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_uchar_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_uchar_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_uchar_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_uchar_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_long_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_long_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_long_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_long_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_ulong_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_ulong_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_ulong_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_ulong_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_int_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_int_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_int_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_int_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_uint_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_uint_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_uint_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_uint_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_short_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_short_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_short_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_short_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_ushort_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_ushort_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_ushort_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_ushort_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_char_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_char_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_char_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_char_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_uchar_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_uchar_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_uchar_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_quick_uchar_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_unary_ops_full(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_unary_ops_increment(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_unary_ops_decrement(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_vector_scalar(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_integer_dot_product(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements);

View File

@@ -17,13 +17,21 @@
#define _testBase_h #define _testBase_h
#include "harness/compat.h" #include "harness/compat.h"
#include "harness/errorHelpers.h"
#include "harness/kernelHelpers.h"
#include "harness/testHarness.h"
#include "harness/typeWrappers.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
#define MAX_ERRORS_TO_PRINT 10
extern void fill_test_values(cl_long *outBufferA, cl_long *outBufferB,
size_t numElements, MTdata d);
#endif // _testBase_h #endif // _testBase_h

View File

@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "harness/compat.h" #include "testBase.h"
#include <cinttypes> #include <cinttypes>
@@ -22,10 +22,6 @@
#include <limits.h> #include <limits.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "procs.h"
static int verify_abs_char( const void *p, const void *q, size_t n, const char *sizeName, size_t vecSize ) static int verify_abs_char( const void *p, const void *q, size_t n, const char *sizeName, size_t vecSize )
{ {
const cl_char *inA = (const cl_char*) p; const cl_char *inA = (const cl_char*) p;
@@ -216,7 +212,7 @@ static const char * dest_stores[] = {
" vstore3(tmp, tid, dst);\n" " vstore3(tmp, tid, dst);\n"
}; };
int test_integer_abs(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems) REGISTER_TEST(integer_abs)
{ {
cl_int *input_ptr, *output_ptr, *p; cl_int *input_ptr, *output_ptr, *p;
int err; int err;
@@ -226,15 +222,14 @@ int test_integer_abs(cl_device_id device, cl_context context, cl_command_queue q
MTdata d; MTdata d;
int fail_count = 0; int fail_count = 0;
size_t length = sizeof(cl_int) * 4 * n_elems; size_t length = sizeof(cl_int) * 4 * num_elements;
input_ptr = (cl_int*)malloc(length); input_ptr = (cl_int*)malloc(length);
output_ptr = (cl_int*)malloc(length); output_ptr = (cl_int*)malloc(length);
p = input_ptr; p = input_ptr;
d = init_genrand( gRandomSeed ); d = init_genrand( gRandomSeed );
for (i=0; i<n_elems * 4; i++) for (i = 0; i < num_elements * 4; i++) p[i] = genrand_int32(d);
p[i] = genrand_int32(d);
free_mtdata(d); d = NULL; free_mtdata(d); d = NULL;
for( type = 0; type < sizeof( test_str_names ) / sizeof( test_str_names[0] ); type++ ) for( type = 0; type < sizeof( test_str_names ) / sizeof( test_str_names[0] ); type++ )
@@ -372,5 +367,3 @@ int test_integer_abs(cl_device_id device, cl_context context, cl_command_queue q
return err; return err;
} }

View File

@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "harness/compat.h" #include "testBase.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -21,9 +21,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <cinttypes> #include <cinttypes>
#include "procs.h"
template <class Integer> template <class Integer>
static typename std::make_unsigned<Integer>::type abs_diff(Integer a, Integer b) static typename std::make_unsigned<Integer>::type abs_diff(Integer a, Integer b)
{ {
@@ -219,7 +216,7 @@ static void printSrc(const char *src[], int nSrcStrings) {
} }
} }
int test_integer_abs_diff(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems) REGISTER_TEST(integer_abs_diff)
{ {
cl_int *input_ptr[2], *output_ptr, *p; cl_int *input_ptr[2], *output_ptr, *p;
int err; int err;
@@ -229,7 +226,7 @@ int test_integer_abs_diff(cl_device_id device, cl_context context, cl_command_qu
MTdata d; MTdata d;
int fail_count = 0; int fail_count = 0;
size_t length = sizeof(cl_int) * 4 * n_elems; size_t length = sizeof(cl_int) * 4 * num_elements;
input_ptr[0] = (cl_int*)malloc(length); input_ptr[0] = (cl_int*)malloc(length);
input_ptr[1] = (cl_int*)malloc(length); input_ptr[1] = (cl_int*)malloc(length);
@@ -237,11 +234,9 @@ int test_integer_abs_diff(cl_device_id device, cl_context context, cl_command_qu
d = init_genrand( gRandomSeed ); d = init_genrand( gRandomSeed );
p = input_ptr[0]; p = input_ptr[0];
for (i=0; i<4 * n_elems; i++) for (i = 0; i < 4 * num_elements; i++) p[i] = genrand_int32(d);
p[i] = genrand_int32(d);
p = input_ptr[1]; p = input_ptr[1];
for (i=0; i<4 * n_elems; i++) for (i = 0; i < 4 * num_elements; i++) p[i] = genrand_int32(d);
p[i] = genrand_int32(d);
free_mtdata(d); d = NULL; free_mtdata(d); d = NULL;
for( type = 0; type < sizeof( test_str_names ) / sizeof( test_str_names[0] ); type++ ) for( type = 0; type < sizeof( test_str_names ) / sizeof( test_str_names[0] ); type++ )
@@ -405,5 +400,3 @@ int test_integer_abs_diff(cl_device_id device, cl_context context, cl_command_qu
return err; return err;
} }

View File

@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "harness/compat.h" #include "testBase.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -23,9 +23,6 @@
#include <algorithm> #include <algorithm>
#include <cinttypes> #include <cinttypes>
#include "procs.h"
static int verify_addsat_char( const cl_char *inA, const cl_char *inB, const cl_char *outptr, int n, const char *sizeName, int vecSize ) static int verify_addsat_char( const cl_char *inA, const cl_char *inB, const cl_char *outptr, int n, const char *sizeName, int vecSize )
{ {
int i; int i;
@@ -185,7 +182,7 @@ static const int vector_sizes[] = {1, 2, 3, 4, 8, 16};
static const char *vector_size_names[] = { "", "2", "3", "4", "8", "16" }; static const char *vector_size_names[] = { "", "2", "3", "4", "8", "16" };
static const size_t kSizes[8] = { 1, 1, 2, 2, 4, 4, 8, 8 }; static const size_t kSizes[8] = { 1, 1, 2, 2, 4, 4, 8, 8 };
int test_integer_add_sat(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems) REGISTER_TEST(integer_add_sat)
{ {
cl_int *input_ptr[2], *output_ptr, *p; cl_int *input_ptr[2], *output_ptr, *p;
int err; int err;
@@ -195,7 +192,7 @@ int test_integer_add_sat(cl_device_id device, cl_context context, cl_command_que
MTdata d; MTdata d;
int fail_count = 0; int fail_count = 0;
size_t length = sizeof(cl_int) * 4 * n_elems; size_t length = sizeof(cl_int) * 4 * num_elements;
input_ptr[0] = (cl_int*)malloc(length); input_ptr[0] = (cl_int*)malloc(length);
input_ptr[1] = (cl_int*)malloc(length); input_ptr[1] = (cl_int*)malloc(length);
@@ -203,11 +200,9 @@ int test_integer_add_sat(cl_device_id device, cl_context context, cl_command_que
d = init_genrand( gRandomSeed ); d = init_genrand( gRandomSeed );
p = input_ptr[0]; p = input_ptr[0];
for (i=0; i<4 * n_elems; i++) for (i = 0; i < 4 * num_elements; i++) p[i] = genrand_int32(d);
p[i] = genrand_int32(d);
p = input_ptr[1]; p = input_ptr[1];
for (i=0; i<4 * n_elems; i++) for (i = 0; i < 4 * num_elements; i++) p[i] = genrand_int32(d);
p[i] = genrand_int32(d);
free_mtdata(d); d = NULL; free_mtdata(d); d = NULL;
for( type = 0; type < sizeof( test_str_names ) / sizeof( test_str_names[0] ); type++ ) for( type = 0; type < sizeof( test_str_names ) / sizeof( test_str_names[0] ); type++ )
@@ -376,5 +371,3 @@ int test_integer_add_sat(cl_device_id device, cl_context context, cl_command_que
return err; return err;
} }

View File

@@ -14,13 +14,13 @@
// limitations under the License. // limitations under the License.
// //
#include "testBase.h"
#include <algorithm> #include <algorithm>
#include <numeric> #include <numeric>
#include <string> #include <string>
#include <type_traits> #include <type_traits>
#include <vector> #include <vector>
#include "procs.h"
#include "harness/integer_ops_test_info.h" #include "harness/integer_ops_test_info.h"
#include "harness/testHarness.h" #include "harness/testHarness.h"
@@ -261,8 +261,7 @@ static int test_type(cl_device_id device, cl_context context,
| test_vectype<T, 16>(device, context, queue); | test_vectype<T, 16>(device, context, queue);
} }
int test_extended_bit_ops_extract(cl_device_id device, cl_context context, REGISTER_TEST(extended_bit_ops_extract)
cl_command_queue queue, int num_elements)
{ {
if (is_extension_available(device, "cl_khr_extended_bit_ops")) if (is_extension_available(device, "cl_khr_extended_bit_ops"))
{ {

View File

@@ -14,13 +14,13 @@
// limitations under the License. // limitations under the License.
// //
#include "testBase.h"
#include <algorithm> #include <algorithm>
#include <numeric> #include <numeric>
#include <string> #include <string>
#include <type_traits> #include <type_traits>
#include <vector> #include <vector>
#include "procs.h"
#include "harness/integer_ops_test_info.h" #include "harness/integer_ops_test_info.h"
#include "harness/testHarness.h" #include "harness/testHarness.h"
@@ -188,8 +188,7 @@ static int test_type(cl_device_id device, cl_context context,
| test_vectype<T, 16>(device, context, queue); | test_vectype<T, 16>(device, context, queue);
} }
int test_extended_bit_ops_insert(cl_device_id device, cl_context context, REGISTER_TEST(extended_bit_ops_insert)
cl_command_queue queue, int num_elements)
{ {
if (is_extension_available(device, "cl_khr_extended_bit_ops")) if (is_extension_available(device, "cl_khr_extended_bit_ops"))
{ {

View File

@@ -14,12 +14,12 @@
// limitations under the License. // limitations under the License.
// //
#include "testBase.h"
#include <algorithm> #include <algorithm>
#include <numeric> #include <numeric>
#include <string> #include <string>
#include <vector> #include <vector>
#include "procs.h"
#include "harness/integer_ops_test_info.h" #include "harness/integer_ops_test_info.h"
#include "harness/testHarness.h" #include "harness/testHarness.h"
@@ -151,8 +151,7 @@ static int test_type(cl_device_id device, cl_context context,
| test_vectype<T, 16>(device, context, queue); | test_vectype<T, 16>(device, context, queue);
} }
int test_extended_bit_ops_reverse(cl_device_id device, cl_context context, REGISTER_TEST(extended_bit_ops_reverse)
cl_command_queue queue, int num_elements)
{ {
if (is_extension_available(device, "cl_khr_extended_bit_ops")) if (is_extension_available(device, "cl_khr_extended_bit_ops"))
{ {

View File

@@ -13,14 +13,13 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "harness/compat.h" #include "testBase.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"
#include "harness/conversions.h" #include "harness/conversions.h"
#include "harness/ThreadPool.h" #include "harness/ThreadPool.h"
@@ -887,316 +886,443 @@ int run_test(cl_device_id deviceID, cl_context context, cl_command_queue queue,
// ----------------- // -----------------
// Long tests // Long tests
// ----------------- // -----------------
int test_long_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(long_math)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_math(deviceID, context, queue, num_elements, kLong, LONG_MATH_SHIFT_SIZE); return run_test_math(device, context, queue, num_elements, kLong,
LONG_MATH_SHIFT_SIZE);
} }
int test_long_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(long_logic)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_logic(deviceID, context, queue, num_elements, kLong, LONG_MATH_SHIFT_SIZE); return run_test_logic(device, context, queue, num_elements, kLong,
LONG_MATH_SHIFT_SIZE);
} }
int test_long_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(long_shift)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_shift(deviceID, context, queue, num_elements, kLong, LONG_MATH_SHIFT_SIZE); return run_test_shift(device, context, queue, num_elements, kLong,
LONG_MATH_SHIFT_SIZE);
} }
int test_long_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(long_compare)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_compare(deviceID, context, queue, num_elements, kLong, LONG_MATH_SHIFT_SIZE); return run_test_compare(device, context, queue, num_elements, kLong,
LONG_MATH_SHIFT_SIZE);
} }
int test_quick_long_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_long_math)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_math(deviceID, context, queue, num_elements, kLong, QUICK_MATH_SHIFT_SIZE); return run_test_math(device, context, queue, num_elements, kLong,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_long_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_long_logic)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_logic(deviceID, context, queue, num_elements, kLong, QUICK_MATH_SHIFT_SIZE); return run_test_logic(device, context, queue, num_elements, kLong,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_long_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_long_shift)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_shift(deviceID, context, queue, num_elements, kLong, QUICK_MATH_SHIFT_SIZE); return run_test_shift(device, context, queue, num_elements, kLong,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_long_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_long_compare)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_compare(deviceID, context, queue, num_elements, kLong, QUICK_MATH_SHIFT_SIZE); return run_test_compare(device, context, queue, num_elements, kLong,
QUICK_MATH_SHIFT_SIZE);
} }
// ----------------- // -----------------
// ULong tests // ULong tests
// ----------------- // -----------------
int test_ulong_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(ulong_math)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_math(deviceID, context, queue, num_elements, kULong, LONG_MATH_SHIFT_SIZE); return run_test_math(device, context, queue, num_elements, kULong,
LONG_MATH_SHIFT_SIZE);
} }
int test_ulong_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(ulong_logic)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_logic(deviceID, context, queue, num_elements, kULong, LONG_MATH_SHIFT_SIZE); return run_test_logic(device, context, queue, num_elements, kULong,
LONG_MATH_SHIFT_SIZE);
} }
int test_ulong_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(ulong_shift)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_shift(deviceID, context, queue, num_elements, kULong, LONG_MATH_SHIFT_SIZE); return run_test_shift(device, context, queue, num_elements, kULong,
LONG_MATH_SHIFT_SIZE);
} }
int test_ulong_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(ulong_compare)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_compare(deviceID, context, queue, num_elements, kULong, LONG_MATH_SHIFT_SIZE); return run_test_compare(device, context, queue, num_elements, kULong,
LONG_MATH_SHIFT_SIZE);
} }
int test_quick_ulong_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_ulong_math)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_math(deviceID, context, queue, num_elements, kULong, QUICK_MATH_SHIFT_SIZE); return run_test_math(device, context, queue, num_elements, kULong,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_ulong_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_ulong_logic)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_logic(deviceID, context, queue, num_elements, kULong, QUICK_MATH_SHIFT_SIZE); return run_test_logic(device, context, queue, num_elements, kULong,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_ulong_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_ulong_shift)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_shift(deviceID, context, queue, num_elements, kULong, QUICK_MATH_SHIFT_SIZE); return run_test_shift(device, context, queue, num_elements, kULong,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_ulong_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_ulong_compare)
{
if (!gHasLong) if (!gHasLong)
{ {
log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" ); log_info( "WARNING: 64 bit integers are not supported on this device. Skipping\n" );
return CL_SUCCESS; return CL_SUCCESS;
} }
return run_test_compare(deviceID, context, queue, num_elements, kULong, QUICK_MATH_SHIFT_SIZE); return run_test_compare(device, context, queue, num_elements, kULong,
QUICK_MATH_SHIFT_SIZE);
} }
// ----------------- // -----------------
// Int tests // Int tests
// ----------------- // -----------------
int test_int_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(int_math)
return run_test_math(deviceID, context, queue, num_elements, kInt, LONG_MATH_SHIFT_SIZE); {
return run_test_math(device, context, queue, num_elements, kInt,
LONG_MATH_SHIFT_SIZE);
} }
int test_int_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(int_logic)
return run_test_logic(deviceID, context, queue, num_elements, kInt, LONG_MATH_SHIFT_SIZE); {
return run_test_logic(device, context, queue, num_elements, kInt,
LONG_MATH_SHIFT_SIZE);
} }
int test_int_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(int_shift)
return run_test_shift(deviceID, context, queue, num_elements, kInt, LONG_MATH_SHIFT_SIZE); {
return run_test_shift(device, context, queue, num_elements, kInt,
LONG_MATH_SHIFT_SIZE);
} }
int test_int_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(int_compare)
return run_test_compare(deviceID, context, queue, num_elements, kInt, LONG_MATH_SHIFT_SIZE); {
return run_test_compare(device, context, queue, num_elements, kInt,
LONG_MATH_SHIFT_SIZE);
} }
int test_quick_int_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_int_math)
return run_test_math(deviceID, context, queue, num_elements, kInt, QUICK_MATH_SHIFT_SIZE); {
return run_test_math(device, context, queue, num_elements, kInt,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_int_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_int_logic)
return run_test_logic(deviceID, context, queue, num_elements, kInt, QUICK_MATH_SHIFT_SIZE); {
return run_test_logic(device, context, queue, num_elements, kInt,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_int_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_int_shift)
return run_test_shift(deviceID, context, queue, num_elements, kInt, QUICK_MATH_SHIFT_SIZE); {
return run_test_shift(device, context, queue, num_elements, kInt,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_int_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_int_compare)
return run_test_compare(deviceID, context, queue, num_elements, kInt, QUICK_MATH_SHIFT_SIZE); {
return run_test_compare(device, context, queue, num_elements, kInt,
QUICK_MATH_SHIFT_SIZE);
} }
// ----------------- // -----------------
// UInt tests // UInt tests
// ----------------- // -----------------
int test_uint_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(uint_math)
return run_test_math(deviceID, context, queue, num_elements, kUInt, LONG_MATH_SHIFT_SIZE); {
return run_test_math(device, context, queue, num_elements, kUInt,
LONG_MATH_SHIFT_SIZE);
} }
int test_uint_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(uint_logic)
return run_test_logic(deviceID, context, queue, num_elements, kUInt, LONG_MATH_SHIFT_SIZE); {
return run_test_logic(device, context, queue, num_elements, kUInt,
LONG_MATH_SHIFT_SIZE);
} }
int test_uint_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(uint_shift)
return run_test_shift(deviceID, context, queue, num_elements, kUInt, LONG_MATH_SHIFT_SIZE); {
return run_test_shift(device, context, queue, num_elements, kUInt,
LONG_MATH_SHIFT_SIZE);
} }
int test_uint_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(uint_compare)
return run_test_compare(deviceID, context, queue, num_elements, kUInt, LONG_MATH_SHIFT_SIZE); {
return run_test_compare(device, context, queue, num_elements, kUInt,
LONG_MATH_SHIFT_SIZE);
} }
int test_quick_uint_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_uint_math)
return run_test_math(deviceID, context, queue, num_elements, kUInt, QUICK_MATH_SHIFT_SIZE); {
return run_test_math(device, context, queue, num_elements, kUInt,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_uint_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_uint_logic)
return run_test_logic(deviceID, context, queue, num_elements, kUInt, QUICK_MATH_SHIFT_SIZE); {
return run_test_logic(device, context, queue, num_elements, kUInt,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_uint_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_uint_shift)
return run_test_shift(deviceID, context, queue, num_elements, kUInt, QUICK_MATH_SHIFT_SIZE); {
return run_test_shift(device, context, queue, num_elements, kUInt,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_uint_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_uint_compare)
return run_test_compare(deviceID, context, queue, num_elements, kUInt, QUICK_MATH_SHIFT_SIZE); {
return run_test_compare(device, context, queue, num_elements, kUInt,
QUICK_MATH_SHIFT_SIZE);
} }
// ----------------- // -----------------
// Short tests // Short tests
// ----------------- // -----------------
int test_short_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(short_math)
return run_test_math(deviceID, context, queue, num_elements, kShort, LONG_MATH_SHIFT_SIZE); {
return run_test_math(device, context, queue, num_elements, kShort,
LONG_MATH_SHIFT_SIZE);
} }
int test_short_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(short_logic)
return run_test_logic(deviceID, context, queue, num_elements, kShort, LONG_MATH_SHIFT_SIZE); {
return run_test_logic(device, context, queue, num_elements, kShort,
LONG_MATH_SHIFT_SIZE);
} }
int test_short_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(short_shift)
return run_test_shift(deviceID, context, queue, num_elements, kShort, LONG_MATH_SHIFT_SIZE); {
return run_test_shift(device, context, queue, num_elements, kShort,
LONG_MATH_SHIFT_SIZE);
} }
int test_short_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(short_compare)
return run_test_compare(deviceID, context, queue, num_elements, kShort, LONG_MATH_SHIFT_SIZE); {
return run_test_compare(device, context, queue, num_elements, kShort,
LONG_MATH_SHIFT_SIZE);
} }
int test_quick_short_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_short_math)
return run_test_math(deviceID, context, queue, num_elements, kShort, QUICK_MATH_SHIFT_SIZE); {
return run_test_math(device, context, queue, num_elements, kShort,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_short_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_short_logic)
return run_test_logic(deviceID, context, queue, num_elements, kShort, QUICK_MATH_SHIFT_SIZE); {
return run_test_logic(device, context, queue, num_elements, kShort,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_short_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_short_shift)
return run_test_shift(deviceID, context, queue, num_elements, kShort, QUICK_MATH_SHIFT_SIZE); {
return run_test_shift(device, context, queue, num_elements, kShort,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_short_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_short_compare)
return run_test_compare(deviceID, context, queue, num_elements, kShort, QUICK_MATH_SHIFT_SIZE); {
return run_test_compare(device, context, queue, num_elements, kShort,
QUICK_MATH_SHIFT_SIZE);
} }
// ----------------- // -----------------
// UShort tests // UShort tests
// ----------------- // -----------------
int test_ushort_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(ushort_math)
return run_test_math(deviceID, context, queue, num_elements, kUShort, LONG_MATH_SHIFT_SIZE); {
return run_test_math(device, context, queue, num_elements, kUShort,
LONG_MATH_SHIFT_SIZE);
} }
int test_ushort_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(ushort_logic)
return run_test_logic(deviceID, context, queue, num_elements, kUShort, LONG_MATH_SHIFT_SIZE); {
return run_test_logic(device, context, queue, num_elements, kUShort,
LONG_MATH_SHIFT_SIZE);
} }
int test_ushort_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(ushort_shift)
return run_test_shift(deviceID, context, queue, num_elements, kUShort, LONG_MATH_SHIFT_SIZE); {
return run_test_shift(device, context, queue, num_elements, kUShort,
LONG_MATH_SHIFT_SIZE);
} }
int test_ushort_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(ushort_compare)
return run_test_compare(deviceID, context, queue, num_elements, kUShort, LONG_MATH_SHIFT_SIZE); {
return run_test_compare(device, context, queue, num_elements, kUShort,
LONG_MATH_SHIFT_SIZE);
} }
int test_quick_ushort_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_ushort_math)
return run_test_math(deviceID, context, queue, num_elements, kUShort, QUICK_MATH_SHIFT_SIZE); {
return run_test_math(device, context, queue, num_elements, kUShort,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_ushort_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_ushort_logic)
return run_test_logic(deviceID, context, queue, num_elements, kUShort, QUICK_MATH_SHIFT_SIZE); {
return run_test_logic(device, context, queue, num_elements, kUShort,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_ushort_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_ushort_shift)
return run_test_shift(deviceID, context, queue, num_elements, kUShort, QUICK_MATH_SHIFT_SIZE); {
return run_test_shift(device, context, queue, num_elements, kUShort,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_ushort_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_ushort_compare)
return run_test_compare(deviceID, context, queue, num_elements, kUShort, QUICK_MATH_SHIFT_SIZE); {
return run_test_compare(device, context, queue, num_elements, kUShort,
QUICK_MATH_SHIFT_SIZE);
} }
// ----------------- // -----------------
// Char tests // Char tests
// ----------------- // -----------------
int test_char_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(char_math)
return run_test_math(deviceID, context, queue, num_elements, kChar, LONG_MATH_SHIFT_SIZE); {
return run_test_math(device, context, queue, num_elements, kChar,
LONG_MATH_SHIFT_SIZE);
} }
int test_char_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(char_logic)
return run_test_logic(deviceID, context, queue, num_elements, kChar, LONG_MATH_SHIFT_SIZE); {
return run_test_logic(device, context, queue, num_elements, kChar,
LONG_MATH_SHIFT_SIZE);
} }
int test_char_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(char_shift)
return run_test_shift(deviceID, context, queue, num_elements, kChar, LONG_MATH_SHIFT_SIZE); {
return run_test_shift(device, context, queue, num_elements, kChar,
LONG_MATH_SHIFT_SIZE);
} }
int test_char_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(char_compare)
return run_test_compare(deviceID, context, queue, num_elements, kChar, LONG_MATH_SHIFT_SIZE); {
return run_test_compare(device, context, queue, num_elements, kChar,
LONG_MATH_SHIFT_SIZE);
} }
int test_quick_char_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_char_math)
return run_test_math(deviceID, context, queue, num_elements, kChar, QUICK_MATH_SHIFT_SIZE); {
return run_test_math(device, context, queue, num_elements, kChar,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_char_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_char_logic)
return run_test_logic(deviceID, context, queue, num_elements, kChar, QUICK_MATH_SHIFT_SIZE); {
return run_test_logic(device, context, queue, num_elements, kChar,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_char_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_char_shift)
return run_test_shift(deviceID, context, queue, num_elements, kChar, QUICK_MATH_SHIFT_SIZE); {
return run_test_shift(device, context, queue, num_elements, kChar,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_char_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_char_compare)
return run_test_compare(deviceID, context, queue, num_elements, kChar, QUICK_MATH_SHIFT_SIZE); {
return run_test_compare(device, context, queue, num_elements, kChar,
QUICK_MATH_SHIFT_SIZE);
} }
// ----------------- // -----------------
// UChar tests // UChar tests
// ----------------- // -----------------
int test_uchar_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(uchar_math)
return run_test_math(deviceID, context, queue, num_elements, kUChar, LONG_MATH_SHIFT_SIZE); {
return run_test_math(device, context, queue, num_elements, kUChar,
LONG_MATH_SHIFT_SIZE);
} }
int test_uchar_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(uchar_logic)
return run_test_logic(deviceID, context, queue, num_elements, kUChar, LONG_MATH_SHIFT_SIZE); {
return run_test_logic(device, context, queue, num_elements, kUChar,
LONG_MATH_SHIFT_SIZE);
} }
int test_uchar_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(uchar_shift)
return run_test_shift(deviceID, context, queue, num_elements, kUChar, LONG_MATH_SHIFT_SIZE); {
return run_test_shift(device, context, queue, num_elements, kUChar,
LONG_MATH_SHIFT_SIZE);
} }
int test_uchar_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(uchar_compare)
return run_test_compare(deviceID, context, queue, num_elements, kUChar, LONG_MATH_SHIFT_SIZE); {
return run_test_compare(device, context, queue, num_elements, kUChar,
LONG_MATH_SHIFT_SIZE);
} }
int test_quick_uchar_math(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_uchar_math)
return run_test_math(deviceID, context, queue, num_elements, kUChar, QUICK_MATH_SHIFT_SIZE); {
return run_test_math(device, context, queue, num_elements, kUChar,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_uchar_logic(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_uchar_logic)
return run_test_logic(deviceID, context, queue, num_elements, kUChar, QUICK_MATH_SHIFT_SIZE); {
return run_test_logic(device, context, queue, num_elements, kUChar,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_uchar_shift(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_uchar_shift)
return run_test_shift(deviceID, context, queue, num_elements, kUChar, QUICK_MATH_SHIFT_SIZE); {
return run_test_shift(device, context, queue, num_elements, kUChar,
QUICK_MATH_SHIFT_SIZE);
} }
int test_quick_uchar_compare(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(quick_uchar_compare)
return run_test_compare(deviceID, context, queue, num_elements, kUChar, QUICK_MATH_SHIFT_SIZE); {
return run_test_compare(device, context, queue, num_elements, kUChar,
QUICK_MATH_SHIFT_SIZE);
} }
// These are kept for debugging if you want to run all the tests together. // These are kept for debugging if you want to run all the tests together.
int test_long(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { int test_long(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) {
@@ -1334,7 +1460,7 @@ int run_vector_scalar_tests( cl_device_id deviceID, cl_context context, cl_comma
return errors; return errors;
} }
int test_vector_scalar(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(vector_scalar)
{ {
int errors = 0; int errors = 0;
int numTypes = sizeof( types ) / sizeof( types[ 0 ] ); int numTypes = sizeof( types ) / sizeof( types[ 0 ] );
@@ -1344,7 +1470,8 @@ int test_vector_scalar(cl_device_id deviceID, cl_context context, cl_command_que
if ((types[ t ] == kLong || types[ t ] == kULong) && !gHasLong) if ((types[ t ] == kLong || types[ t ] == kULong) && !gHasLong)
continue; continue;
errors += run_vector_scalar_tests( deviceID, context, queue, num_elements, types[ t ], 1 ); errors += run_vector_scalar_tests(device, context, queue, num_elements,
types[t], 1);
break; break;
} }

View File

@@ -14,13 +14,14 @@
// limitations under the License. // limitations under the License.
// //
#include "testBase.h"
#include <algorithm> #include <algorithm>
#include <limits> #include <limits>
#include <numeric> #include <numeric>
#include <string> #include <string>
#include <vector> #include <vector>
#include "procs.h"
#include "harness/integer_ops_test_info.h" #include "harness/integer_ops_test_info.h"
#include "harness/testHarness.h" #include "harness/testHarness.h"
@@ -327,23 +328,22 @@ static int test_vectype_packed(cl_device_id deviceID, cl_context context,
return result; return result;
} }
int test_integer_dot_product(cl_device_id deviceID, cl_context context, REGISTER_TEST(integer_dot_product)
cl_command_queue queue, int num_elements)
{ {
if (!is_extension_available(deviceID, "cl_khr_integer_dot_product")) if (!is_extension_available(device, "cl_khr_integer_dot_product"))
{ {
log_info("cl_khr_integer_dot_product is not supported\n"); log_info("cl_khr_integer_dot_product is not supported\n");
return TEST_SKIPPED_ITSELF; return TEST_SKIPPED_ITSELF;
} }
Version deviceVersion = get_device_cl_version(deviceID); Version deviceVersion = get_device_cl_version(device);
cl_version extensionVersion; cl_version extensionVersion;
if ((deviceVersion >= Version(3, 0)) if ((deviceVersion >= Version(3, 0))
|| is_extension_available(deviceID, "cl_khr_extended_versioning")) || is_extension_available(device, "cl_khr_extended_versioning"))
{ {
extensionVersion = extensionVersion =
get_extension_version(deviceID, "cl_khr_integer_dot_product"); get_extension_version(device, "cl_khr_integer_dot_product");
} }
else else
{ {
@@ -355,9 +355,9 @@ int test_integer_dot_product(cl_device_id deviceID, cl_context context,
int result = TEST_PASS; int result = TEST_PASS;
cl_device_integer_dot_product_capabilities_khr dotCaps = 0; cl_device_integer_dot_product_capabilities_khr dotCaps = 0;
error = clGetDeviceInfo(deviceID, error =
CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIES_KHR, clGetDeviceInfo(device, CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIES_KHR,
sizeof(dotCaps), &dotCaps, NULL); sizeof(dotCaps), &dotCaps, NULL);
test_error( test_error(
error, error,
"Unable to query CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIES_KHR"); "Unable to query CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIES_KHR");
@@ -383,7 +383,7 @@ int test_integer_dot_product(cl_device_id deviceID, cl_context context,
{ {
size_t size_ret; size_t size_ret;
error = clGetDeviceInfo( error = clGetDeviceInfo(
deviceID, device,
CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT_KHR, 0, CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT_KHR, 0,
nullptr, &size_ret); nullptr, &size_ret);
test_error( test_error(
@@ -394,13 +394,13 @@ int test_integer_dot_product(cl_device_id deviceID, cl_context context,
cl_device_integer_dot_product_acceleration_properties_khr cl_device_integer_dot_product_acceleration_properties_khr
accelerationProperties; accelerationProperties;
error = clGetDeviceInfo( error = clGetDeviceInfo(
deviceID, device,
CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT_KHR, CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT_KHR,
sizeof(accelerationProperties), &accelerationProperties, nullptr); sizeof(accelerationProperties), &accelerationProperties, nullptr);
test_error(error, "Unable to query 8-bit acceleration properties"); test_error(error, "Unable to query 8-bit acceleration properties");
error = clGetDeviceInfo( error = clGetDeviceInfo(
deviceID, device,
CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_4x8BIT_PACKED_KHR, CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_4x8BIT_PACKED_KHR,
0, nullptr, &size_ret); 0, nullptr, &size_ret);
test_error( test_error(
@@ -410,7 +410,7 @@ int test_integer_dot_product(cl_device_id deviceID, cl_context context,
"PACKED_KHR"); "PACKED_KHR");
error = clGetDeviceInfo( error = clGetDeviceInfo(
deviceID, device,
CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_4x8BIT_PACKED_KHR, CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_4x8BIT_PACKED_KHR,
sizeof(accelerationProperties), &accelerationProperties, nullptr); sizeof(accelerationProperties), &accelerationProperties, nullptr);
test_error(error, test_error(error,
@@ -428,14 +428,14 @@ int test_integer_dot_product(cl_device_id deviceID, cl_context context,
// Test built-in functions // Test built-in functions
if (dotCaps & CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_KHR) if (dotCaps & CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_KHR)
{ {
result |= test_vectype<cl_uchar, cl_uint, 4>(deviceID, context, queue, result |= test_vectype<cl_uchar, cl_uint, 4>(device, context, queue,
num_elements); num_elements);
} }
if (dotCaps & CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED_KHR) if (dotCaps & CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED_KHR)
{ {
result |= test_vectype_packed<cl_uchar, cl_uint, 4>( result |= test_vectype_packed<cl_uchar, cl_uint, 4>(
deviceID, context, queue, num_elements); device, context, queue, num_elements);
} }
return result; return result;

View File

@@ -342,7 +342,7 @@ bool verify_integer_clz( void *source, void *destination, ExplicitType vecType )
return true; return true;
} }
int test_integer_clz(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(integer_clz)
{ {
return test_single_param_integer_fn( queue, context, "clz", verify_integer_clz ); return test_single_param_integer_fn( queue, context, "clz", verify_integer_clz );
} }
@@ -436,7 +436,7 @@ bool verify_integer_ctz( void *source, void *destination, ExplicitType vecType )
} }
int test_integer_ctz(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(integer_ctz)
{ {
return test_single_param_integer_fn( queue, context, "ctz", verify_integer_ctz ); return test_single_param_integer_fn( queue, context, "ctz", verify_integer_ctz );
} }
@@ -464,15 +464,17 @@ int test_integer_ctz(cl_device_id deviceID, cl_context context, cl_command_queue
break; \ break; \
} }
#define OP_TEST( op, opName ) \ #define OP_TEST(op, opName) \
bool verify_integer_##opName##Assign( void *source, void *destination, ExplicitType vecType ) \ bool verify_integer_##opName##Assign(void *source, void *destination, \
{ \ ExplicitType vecType) \
OP_CASES( op ) \ { \
return true; \ OP_CASES(op) \
} \ return true; \
int test_integer_##opName##Assign(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) \ } \
{ \ REGISTER_TEST(integer_##opName##Assign) \
return test_single_param_integer_fn( queue, context, #op, verify_integer_##opName##Assign, true ); \ { \
return test_single_param_integer_fn( \
queue, context, #op, verify_integer_##opName##Assign, true); \
} }
OP_TEST( +, add ) OP_TEST( +, add )
@@ -521,15 +523,17 @@ OP_TEST( &, and )
break; \ break; \
} }
#define OP_TEST_GUARD( op, opName ) \ #define OP_TEST_GUARD(op, opName) \
bool verify_integer_##opName##Assign( void *source, void *destination, ExplicitType vecType ) \ bool verify_integer_##opName##Assign(void *source, void *destination, \
{ \ ExplicitType vecType) \
OP_CASES_GUARD( op ) \ { \
return true; \ OP_CASES_GUARD(op) \
} \ return true; \
int test_integer_##opName##Assign(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) \ } \
{ \ REGISTER_TEST(integer_##opName##Assign) \
return test_single_param_integer_fn( queue, context, #op, verify_integer_##opName##Assign, true ); \ { \
return test_single_param_integer_fn( \
queue, context, #op, verify_integer_##opName##Assign, true); \
} }
OP_TEST_GUARD( /, divide ) OP_TEST_GUARD( /, divide )
@@ -898,7 +902,7 @@ bool verify_integer_hadd( void *sourceA, void *sourceB, void *destination, Expli
return true; return true;
} }
int test_integer_hadd(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(integer_hadd)
{ {
return test_two_param_integer_fn( queue, context, "hadd", verify_integer_hadd ); return test_two_param_integer_fn( queue, context, "hadd", verify_integer_hadd );
} }
@@ -961,7 +965,7 @@ bool verify_integer_rhadd( void *sourceA, void *sourceB, void *destination, Expl
return true; return true;
} }
int test_integer_rhadd(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(integer_rhadd)
{ {
return test_two_param_integer_fn( queue, context, "rhadd", verify_integer_rhadd ); return test_two_param_integer_fn( queue, context, "rhadd", verify_integer_rhadd );
} }
@@ -994,7 +998,7 @@ bool verify_integer_min( void *sourceA, void *sourceB, void *destination, Explic
return true; return true;
} }
int test_integer_min(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(integer_min)
{ {
return test_two_param_integer_fn( queue, context, "min", verify_integer_min); return test_two_param_integer_fn( queue, context, "min", verify_integer_min);
} }
@@ -1027,7 +1031,7 @@ bool verify_integer_max( void *sourceA, void *sourceB, void *destination, Explic
return true; return true;
} }
int test_integer_max(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(integer_max)
{ {
return test_two_param_integer_fn( queue, context, "max", verify_integer_max ); return test_two_param_integer_fn( queue, context, "max", verify_integer_max );
} }
@@ -1195,7 +1199,7 @@ bool verify_integer_mul_hi( void *sourceA, void *sourceB, void *destination, Exp
return true; return true;
} }
int test_integer_mul_hi(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(integer_mul_hi)
{ {
return test_two_param_integer_fn( queue, context, "mul_hi", verify_integer_mul_hi ); return test_two_param_integer_fn( queue, context, "mul_hi", verify_integer_mul_hi );
} }
@@ -1256,7 +1260,7 @@ bool verify_integer_rotate( void *sourceA, void *sourceB, void *destination, Exp
return true; return true;
} }
int test_integer_rotate(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(integer_rotate)
{ {
return test_two_param_integer_fn( queue, context, "rotate", verify_integer_rotate ); return test_two_param_integer_fn( queue, context, "rotate", verify_integer_rotate );
} }
@@ -1615,7 +1619,7 @@ bool verify_integer_clamp( void *sourceA, void *sourceB, void *sourceC, void *de
return true; return true;
} }
int test_integer_clamp(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(integer_clamp)
{ {
return test_three_param_integer_fn( queue, context, "clamp", verify_integer_clamp ); return test_three_param_integer_fn( queue, context, "clamp", verify_integer_clamp );
} }
@@ -1785,7 +1789,7 @@ bool verify_integer_mad_sat( void *sourceA, void *sourceB, void *sourceC, void *
return true; return true;
} }
int test_integer_mad_sat(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(integer_mad_sat)
{ {
return test_three_param_integer_fn( queue, context, "mad_sat", verify_integer_mad_sat ); return test_three_param_integer_fn( queue, context, "mad_sat", verify_integer_mad_sat );
} }
@@ -1907,7 +1911,7 @@ bool verify_integer_mad_hi( void *sourceA, void *sourceB, void *sourceC, void *d
return true; return true;
} }
int test_integer_mad_hi( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(integer_mad_hi)
{ {
return test_three_param_integer_fn( queue, context, "mad_hi", verify_integer_mad_hi ); return test_three_param_integer_fn( queue, context, "mad_hi", verify_integer_mad_hi );
} }

View File

@@ -13,15 +13,12 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "harness/compat.h" #include "testBase.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"
#define NUM_PROGRAMS 6 #define NUM_PROGRAMS 6
static const int vector_sizes[] = {1, 2, 3, 4, 8, 16}; static const int vector_sizes[] = {1, 2, 3, 4, 8, 16};
@@ -187,7 +184,7 @@ static inline int random_int32( MTdata d )
} }
int test_integer_mad24(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems) REGISTER_TEST(integer_mad24)
{ {
cl_mem streams[4]; cl_mem streams[4];
cl_int *input_ptr[3], *output_ptr, *p; cl_int *input_ptr[3], *output_ptr, *p;
@@ -196,13 +193,13 @@ int test_integer_mad24(cl_device_id device, cl_context context, cl_command_queue
cl_kernel kernel[2*NUM_PROGRAMS]; cl_kernel kernel[2*NUM_PROGRAMS];
size_t threads[1]; size_t threads[1];
int num_elements; int n_elems;
int err; int err;
int i; int i;
MTdata d; MTdata d;
size_t length = sizeof(cl_int) * 16 * n_elems; size_t length = sizeof(cl_int) * 16 * num_elements;
num_elements = n_elems * 16; n_elems = num_elements * 16;
input_ptr[0] = (cl_int*)malloc(length); input_ptr[0] = (cl_int*)malloc(length);
input_ptr[1] = (cl_int*)malloc(length); input_ptr[1] = (cl_int*)malloc(length);
@@ -220,14 +217,11 @@ int test_integer_mad24(cl_device_id device, cl_context context, cl_command_queue
d = init_genrand( gRandomSeed ); d = init_genrand( gRandomSeed );
p = input_ptr[0]; p = input_ptr[0];
for (i=0; i<num_elements; i++) for (i = 0; i < n_elems; i++) p[i] = random_int24(d);
p[i] = random_int24(d);
p = input_ptr[1]; p = input_ptr[1];
for (i=0; i<num_elements; i++) for (i = 0; i < n_elems; i++) p[i] = random_int24(d);
p[i] = random_int24(d);
p = input_ptr[2]; p = input_ptr[2];
for (i=0; i<num_elements; i++) for (i = 0; i < n_elems; i++) p[i] = random_int32(d);
p[i] = random_int32(d);
free_mtdata(d); d = NULL; free_mtdata(d); d = NULL;
err = clEnqueueWriteBuffer(queue, streams[0], CL_TRUE, 0, length, input_ptr[0], 0, NULL, NULL); err = clEnqueueWriteBuffer(queue, streams[0], CL_TRUE, 0, length, input_ptr[0], 0, NULL, NULL);
@@ -285,7 +279,7 @@ int test_integer_mad24(cl_device_id device, cl_context context, cl_command_queue
} }
threads[0] = (unsigned int)n_elems; threads[0] = (unsigned int)num_elements;
// test signed // test signed
for (i=0; i<NUM_PROGRAMS; i++) for (i=0; i<NUM_PROGRAMS; i++)
{ {
@@ -295,11 +289,13 @@ int test_integer_mad24(cl_device_id device, cl_context context, cl_command_queue
err = clEnqueueReadBuffer(queue, streams[3], CL_TRUE, 0, length, output_ptr, 0, NULL, NULL); err = clEnqueueReadBuffer(queue, streams[3], CL_TRUE, 0, length, output_ptr, 0, NULL, NULL);
test_error(err, "clEnqueueNDRangeKernel failed"); test_error(err, "clEnqueueNDRangeKernel failed");
if (verify_int_mad24(input_ptr[0], input_ptr[1], input_ptr[2], output_ptr, n_elems * vector_sizes[i], vector_sizes[i])) if (verify_int_mad24(input_ptr[0], input_ptr[1], input_ptr[2],
{ output_ptr, num_elements * vector_sizes[i],
log_error("INT_MAD24 %s test failed\n", test_str_names[i]); vector_sizes[i]))
err = -1; {
} log_error("INT_MAD24 %s test failed\n", test_str_names[i]);
err = -1;
}
else else
{ {
log_info("INT_MAD24 %s test passed\n", test_str_names[i]); log_info("INT_MAD24 %s test passed\n", test_str_names[i]);
@@ -311,11 +307,9 @@ int test_integer_mad24(cl_device_id device, cl_context context, cl_command_queue
} }
p = input_ptr[0]; p = input_ptr[0];
for (i=0; i<num_elements; i++) for (i = 0; i < n_elems; i++) p[i] &= 0xffffffU;
p[i] &= 0xffffffU;
p = input_ptr[1]; p = input_ptr[1];
for (i=0; i<num_elements; i++) for (i = 0; i < n_elems; i++) p[i] &= 0xffffffU;
p[i] &= 0xffffffU;
err = clEnqueueWriteBuffer(queue, streams[0], CL_TRUE, 0, length, input_ptr[0], 0, NULL, NULL); err = clEnqueueWriteBuffer(queue, streams[0], CL_TRUE, 0, length, input_ptr[0], 0, NULL, NULL);
test_error(err, "clEnqueueWriteBuffer failed"); test_error(err, "clEnqueueWriteBuffer failed");
@@ -332,11 +326,15 @@ int test_integer_mad24(cl_device_id device, cl_context context, cl_command_queue
err = clEnqueueReadBuffer(queue, streams[3], CL_TRUE, 0, length, output_ptr, 0, NULL, NULL); err = clEnqueueReadBuffer(queue, streams[3], CL_TRUE, 0, length, output_ptr, 0, NULL, NULL);
test_error(err, "clEnqueueNDRangeKernel failed"); test_error(err, "clEnqueueNDRangeKernel failed");
if (verify_uint_mad24( (cl_uint*) input_ptr[0], (cl_uint*) input_ptr[1], (cl_uint*) input_ptr[2], (cl_uint*)output_ptr, n_elems * vector_sizes[i-NUM_PROGRAMS], vector_sizes[i-NUM_PROGRAMS])) if (verify_uint_mad24((cl_uint *)input_ptr[0],
{ (cl_uint *)input_ptr[1],
log_error("UINT_MAD24 %s test failed\n", test_str_names[i]); (cl_uint *)input_ptr[2], (cl_uint *)output_ptr,
err = -1; num_elements * vector_sizes[i - NUM_PROGRAMS],
} vector_sizes[i - NUM_PROGRAMS]))
{
log_error("UINT_MAD24 %s test failed\n", test_str_names[i]);
err = -1;
}
else else
{ {
log_info("UINT_MAD24 %s test passed\n", test_str_names[i]); log_info("UINT_MAD24 %s test passed\n", test_str_names[i]);
@@ -364,5 +362,3 @@ int test_integer_mad24(cl_device_id device, cl_context context, cl_command_queue
return err; return err;
} }

View File

@@ -13,15 +13,12 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "harness/compat.h" #include "testBase.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"
#define NUM_PROGRAMS 6 #define NUM_PROGRAMS 6
static const int vector_sizes[] = {1, 2, 3, 4, 8, 16}; static const int vector_sizes[] = {1, 2, 3, 4, 8, 16};
@@ -173,7 +170,7 @@ static inline int random_int24( MTdata d )
static const char *test_str_names[] = { "int", "int2", "int3", "int4", "int8", "int16", "uint", "uint2", "uint3", "uint4", "uint8", "uint16" }; static const char *test_str_names[] = { "int", "int2", "int3", "int4", "int8", "int16", "uint", "uint2", "uint3", "uint4", "uint8", "uint16" };
int test_integer_mul24(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems) REGISTER_TEST(integer_mul24)
{ {
cl_mem streams[3]; cl_mem streams[3];
cl_int *input_ptr[2], *output_ptr, *p; cl_int *input_ptr[2], *output_ptr, *p;
@@ -182,13 +179,13 @@ int test_integer_mul24(cl_device_id device, cl_context context, cl_command_queue
cl_kernel kernel[NUM_PROGRAMS*2]; cl_kernel kernel[NUM_PROGRAMS*2];
size_t threads[1]; size_t threads[1];
int num_elements; int n_elems;
int err; int err;
int i; int i;
MTdata d; MTdata d;
size_t length = sizeof(cl_int) * 16 * n_elems; size_t length = sizeof(cl_int) * 16 * num_elements;
num_elements = n_elems * 16; n_elems = num_elements * 16;
input_ptr[0] = (cl_int*)malloc(length); input_ptr[0] = (cl_int*)malloc(length);
input_ptr[1] = (cl_int*)malloc(length); input_ptr[1] = (cl_int*)malloc(length);
@@ -215,11 +212,9 @@ int test_integer_mul24(cl_device_id device, cl_context context, cl_command_queue
d = init_genrand( gRandomSeed ); d = init_genrand( gRandomSeed );
p = input_ptr[0]; p = input_ptr[0];
for (i=0; i<num_elements; i++) for (i = 0; i < n_elems; i++) p[i] = random_int24(d);
p[i] = random_int24(d);
p = input_ptr[1]; p = input_ptr[1];
for (i=0; i<num_elements; i++) for (i = 0; i < n_elems; i++) p[i] = random_int24(d);
p[i] = random_int24(d);
free_mtdata(d); d = NULL; free_mtdata(d); d = NULL;
err = clEnqueueWriteBuffer(queue, streams[0], CL_TRUE, 0, length, input_ptr[0], 0, NULL, NULL); err = clEnqueueWriteBuffer(queue, streams[0], CL_TRUE, 0, length, input_ptr[0], 0, NULL, NULL);
@@ -285,7 +280,7 @@ int test_integer_mul24(cl_device_id device, cl_context context, cl_command_queue
} }
// test signed // test signed
threads[0] = (unsigned int)n_elems; threads[0] = (unsigned int)num_elements;
for (i=0; i<NUM_PROGRAMS; i++) for (i=0; i<NUM_PROGRAMS; i++)
{ {
err = clEnqueueNDRangeKernel(queue, kernel[i], 1, NULL, threads, NULL, 0, NULL, NULL); err = clEnqueueNDRangeKernel(queue, kernel[i], 1, NULL, threads, NULL, 0, NULL, NULL);
@@ -320,11 +315,9 @@ int test_integer_mul24(cl_device_id device, cl_context context, cl_command_queue
// clamp the set of input values to be in range // clamp the set of input values to be in range
p = input_ptr[0]; p = input_ptr[0];
for (i=0; i<num_elements; i++) for (i = 0; i < n_elems; i++) p[i] &= 0xffffffU;
p[i] &= 0xffffffU;
p = input_ptr[1]; p = input_ptr[1];
for (i=0; i<num_elements; i++) for (i = 0; i < n_elems; i++) p[i] &= 0xffffffU;
p[i] &= 0xffffffU;
err = clEnqueueWriteBuffer(queue, streams[0], CL_TRUE, 0, length, input_ptr[0], 0, NULL, NULL); err = clEnqueueWriteBuffer(queue, streams[0], CL_TRUE, 0, length, input_ptr[0], 0, NULL, NULL);
if (err != CL_SUCCESS) if (err != CL_SUCCESS)
@@ -356,7 +349,10 @@ int test_integer_mul24(cl_device_id device, cl_context context, cl_command_queue
return -1; return -1;
} }
err = verify_uint_mul24((cl_uint*) input_ptr[0], (cl_uint*) input_ptr[1], (cl_uint*) output_ptr, n_elems * vector_sizes[i-NUM_PROGRAMS], vector_sizes[i-NUM_PROGRAMS]); err = verify_uint_mul24((cl_uint *)input_ptr[0],
(cl_uint *)input_ptr[1], (cl_uint *)output_ptr,
num_elements * vector_sizes[i - NUM_PROGRAMS],
vector_sizes[i - NUM_PROGRAMS]);
if (err) if (err)
{ {
log_error("UINT_MUL24 %s test failed\n", test_str_names[i]); log_error("UINT_MUL24 %s test failed\n", test_str_names[i]);
@@ -387,5 +383,3 @@ int test_integer_mul24(cl_device_id device, cl_context context, cl_command_queue
free(output_ptr); free(output_ptr);
return err; return err;
} }

View File

@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "harness/compat.h" #include "testBase.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -21,9 +21,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <cinttypes> #include <cinttypes>
#include "procs.h"
#define str(s) #s #define str(s) #s
#define __popcnt(x, __T, __n, __r) \ #define __popcnt(x, __T, __n, __r) \
@@ -92,7 +89,7 @@ static void printSrc(const char *src[], int nSrcStrings) {
} }
} }
int test_popcount(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems) REGISTER_TEST(popcount)
{ {
cl_int *input_ptr[1], *output_ptr, *p; cl_int *input_ptr[1], *output_ptr, *p;
int err; int err;
@@ -102,15 +99,14 @@ int test_popcount(cl_device_id device, cl_context context, cl_command_queue queu
MTdata d; MTdata d;
int fail_count = 0; int fail_count = 0;
size_t length = sizeof(cl_int) * 8 * n_elems; size_t length = sizeof(cl_int) * 8 * num_elements;
input_ptr[0] = (cl_int*)malloc(length); input_ptr[0] = (cl_int*)malloc(length);
output_ptr = (cl_int*)malloc(length); output_ptr = (cl_int*)malloc(length);
d = init_genrand( gRandomSeed ); d = init_genrand( gRandomSeed );
p = input_ptr[0]; p = input_ptr[0];
for (i=0; i<8 * n_elems; i++) for (i = 0; i < 8 * num_elements; i++) p[i] = genrand_int32(d);
p[i] = genrand_int32(d);
free_mtdata(d); d = NULL; free_mtdata(d); d = NULL;
for( type = 0; type < sizeof( test_str_names ) / sizeof( test_str_names[0] ); type++ ) for( type = 0; type < sizeof( test_str_names ) / sizeof( test_str_names[0] ); type++ )
@@ -248,5 +244,3 @@ int test_popcount(cl_device_id device, cl_context context, cl_command_queue queu
return err; return err;
} }

View File

@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "harness/compat.h" #include "testBase.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -23,9 +23,6 @@
#include <algorithm> #include <algorithm>
#include <cinttypes> #include <cinttypes>
#include "procs.h"
static int verify_subsat_char( const cl_char *inA, const cl_char *inB, const cl_char *outptr, int n, const char *sizeName, int vecSize ) static int verify_subsat_char( const cl_char *inA, const cl_char *inB, const cl_char *outptr, int n, const char *sizeName, int vecSize )
{ {
int i; int i;
@@ -184,7 +181,7 @@ static const char *vector_size_names[] = { "", "2", "3", "4", "8", "16" };
static const size_t kSizes[8] = { 1, 1, 2, 2, 4, 4, 8, 8 }; static const size_t kSizes[8] = { 1, 1, 2, 2, 4, 4, 8, 8 };
int test_integer_sub_sat(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems) REGISTER_TEST(integer_sub_sat)
{ {
int *input_ptr[2], *output_ptr, *p; int *input_ptr[2], *output_ptr, *p;
int err; int err;
@@ -194,7 +191,7 @@ int test_integer_sub_sat(cl_device_id device, cl_context context, cl_command_que
MTdata d; MTdata d;
int fail_count = 0; int fail_count = 0;
size_t length = sizeof(int) * 4 * n_elems; size_t length = sizeof(int) * 4 * num_elements;
input_ptr[0] = (int*)malloc(length); input_ptr[0] = (int*)malloc(length);
input_ptr[1] = (int*)malloc(length); input_ptr[1] = (int*)malloc(length);
@@ -202,11 +199,9 @@ int test_integer_sub_sat(cl_device_id device, cl_context context, cl_command_que
d = init_genrand( gRandomSeed ); d = init_genrand( gRandomSeed );
p = input_ptr[0]; p = input_ptr[0];
for (i=0; i<4 * (cl_uint) n_elems; i++) for (i = 0; i < 4 * (cl_uint)num_elements; i++) p[i] = genrand_int32(d);
p[i] = genrand_int32(d);
p = input_ptr[1]; p = input_ptr[1];
for (i=0; i<4 * (cl_uint) n_elems; i++) for (i = 0; i < 4 * (cl_uint)num_elements; i++) p[i] = genrand_int32(d);
p[i] = genrand_int32(d);
free_mtdata(d); d = NULL; free_mtdata(d); d = NULL;
for( type = 0; type < sizeof( test_str_names ) / sizeof( test_str_names[0] ); type++ ) for( type = 0; type < sizeof( test_str_names ) / sizeof( test_str_names[0] ); type++ )
@@ -374,5 +369,3 @@ int test_integer_sub_sat(cl_device_id device, cl_context context, cl_command_que
return err; return err;
} }

View File

@@ -198,17 +198,17 @@ int test_unary_op_set( cl_command_queue queue, cl_context context, OpKonstants w
return retVal; return retVal;
} }
int test_unary_ops_full(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(unary_ops_full)
{ {
return test_unary_op_set( queue, context, kBoth ); return test_unary_op_set( queue, context, kBoth );
} }
int test_unary_ops_increment(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(unary_ops_increment)
{ {
return test_unary_op_set( queue, context, kIncrement ); return test_unary_op_set( queue, context, kIncrement );
} }
int test_unary_ops_decrement(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(unary_ops_decrement)
{ {
return test_unary_op_set( queue, context, kDecrement ); return test_unary_op_set( queue, context, kDecrement );
} }

View File

@@ -220,7 +220,7 @@ void * create_upsample_data( ExplicitType type, void *sourceA, void *sourceB, si
return outData; return outData;
} }
int test_integer_upsample(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(integer_upsample)
{ {
ExplicitType typesToTest[] = { kChar, kUChar, kShort, kUShort, kInt, kUInt, kNumExplicitTypes }; ExplicitType typesToTest[] = { kChar, kUChar, kShort, kUShort, kInt, kUInt, kNumExplicitTypes };
ExplicitType baseTypes[] = { kUChar, kUChar, kUShort, kUShort, kUInt, kUInt, kNumExplicitTypes }; ExplicitType baseTypes[] = { kUChar, kUChar, kUShort, kUShort, kUInt, kUInt, kNumExplicitTypes };
@@ -264,5 +264,3 @@ int test_integer_upsample(cl_device_id deviceID, cl_context context, cl_command_
} }
return err; return err;
} }

View File

@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "harness/compat.h" #include "testBase.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -22,7 +22,6 @@
#include <cinttypes> #include <cinttypes>
#include "procs.h"
#include "harness/conversions.h" #include "harness/conversions.h"
extern MTdata d; extern MTdata d;
@@ -81,11 +80,6 @@ const char *test_names[] = {
"!", // 22 "!", // 22
}; };
const size_t vector_aligns[] = {0, 1, 2, 4, 4,
8, 8, 8, 8,
16, 16, 16, 16,
16, 16, 16, 16};
// ======================================= // =======================================
// long // long
// ======================================= // =======================================