mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Migrate atomics suite to the new test registration framework (#2189)
Contributes to #2181
This commit is contained in:
@@ -13,39 +13,11 @@
|
|||||||
// 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 <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "procs.h"
|
|
||||||
#include "harness/testHarness.h"
|
#include "harness/testHarness.h"
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
test_definition test_list[] = {
|
|
||||||
ADD_TEST( atomic_add ),
|
|
||||||
ADD_TEST( atomic_sub ),
|
|
||||||
ADD_TEST( atomic_xchg ),
|
|
||||||
ADD_TEST( atomic_min ),
|
|
||||||
ADD_TEST( atomic_max ),
|
|
||||||
ADD_TEST( atomic_inc ),
|
|
||||||
ADD_TEST( atomic_dec ),
|
|
||||||
ADD_TEST( atomic_cmpxchg ),
|
|
||||||
ADD_TEST( atomic_and ),
|
|
||||||
ADD_TEST( atomic_or ),
|
|
||||||
ADD_TEST( atomic_xor ),
|
|
||||||
|
|
||||||
ADD_TEST( atomic_add_index ),
|
|
||||||
ADD_TEST( atomic_add_index_bin ),
|
|
||||||
};
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
const int test_num = ARRAY_SIZE(test_list);
|
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
int main(int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
return runTestHarness(argc, argv, test_num, test_list, false, 0);
|
return runTestHarness(argc, argv, test_registry::getInstance().num_tests(),
|
||||||
|
test_registry::getInstance().definitions(), false, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
//
|
|
||||||
// Copyright (c) 2017 The Khronos Group Inc.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
//
|
|
||||||
#include "harness/errorHelpers.h"
|
|
||||||
#include "harness/kernelHelpers.h"
|
|
||||||
#include "harness/typeWrappers.h"
|
|
||||||
|
|
||||||
extern int create_program_and_kernel(const char *source,
|
|
||||||
const char *kernel_name,
|
|
||||||
cl_program *program_ret,
|
|
||||||
cl_kernel *kernel_ret);
|
|
||||||
|
|
||||||
extern int test_atomic_add(cl_device_id deviceID, cl_context context,
|
|
||||||
cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_atomic_sub(cl_device_id deviceID, cl_context context,
|
|
||||||
cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_atomic_xchg(cl_device_id deviceID, cl_context context,
|
|
||||||
cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_atomic_min(cl_device_id deviceID, cl_context context,
|
|
||||||
cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_atomic_max(cl_device_id deviceID, cl_context context,
|
|
||||||
cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_atomic_inc(cl_device_id deviceID, cl_context context,
|
|
||||||
cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_atomic_dec(cl_device_id deviceID, cl_context context,
|
|
||||||
cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_atomic_cmpxchg(cl_device_id deviceID, cl_context context,
|
|
||||||
cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_atomic_and(cl_device_id deviceID, cl_context context,
|
|
||||||
cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_atomic_or(cl_device_id deviceID, cl_context context,
|
|
||||||
cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_atomic_xor(cl_device_id deviceID, cl_context context,
|
|
||||||
cl_command_queue queue, int num_elements);
|
|
||||||
|
|
||||||
extern int test_atomic_add_index(cl_device_id deviceID, cl_context context,
|
|
||||||
cl_command_queue queue, int num_elements);
|
|
||||||
extern int test_atomic_add_index_bin(cl_device_id deviceID, cl_context context,
|
|
||||||
cl_command_queue queue, int num_elements);
|
|
||||||
@@ -1,28 +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.
|
|
||||||
//
|
|
||||||
#ifndef _testBase_h
|
|
||||||
#define _testBase_h
|
|
||||||
|
|
||||||
#include "harness/compat.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#include "procs.h"
|
|
||||||
|
|
||||||
#endif // _testBase_h
|
|
||||||
@@ -13,11 +13,8 @@
|
|||||||
// 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 "testBase.h"
|
|
||||||
#include "harness/conversions.h"
|
#include "harness/conversions.h"
|
||||||
#ifndef _WIN32
|
#include "harness/typeWrappers.h"
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
|
|
||||||
@@ -568,8 +565,7 @@ cl_long test_atomic_add_result_long(size_t size, cl_long *startRefValues,
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_atomic_add(cl_device_id deviceID, cl_context context,
|
REGISTER_TEST(atomic_add)
|
||||||
cl_command_queue queue, int num_elements)
|
|
||||||
{
|
{
|
||||||
TestFns set = { 0,
|
TestFns set = { 0,
|
||||||
0LL,
|
0LL,
|
||||||
@@ -582,12 +578,12 @@ int test_atomic_add(cl_device_id deviceID, cl_context context,
|
|||||||
NULL };
|
NULL };
|
||||||
|
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atom_add_core, set, false,
|
device, context, queue, num_elements, atom_add_core, set, false,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atomic_add_core, set, false,
|
device, context, queue, num_elements, atomic_add_core, set, false,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -618,8 +614,7 @@ cl_long test_atomic_sub_result_long(size_t size, cl_long *startRefValues,
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_atomic_sub(cl_device_id deviceID, cl_context context,
|
REGISTER_TEST(atomic_sub)
|
||||||
cl_command_queue queue, int num_elements)
|
|
||||||
{
|
{
|
||||||
TestFns set = { INT_TEST_VALUE,
|
TestFns set = { INT_TEST_VALUE,
|
||||||
LONG_TEST_VALUE,
|
LONG_TEST_VALUE,
|
||||||
@@ -632,12 +627,12 @@ int test_atomic_sub(cl_device_id deviceID, cl_context context,
|
|||||||
NULL };
|
NULL };
|
||||||
|
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atom_sub_core, set, false,
|
device, context, queue, num_elements, atom_sub_core, set, false,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atomic_sub_core, set, false,
|
device, context, queue, num_elements, atomic_sub_core, set, false,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -852,8 +847,7 @@ bool test_atomic_xchg_verify_float(size_t size, cl_float *refValues,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_atomic_xchg(cl_device_id deviceID, cl_context context,
|
REGISTER_TEST(atomic_xchg)
|
||||||
cl_command_queue queue, int num_elements)
|
|
||||||
{
|
{
|
||||||
TestFns set = { INT_TEST_VALUE,
|
TestFns set = { INT_TEST_VALUE,
|
||||||
LONG_TEST_VALUE,
|
LONG_TEST_VALUE,
|
||||||
@@ -868,17 +862,17 @@ int test_atomic_xchg(cl_device_id deviceID, cl_context context,
|
|||||||
NULL,
|
NULL,
|
||||||
test_atomic_xchg_verify_float };
|
test_atomic_xchg_verify_float };
|
||||||
|
|
||||||
int errors = test_atomic_function_set(
|
int errors = test_atomic_function_set(device, context, queue, num_elements,
|
||||||
deviceID, context, queue, num_elements, atom_xchg_core, set, false,
|
atom_xchg_core, set, false, true,
|
||||||
true, /*usingAtomicPrefix*/ false);
|
/*usingAtomicPrefix*/ false);
|
||||||
errors |= test_atomic_function_set(deviceID, context, queue, num_elements,
|
errors |= test_atomic_function_set(device, context, queue, num_elements,
|
||||||
atomic_xchg_core, set, false, true,
|
atomic_xchg_core, set, false, true,
|
||||||
/*usingAtomicPrefix*/ true);
|
/*usingAtomicPrefix*/ true);
|
||||||
|
|
||||||
errors |= test_atomic_function(deviceID, context, queue, num_elements,
|
errors |= test_atomic_function(device, context, queue, num_elements,
|
||||||
atomic_xchg_float_core, set, false, false,
|
atomic_xchg_float_core, set, false, false,
|
||||||
kFloat, true);
|
kFloat, true);
|
||||||
errors |= test_atomic_function(deviceID, context, queue, num_elements,
|
errors |= test_atomic_function(device, context, queue, num_elements,
|
||||||
atomic_xchg_float_core, set, false, true,
|
atomic_xchg_float_core, set, false, true,
|
||||||
kFloat, true);
|
kFloat, true);
|
||||||
|
|
||||||
@@ -931,8 +925,7 @@ void test_atomic_min_gen_long(size_t size, cl_long *startRefValues, MTdata d)
|
|||||||
| (((cl_long)genrand_int32(d) & 0x7fffffffL) << 16));
|
| (((cl_long)genrand_int32(d) & 0x7fffffffL) << 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_atomic_min(cl_device_id deviceID, cl_context context,
|
REGISTER_TEST(atomic_min)
|
||||||
cl_command_queue queue, int num_elements)
|
|
||||||
{
|
{
|
||||||
TestFns set = { 0x7fffffffL,
|
TestFns set = { 0x7fffffffL,
|
||||||
0x7fffffffffffffffLL,
|
0x7fffffffffffffffLL,
|
||||||
@@ -945,12 +938,12 @@ int test_atomic_min(cl_device_id deviceID, cl_context context,
|
|||||||
NULL };
|
NULL };
|
||||||
|
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atom_min_core, set, true,
|
device, context, queue, num_elements, atom_min_core, set, true,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atomic_min_core, set, true,
|
device, context, queue, num_elements, atomic_min_core, set, true,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1003,8 +996,7 @@ void test_atomic_max_gen_long(size_t size, cl_long *startRefValues, MTdata d)
|
|||||||
| (((cl_long)genrand_int32(d) & 0x7fffffffL) << 16));
|
| (((cl_long)genrand_int32(d) & 0x7fffffffL) << 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_atomic_max(cl_device_id deviceID, cl_context context,
|
REGISTER_TEST(atomic_max)
|
||||||
cl_command_queue queue, int num_elements)
|
|
||||||
{
|
{
|
||||||
TestFns set = { 0,
|
TestFns set = { 0,
|
||||||
0,
|
0,
|
||||||
@@ -1017,12 +1009,12 @@ int test_atomic_max(cl_device_id deviceID, cl_context context,
|
|||||||
NULL };
|
NULL };
|
||||||
|
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atom_max_core, set, true,
|
device, context, queue, num_elements, atom_max_core, set, true,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atomic_max_core, set, true,
|
device, context, queue, num_elements, atomic_max_core, set, true,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1050,8 +1042,7 @@ cl_long test_atomic_inc_result_long(size_t size, cl_long *startRefValues,
|
|||||||
return LONG_TEST_VALUE + size;
|
return LONG_TEST_VALUE + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_atomic_inc(cl_device_id deviceID, cl_context context,
|
REGISTER_TEST(atomic_inc)
|
||||||
cl_command_queue queue, int num_elements)
|
|
||||||
{
|
{
|
||||||
TestFns set = { INT_TEST_VALUE,
|
TestFns set = { INT_TEST_VALUE,
|
||||||
LONG_TEST_VALUE,
|
LONG_TEST_VALUE,
|
||||||
@@ -1064,12 +1055,12 @@ int test_atomic_inc(cl_device_id deviceID, cl_context context,
|
|||||||
NULL };
|
NULL };
|
||||||
|
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atom_inc_core, set, false,
|
device, context, queue, num_elements, atom_inc_core, set, false,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atomic_inc_core, set, false,
|
device, context, queue, num_elements, atomic_inc_core, set, false,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1097,8 +1088,7 @@ cl_long test_atomic_dec_result_long(size_t size, cl_long *startRefValues,
|
|||||||
return LONG_TEST_VALUE - size;
|
return LONG_TEST_VALUE - size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_atomic_dec(cl_device_id deviceID, cl_context context,
|
REGISTER_TEST(atomic_dec)
|
||||||
cl_command_queue queue, int num_elements)
|
|
||||||
{
|
{
|
||||||
TestFns set = { INT_TEST_VALUE,
|
TestFns set = { INT_TEST_VALUE,
|
||||||
LONG_TEST_VALUE,
|
LONG_TEST_VALUE,
|
||||||
@@ -1111,12 +1101,12 @@ int test_atomic_dec(cl_device_id deviceID, cl_context context,
|
|||||||
NULL };
|
NULL };
|
||||||
|
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atom_dec_core, set, false,
|
device, context, queue, num_elements, atom_dec_core, set, false,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atomic_dec_core, set, false,
|
device, context, queue, num_elements, atomic_dec_core, set, false,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1172,8 +1162,7 @@ cl_long test_atomic_cmpxchg_result_long(size_t size, cl_long *startRefValues,
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_atomic_cmpxchg(cl_device_id deviceID, cl_context context,
|
REGISTER_TEST(atomic_cmpxchg)
|
||||||
cl_command_queue queue, int num_elements)
|
|
||||||
{
|
{
|
||||||
TestFns set = { INT_TEST_VALUE,
|
TestFns set = { INT_TEST_VALUE,
|
||||||
LONG_TEST_VALUE,
|
LONG_TEST_VALUE,
|
||||||
@@ -1189,42 +1178,42 @@ int test_atomic_cmpxchg(cl_device_id deviceID, cl_context context,
|
|||||||
|
|
||||||
log_info(" Testing atom_ functions...\n");
|
log_info(" Testing atom_ functions...\n");
|
||||||
errors |=
|
errors |=
|
||||||
test_atomic_function(deviceID, context, queue, num_elements,
|
test_atomic_function(device, context, queue, num_elements,
|
||||||
atom_cmpxchg_core, set, false, false, kInt, true);
|
atom_cmpxchg_core, set, false, false, kInt, true);
|
||||||
errors |=
|
errors |=
|
||||||
test_atomic_function(deviceID, context, queue, num_elements,
|
test_atomic_function(device, context, queue, num_elements,
|
||||||
atom_cmpxchg_core, set, false, false, kUInt, true);
|
atom_cmpxchg_core, set, false, false, kUInt, true);
|
||||||
errors |=
|
errors |=
|
||||||
test_atomic_function(deviceID, context, queue, num_elements,
|
test_atomic_function(device, context, queue, num_elements,
|
||||||
atom_cmpxchg_core, set, false, true, kInt, true);
|
atom_cmpxchg_core, set, false, true, kInt, true);
|
||||||
errors |=
|
errors |=
|
||||||
test_atomic_function(deviceID, context, queue, num_elements,
|
test_atomic_function(device, context, queue, num_elements,
|
||||||
atom_cmpxchg_core, set, false, true, kUInt, true);
|
atom_cmpxchg_core, set, false, true, kUInt, true);
|
||||||
|
|
||||||
errors |= test_atomic_function(deviceID, context, queue, num_elements,
|
errors |= test_atomic_function(device, context, queue, num_elements,
|
||||||
atom_cmpxchg64_core, set, false, false,
|
atom_cmpxchg64_core, set, false, false,
|
||||||
kLong, true);
|
kLong, true);
|
||||||
errors |= test_atomic_function(deviceID, context, queue, num_elements,
|
errors |= test_atomic_function(device, context, queue, num_elements,
|
||||||
atom_cmpxchg64_core, set, false, false,
|
atom_cmpxchg64_core, set, false, false,
|
||||||
kULong, true);
|
kULong, true);
|
||||||
errors |= test_atomic_function(deviceID, context, queue, num_elements,
|
errors |= test_atomic_function(device, context, queue, num_elements,
|
||||||
atom_cmpxchg64_core, set, false, true, kLong,
|
atom_cmpxchg64_core, set, false, true, kLong,
|
||||||
true);
|
true);
|
||||||
errors |= test_atomic_function(deviceID, context, queue, num_elements,
|
errors |= test_atomic_function(device, context, queue, num_elements,
|
||||||
atom_cmpxchg64_core, set, false, true,
|
atom_cmpxchg64_core, set, false, true,
|
||||||
kULong, true);
|
kULong, true);
|
||||||
|
|
||||||
log_info(" Testing atomic_ functions...\n");
|
log_info(" Testing atomic_ functions...\n");
|
||||||
errors |= test_atomic_function(deviceID, context, queue, num_elements,
|
errors |= test_atomic_function(device, context, queue, num_elements,
|
||||||
atomic_cmpxchg_core, set, false, false, kInt,
|
atomic_cmpxchg_core, set, false, false, kInt,
|
||||||
true);
|
true);
|
||||||
errors |= test_atomic_function(deviceID, context, queue, num_elements,
|
errors |= test_atomic_function(device, context, queue, num_elements,
|
||||||
atomic_cmpxchg_core, set, false, false,
|
atomic_cmpxchg_core, set, false, false,
|
||||||
kUInt, true);
|
kUInt, true);
|
||||||
errors |=
|
errors |=
|
||||||
test_atomic_function(deviceID, context, queue, num_elements,
|
test_atomic_function(device, context, queue, num_elements,
|
||||||
atomic_cmpxchg_core, set, false, true, kInt, true);
|
atomic_cmpxchg_core, set, false, true, kInt, true);
|
||||||
errors |= test_atomic_function(deviceID, context, queue, num_elements,
|
errors |= test_atomic_function(device, context, queue, num_elements,
|
||||||
atomic_cmpxchg_core, set, false, true, kUInt,
|
atomic_cmpxchg_core, set, false, true, kUInt,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
@@ -1289,8 +1278,7 @@ cl_long test_atomic_and_result_long(size_t size, cl_long *startRefValues,
|
|||||||
return bits;
|
return bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_atomic_and(cl_device_id deviceID, cl_context context,
|
REGISTER_TEST(atomic_and)
|
||||||
cl_command_queue queue, int num_elements)
|
|
||||||
{
|
{
|
||||||
TestFns set = { (cl_int)0xffffffff,
|
TestFns set = { (cl_int)0xffffffff,
|
||||||
(cl_long)0xffffffffffffffffLL,
|
(cl_long)0xffffffffffffffffLL,
|
||||||
@@ -1303,12 +1291,12 @@ int test_atomic_and(cl_device_id deviceID, cl_context context,
|
|||||||
NULL };
|
NULL };
|
||||||
|
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atom_and_core, set, true,
|
device, context, queue, num_elements, atom_and_core, set, true,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atomic_and_core, set, true,
|
device, context, queue, num_elements, atomic_and_core, set, true,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1362,8 +1350,7 @@ cl_long test_atomic_or_result_long(size_t size, cl_long *startRefValues,
|
|||||||
return bits;
|
return bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_atomic_or(cl_device_id deviceID, cl_context context,
|
REGISTER_TEST(atomic_or)
|
||||||
cl_command_queue queue, int num_elements)
|
|
||||||
{
|
{
|
||||||
TestFns set = {
|
TestFns set = {
|
||||||
0, 0LL, test_bitwise_num_results, test_atomic_or_result_int,
|
0, 0LL, test_bitwise_num_results, test_atomic_or_result_int,
|
||||||
@@ -1372,12 +1359,12 @@ int test_atomic_or(cl_device_id deviceID, cl_context context,
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atom_or_core, set, true,
|
device, context, queue, num_elements, atom_or_core, set, true,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atomic_or_core, set, true,
|
device, context, queue, num_elements, atomic_or_core, set, true,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1415,8 +1402,7 @@ cl_long test_atomic_xor_result_long(size_t size, cl_long *startRefValues,
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_atomic_xor(cl_device_id deviceID, cl_context context,
|
REGISTER_TEST(atomic_xor)
|
||||||
cl_command_queue queue, int num_elements)
|
|
||||||
{
|
{
|
||||||
TestFns set = { 0x2f08ab41,
|
TestFns set = { 0x2f08ab41,
|
||||||
0x2f08ab418ba0541LL,
|
0x2f08ab418ba0541LL,
|
||||||
@@ -1429,12 +1415,12 @@ int test_atomic_xor(cl_device_id deviceID, cl_context context,
|
|||||||
NULL };
|
NULL };
|
||||||
|
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atom_xor_core, set, true,
|
device, context, queue, num_elements, atom_xor_core, set, true,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ false)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (test_atomic_function_set(
|
if (test_atomic_function_set(
|
||||||
deviceID, context, queue, num_elements, atomic_xor_core, set, true,
|
device, context, queue, num_elements, atomic_xor_core, set, true,
|
||||||
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
/*matchGroupSize*/ false, /*usingAtomicPrefix*/ true)
|
||||||
!= 0)
|
!= 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "testBase.h"
|
|
||||||
#include "harness/conversions.h"
|
#include "harness/conversions.h"
|
||||||
|
#include "harness/typeWrappers.h"
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
const char *atomic_index_source =
|
const char *atomic_index_source =
|
||||||
@@ -36,8 +36,7 @@ const char *atomic_index_source =
|
|||||||
"}";
|
"}";
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
int test_atomic_add_index(cl_device_id deviceID, cl_context context,
|
REGISTER_TEST(atomic_add_index)
|
||||||
cl_command_queue queue, int num_elements)
|
|
||||||
{
|
{
|
||||||
clProgramWrapper program;
|
clProgramWrapper program;
|
||||||
clKernelWrapper kernel;
|
clKernelWrapper kernel;
|
||||||
@@ -46,7 +45,7 @@ int test_atomic_add_index(cl_device_id deviceID, cl_context context,
|
|||||||
int fail = 0, err;
|
int fail = 0, err;
|
||||||
|
|
||||||
/* Check if atomics are supported. */
|
/* Check if atomics are supported. */
|
||||||
if (!is_extension_available(deviceID, "cl_khr_global_int32_base_atomics"))
|
if (!is_extension_available(device, "cl_khr_global_int32_base_atomics"))
|
||||||
{
|
{
|
||||||
log_info("Base atomics not supported "
|
log_info("Base atomics not supported "
|
||||||
"(cl_khr_global_int32_base_atomics). Skipping test.\n");
|
"(cl_khr_global_int32_base_atomics). Skipping test.\n");
|
||||||
@@ -474,8 +473,7 @@ int add_index_bin_test(size_t *global_threads, cl_command_queue queue,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_atomic_add_index_bin(cl_device_id deviceID, cl_context context,
|
REGISTER_TEST(atomic_add_index_bin)
|
||||||
cl_command_queue queue, int num_elements)
|
|
||||||
{
|
{
|
||||||
//===== add_index_bin test
|
//===== add_index_bin test
|
||||||
size_t numGlobalThreads = 2048;
|
size_t numGlobalThreads = 2048;
|
||||||
@@ -484,7 +482,7 @@ int test_atomic_add_index_bin(cl_device_id deviceID, cl_context context,
|
|||||||
MTdata d = init_genrand(gRandomSeed);
|
MTdata d = init_genrand(gRandomSeed);
|
||||||
|
|
||||||
/* Check if atomics are supported. */
|
/* Check if atomics are supported. */
|
||||||
if (!is_extension_available(deviceID, "cl_khr_global_int32_base_atomics"))
|
if (!is_extension_available(device, "cl_khr_global_int32_base_atomics"))
|
||||||
{
|
{
|
||||||
log_info("Base atomics not supported "
|
log_info("Base atomics not supported "
|
||||||
"(cl_khr_global_int32_base_atomics). Skipping test.\n");
|
"(cl_khr_global_int32_base_atomics). Skipping test.\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user