mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Migrate generic_address_space suite to the new test registration framework (#2333)
Contributes to https://github.com/KhronosGroup/OpenCL-CTS/issues/2181. Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
This commit is contained in:
@@ -293,7 +293,8 @@ private:
|
||||
const ExtraKernelArgMemType _extraKernelArgMemType;
|
||||
};
|
||||
|
||||
int test_library_function(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) {
|
||||
REGISTER_TEST(library_function)
|
||||
{
|
||||
const std::string LIBRARY_FUNCTION = common::CONFORMANCE_VERIFY_FENCE +
|
||||
NL
|
||||
NL "bool helperFunction(float *floatp, float val) {"
|
||||
@@ -340,10 +341,11 @@ __kernel void testKernel(__global uint *results) {
|
||||
|
||||
CAdvancedTest test(LIBRARY_FUNCTION, KERNEL_FUNCTION);
|
||||
|
||||
return test.Execute(deviceID, context, queue, num_elements);
|
||||
return test.Execute(device, context, queue, num_elements);
|
||||
}
|
||||
|
||||
int test_generic_variable_volatile(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) {
|
||||
REGISTER_TEST(generic_variable_volatile)
|
||||
{
|
||||
std::vector<std::string> KERNEL_FUNCTIONS;
|
||||
|
||||
KERNEL_FUNCTIONS.push_back(common::CONFORMANCE_VERIFY_FENCE +
|
||||
@@ -420,10 +422,11 @@ int test_generic_variable_volatile(cl_device_id deviceID, cl_context context, cl
|
||||
|
||||
CAdvancedTest test(KERNEL_FUNCTIONS);
|
||||
|
||||
return test.Execute(deviceID, context, queue, num_elements);
|
||||
return test.Execute(device, context, queue, num_elements);
|
||||
}
|
||||
|
||||
int test_generic_variable_const(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) {
|
||||
REGISTER_TEST(generic_variable_const)
|
||||
{
|
||||
std::vector<std::string> KERNEL_FUNCTIONS;
|
||||
|
||||
KERNEL_FUNCTIONS.push_back(common::CONFORMANCE_VERIFY_FENCE +
|
||||
@@ -474,10 +477,11 @@ int test_generic_variable_const(cl_device_id deviceID, cl_context context, cl_co
|
||||
|
||||
CAdvancedTest test(KERNEL_FUNCTIONS);
|
||||
|
||||
return test.Execute(deviceID, context, queue, num_elements);
|
||||
return test.Execute(device, context, queue, num_elements);
|
||||
}
|
||||
|
||||
int test_generic_variable_gentype(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) {
|
||||
REGISTER_TEST(generic_variable_gentype)
|
||||
{
|
||||
const std::string KERNEL_FUNCTION_TEMPLATE = common::CONFORMANCE_VERIFY_FENCE +
|
||||
NL
|
||||
NL "%s"
|
||||
@@ -531,7 +535,8 @@ int test_generic_variable_gentype(cl_device_id deviceID, cl_context context, cl_
|
||||
const std::string cl_khr_fp64_pragma = "#pragma OPENCL EXTENSION cl_khr_fp64 : enable";
|
||||
|
||||
// Add double floating types if they are supported
|
||||
if (is_extension_available(deviceID, "cl_khr_fp64")) {
|
||||
if (is_extension_available(device, "cl_khr_fp64"))
|
||||
{
|
||||
for (size_t j = 0; j < sizeof(vector_sizes) / sizeof(vector_sizes[0]); j++) {
|
||||
for (size_t k = 0; k < sizeof(address_spaces) / sizeof(address_spaces[0]); k++) {
|
||||
char temp_kernel[1024];
|
||||
@@ -551,7 +556,8 @@ int test_generic_variable_gentype(cl_device_id deviceID, cl_context context, cl_
|
||||
const std::string cl_khr_fp16_pragma = "#pragma OPENCL EXTENSION cl_khr_fp16 : enable";
|
||||
|
||||
// Add half floating types if they are supported
|
||||
if (is_extension_available(deviceID, "cl_khr_fp16")) {
|
||||
if (is_extension_available(device, "cl_khr_fp16"))
|
||||
{
|
||||
for (size_t j = 0; j < sizeof(vector_sizes) / sizeof(vector_sizes[0]); j++) {
|
||||
for (size_t k = 0; k < sizeof(address_spaces) / sizeof(address_spaces[0]); k++) {
|
||||
char temp_kernel[1024];
|
||||
@@ -586,7 +592,7 @@ int test_generic_variable_gentype(cl_device_id deviceID, cl_context context, cl_
|
||||
|
||||
CAdvancedTest test(KERNEL_FUNCTIONS);
|
||||
|
||||
return test.Execute(deviceID, context, queue, num_elements);
|
||||
return test.Execute(device, context, queue, num_elements);
|
||||
}
|
||||
|
||||
void create_math_kernels(std::vector<std::string>& KERNEL_FUNCTIONS) {
|
||||
@@ -919,19 +925,21 @@ void create_vstore_kernels(std::vector<std::string>& KERNEL_FUNCTIONS, cl_device
|
||||
}
|
||||
}
|
||||
|
||||
int test_builtin_functions(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) {
|
||||
REGISTER_TEST(builtin_functions)
|
||||
{
|
||||
std::vector<std::string> KERNEL_FUNCTIONS;
|
||||
|
||||
create_math_kernels(KERNEL_FUNCTIONS);
|
||||
create_vload_kernels(KERNEL_FUNCTIONS, deviceID);
|
||||
create_vstore_kernels(KERNEL_FUNCTIONS, deviceID);
|
||||
create_vload_kernels(KERNEL_FUNCTIONS, device);
|
||||
create_vstore_kernels(KERNEL_FUNCTIONS, device);
|
||||
|
||||
CAdvancedTest test(KERNEL_FUNCTIONS);
|
||||
|
||||
return test.Execute(deviceID, context, queue, num_elements);
|
||||
return test.Execute(device, context, queue, num_elements);
|
||||
}
|
||||
|
||||
int test_generic_advanced_casting(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) {
|
||||
REGISTER_TEST(generic_advanced_casting)
|
||||
{
|
||||
std::vector<std::string> KERNEL_FUNCTIONS;
|
||||
|
||||
KERNEL_FUNCTIONS.push_back(
|
||||
@@ -980,18 +988,20 @@ int test_generic_advanced_casting(cl_device_id deviceID, cl_context context, cl_
|
||||
|
||||
CAdvancedTest test(KERNEL_FUNCTIONS);
|
||||
|
||||
return test.Execute(deviceID, context, queue, num_elements);
|
||||
return test.Execute(device, context, queue, num_elements);
|
||||
}
|
||||
|
||||
int test_generic_ptr_to_host_mem_svm(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) {
|
||||
REGISTER_TEST(generic_ptr_to_host_mem_svm)
|
||||
{
|
||||
cl_int result = CL_SUCCESS;
|
||||
|
||||
/* Test SVM capabilities and select matching tests */
|
||||
cl_device_svm_capabilities caps;
|
||||
auto version = get_device_cl_version(deviceID);
|
||||
auto version = get_device_cl_version(device);
|
||||
auto expected_min_version = Version(2, 0);
|
||||
|
||||
cl_int error = clGetDeviceInfo(deviceID, CL_DEVICE_SVM_CAPABILITIES, sizeof(caps), &caps, NULL);
|
||||
cl_int error = clGetDeviceInfo(device, CL_DEVICE_SVM_CAPABILITIES,
|
||||
sizeof(caps), &caps, NULL);
|
||||
test_error(error, "clGetDeviceInfo(CL_DEVICE_SVM_CAPABILITIES) failed");
|
||||
|
||||
if ((version < expected_min_version)
|
||||
@@ -1000,35 +1010,40 @@ int test_generic_ptr_to_host_mem_svm(cl_device_id deviceID, cl_context context,
|
||||
|
||||
if (caps & CL_DEVICE_SVM_COARSE_GRAIN_BUFFER) {
|
||||
CAdvancedTest test_global_svm_ptr(common::GLOBAL_KERNEL_FUNCTION, ARG_TYPE_COARSE_GRAINED_SVM);
|
||||
result |= test_global_svm_ptr.Execute(deviceID, context, queue, num_elements);
|
||||
result |=
|
||||
test_global_svm_ptr.Execute(device, context, queue, num_elements);
|
||||
}
|
||||
|
||||
if (caps & CL_DEVICE_SVM_FINE_GRAIN_BUFFER) {
|
||||
CAdvancedTest test_global_svm_ptr(common::GLOBAL_KERNEL_FUNCTION, ARG_TYPE_FINE_GRAINED_BUFFER_SVM);
|
||||
result |= test_global_svm_ptr.Execute(deviceID, context, queue, num_elements);
|
||||
result |=
|
||||
test_global_svm_ptr.Execute(device, context, queue, num_elements);
|
||||
}
|
||||
|
||||
if (caps & CL_DEVICE_SVM_FINE_GRAIN_SYSTEM) {
|
||||
CAdvancedTest test_global_svm_ptr(common::GLOBAL_KERNEL_FUNCTION, ARG_TYPE_FINE_GRAINED_SYSTEM_SVM);
|
||||
result |= test_global_svm_ptr.Execute(deviceID, context, queue, num_elements);
|
||||
result |=
|
||||
test_global_svm_ptr.Execute(device, context, queue, num_elements);
|
||||
}
|
||||
|
||||
if (caps & CL_DEVICE_SVM_ATOMICS) {
|
||||
CAdvancedTest test_global_svm_ptr(common::GLOBAL_KERNEL_FUNCTION, ARG_TYPE_ATOMICS_SVM);
|
||||
result |= test_global_svm_ptr.Execute(deviceID, context, queue, num_elements);
|
||||
result |=
|
||||
test_global_svm_ptr.Execute(device, context, queue, num_elements);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int test_generic_ptr_to_host_mem(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) {
|
||||
REGISTER_TEST(generic_ptr_to_host_mem)
|
||||
{
|
||||
cl_int result = CL_SUCCESS;
|
||||
|
||||
CAdvancedTest test_global_ptr(common::GLOBAL_KERNEL_FUNCTION, ARG_TYPE_HOST_PTR);
|
||||
result |= test_global_ptr.Execute(deviceID, context, queue, num_elements);
|
||||
result |= test_global_ptr.Execute(device, context, queue, num_elements);
|
||||
|
||||
CAdvancedTest test_local_ptr(common::LOCAL_KERNEL_FUNCTION, ARG_TYPE_HOST_LOCAL);
|
||||
result |= test_local_ptr.Execute(deviceID, context, queue, num_elements / 64);
|
||||
result |= test_local_ptr.Execute(device, context, queue, num_elements / 64);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user