Migrate API suite to the new test registration framework (#2196)

Contributes to #2181

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
This commit is contained in:
Ahmed Hesham
2024-12-18 17:29:08 +00:00
committed by GitHub
parent 2316c6343f
commit 794d332bab
40 changed files with 803 additions and 1254 deletions

View File

@@ -13,164 +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
// FIXME: To use certain functions in harness/imageHelpers.h
// (for example, generate_random_image_data()), the tests are required to
// declare the following variables (<rdar://problem/11111245>):
test_definition test_list[] = {
ADD_TEST(get_platform_info),
ADD_TEST_VERSION(get_sampler_info, Version(2, 0)),
ADD_TEST(get_sampler_info_compatibility),
ADD_TEST_VERSION(get_command_queue_info, Version(2, 0)),
ADD_TEST(get_command_queue_info_compatibility),
ADD_TEST(get_context_info),
ADD_TEST(get_device_info),
ADD_TEST(enqueue_task),
ADD_TEST(binary_get),
ADD_TEST(binary_create),
ADD_TEST(kernel_required_group_size),
ADD_TEST(release_kernel_order),
ADD_TEST(release_during_execute),
ADD_TEST(load_single_kernel),
ADD_TEST(load_two_kernels),
ADD_TEST(load_two_kernels_in_one),
ADD_TEST(load_two_kernels_manually),
ADD_TEST(get_program_info_kernel_names),
ADD_TEST(get_kernel_arg_info),
ADD_TEST(create_kernels_in_program),
ADD_TEST(get_kernel_info),
ADD_TEST(kernel_private_memory_size),
ADD_TEST(execute_kernel_local_sizes),
ADD_TEST(set_kernel_arg_by_index),
ADD_TEST(set_kernel_arg_constant),
ADD_TEST(set_kernel_arg_struct_array),
ADD_TEST(kernel_global_constant),
ADD_TEST(kernel_attributes),
ADD_TEST(min_max_thread_dimensions),
ADD_TEST(min_max_work_items_sizes),
ADD_TEST(min_max_work_group_size),
ADD_TEST(min_max_read_image_args),
ADD_TEST(min_max_write_image_args),
ADD_TEST(min_max_mem_alloc_size),
ADD_TEST(min_max_image_2d_width),
ADD_TEST(min_max_image_2d_height),
ADD_TEST(min_max_image_3d_width),
ADD_TEST(min_max_image_3d_height),
ADD_TEST(min_max_image_3d_depth),
ADD_TEST(min_max_image_array_size),
ADD_TEST(min_max_image_buffer_size),
ADD_TEST(min_max_parameter_size),
ADD_TEST(min_max_samplers),
ADD_TEST(min_max_constant_buffer_size),
ADD_TEST(min_max_constant_args),
ADD_TEST(min_max_compute_units),
ADD_TEST(min_max_address_bits),
ADD_TEST(min_max_single_fp_config),
ADD_TEST(min_max_double_fp_config),
ADD_TEST(min_max_local_mem_size),
ADD_TEST(min_max_kernel_preferred_work_group_size_multiple),
ADD_TEST(min_max_execution_capabilities),
ADD_TEST(min_max_queue_properties),
ADD_TEST(min_max_device_version),
ADD_TEST(min_max_language_version),
ADD_TEST(kernel_arg_changes),
ADD_TEST(kernel_arg_multi_setup_random),
ADD_TEST(native_kernel),
ADD_TEST(create_context_from_type),
ADD_TEST(create_context_from_type_device_type_all),
ADD_TEST(create_context_from_type_device_type_default),
ADD_TEST(platform_extensions),
ADD_TEST(get_platform_ids),
ADD_TEST(bool_type),
ADD_TEST(repeated_setup_cleanup),
ADD_TEST(retain_queue_single),
ADD_TEST(retain_queue_multiple),
ADD_TEST(retain_mem_object_single),
ADD_TEST(retain_mem_object_multiple),
ADD_TEST(retain_mem_object_set_kernel_arg),
ADD_TEST(min_data_type_align_size_alignment),
ADD_TEST_VERSION(context_destructor_callback, Version(3, 0)),
ADD_TEST(mem_object_destructor_callback),
ADD_TEST(null_buffer_arg),
ADD_TEST(get_buffer_info),
ADD_TEST(get_image2d_info),
ADD_TEST(get_image3d_info),
ADD_TEST(get_image1d_info),
ADD_TEST(get_image1d_array_info),
ADD_TEST(get_image2d_array_info),
ADD_TEST(queue_flush_on_release),
ADD_TEST(queue_hint),
ADD_TEST(queue_properties),
ADD_TEST_VERSION(sub_group_dispatch, Version(2, 1)),
ADD_TEST_VERSION(clone_kernel, Version(2, 1)),
ADD_TEST_VERSION(zero_sized_enqueue, Version(2, 1)),
ADD_TEST_VERSION(buffer_properties_queries, Version(3, 0)),
ADD_TEST_VERSION(image_properties_queries, Version(3, 0)),
ADD_TEST_VERSION(queue_properties_queries, Version(3, 0)),
ADD_TEST_VERSION(pipe_properties_queries, Version(3, 0)),
ADD_TEST_VERSION(consistency_svm, Version(3, 0)),
ADD_TEST_VERSION(consistency_memory_model, Version(3, 0)),
ADD_TEST_VERSION(consistency_device_enqueue, Version(3, 0)),
ADD_TEST_VERSION(consistency_pipes, Version(3, 0)),
ADD_TEST_VERSION(consistency_progvar, Version(3, 0)),
ADD_TEST_VERSION(consistency_non_uniform_work_group, Version(3, 0)),
ADD_TEST_VERSION(consistency_read_write_images, Version(3, 0)),
ADD_TEST_VERSION(consistency_2d_image_from_buffer, Version(3, 0)),
ADD_TEST_VERSION(consistency_depth_images, Version(3, 0)),
ADD_TEST_VERSION(consistency_device_and_host_timer, Version(3, 0)),
ADD_TEST_VERSION(consistency_il_programs, Version(3, 0)),
ADD_TEST_VERSION(consistency_subgroups, Version(3, 0)),
ADD_TEST_VERSION(consistency_prog_ctor_dtor, Version(3, 0)),
ADD_TEST_VERSION(consistency_3d_image_writes, Version(3, 0)),
ADD_TEST(consistency_requirements_fp64),
ADD_TEST(consistency_requirements_fp16),
ADD_TEST(min_image_formats),
ADD_TEST(set_command_queue_property),
ADD_TEST(negative_get_platform_info),
ADD_TEST(negative_get_platform_ids),
ADD_TEST(work_group_suggested_local_size_1D),
ADD_TEST(work_group_suggested_local_size_2D),
ADD_TEST(work_group_suggested_local_size_3D),
ADD_TEST(negative_create_command_queue),
ADD_TEST_VERSION(negative_create_command_queue_with_properties,
Version(2, 0)),
ADD_TEST(negative_create_command_queue_with_properties_khr),
ADD_TEST(kernel_local_memory_size),
ADD_TEST_VERSION(set_default_device_command_queue, Version(2, 1)),
};
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);
} }

View File

@@ -16,8 +16,7 @@
#include "testBase.h" #include "testBase.h"
int test_negative_get_platform_ids(cl_device_id deviceID, cl_context context, REGISTER_TEST(negative_get_platform_ids)
cl_command_queue queue, int num_elements)
{ {
cl_platform_id platform; cl_platform_id platform;
cl_int err = clGetPlatformIDs(0, &platform, nullptr); cl_int err = clGetPlatformIDs(0, &platform, nullptr);
@@ -37,10 +36,9 @@ int test_negative_get_platform_ids(cl_device_id deviceID, cl_context context,
return TEST_PASS; return TEST_PASS;
} }
int test_negative_get_platform_info(cl_device_id deviceID, cl_context context, REGISTER_TEST(negative_get_platform_info)
cl_command_queue queue, int num_elements)
{ {
cl_platform_id platform = getPlatformFromDevice(deviceID); cl_platform_id platform = getPlatformFromDevice(device);
constexpr cl_platform_info INVALID_PARAM_VALUE = 0; constexpr cl_platform_info INVALID_PARAM_VALUE = 0;
cl_int err = cl_int err =

View File

@@ -16,12 +16,10 @@
#include "testBase.h" #include "testBase.h"
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
int test_negative_create_command_queue(cl_device_id deviceID, REGISTER_TEST(negative_create_command_queue)
cl_context context,
cl_command_queue queue, int num_elements)
{ {
cl_command_queue_properties device_props = 0; cl_command_queue_properties device_props = 0;
cl_int error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_PROPERTIES, cl_int error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_PROPERTIES,
sizeof(device_props), &device_props, NULL); sizeof(device_props), &device_props, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_QUEUE_PROPERTIES failed"); test_error(error, "clGetDeviceInfo for CL_DEVICE_QUEUE_PROPERTIES failed");
@@ -40,7 +38,7 @@ int test_negative_create_command_queue(cl_device_id deviceID,
// code // code
cl_int test_error = CL_SUCCESS; cl_int test_error = CL_SUCCESS;
clCommandQueueWrapper test_queue = clCreateCommandQueue( clCommandQueueWrapper test_queue = clCreateCommandQueue(
context, deviceID, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &test_error); context, device, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &test_error);
test_failure_error_ret( test_failure_error_ret(
test_error, CL_INVALID_QUEUE_PROPERTIES, test_error, CL_INVALID_QUEUE_PROPERTIES,
@@ -52,18 +50,16 @@ int test_negative_create_command_queue(cl_device_id deviceID,
return TEST_PASS; return TEST_PASS;
} }
int test_negative_create_command_queue_with_properties(cl_device_id deviceID, REGISTER_TEST_VERSION(negative_create_command_queue_with_properties,
cl_context context, Version(2, 0))
cl_command_queue queue,
int num_elements)
{ {
cl_command_queue_properties device_props = 0; cl_command_queue_properties device_props = 0;
cl_int error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_PROPERTIES, cl_int error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_PROPERTIES,
sizeof(device_props), &device_props, NULL); sizeof(device_props), &device_props, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_QUEUE_PROPERTIES failed"); test_error(error, "clGetDeviceInfo for CL_DEVICE_QUEUE_PROPERTIES failed");
cl_command_queue_properties device_on_host_props = 0; cl_command_queue_properties device_on_host_props = 0;
error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES, error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES,
sizeof(device_on_host_props), &device_on_host_props, sizeof(device_on_host_props), &device_on_host_props,
NULL); NULL);
test_error(error, test_error(error,
@@ -97,7 +93,7 @@ int test_negative_create_command_queue_with_properties(cl_device_id deviceID,
cl_int test_error = CL_SUCCESS; cl_int test_error = CL_SUCCESS;
clCommandQueueWrapper test_queue = clCreateCommandQueueWithProperties( clCommandQueueWrapper test_queue = clCreateCommandQueueWithProperties(
context, deviceID, queue_prop_def, &test_error); context, device, queue_prop_def, &test_error);
test_failure_error_ret(test_error, CL_INVALID_QUEUE_PROPERTIES, test_failure_error_ret(test_error, CL_INVALID_QUEUE_PROPERTIES,
"clCreateCommandQueueWithProperties should " "clCreateCommandQueueWithProperties should "
@@ -110,17 +106,15 @@ int test_negative_create_command_queue_with_properties(cl_device_id deviceID,
return TEST_PASS; return TEST_PASS;
} }
int test_negative_create_command_queue_with_properties_khr( REGISTER_TEST(negative_create_command_queue_with_properties_khr)
cl_device_id deviceID, cl_context context, cl_command_queue queue,
int num_elements)
{ {
if (!is_extension_available(deviceID, "cl_khr_create_command_queue")) if (!is_extension_available(device, "cl_khr_create_command_queue"))
{ {
return TEST_SKIPPED_ITSELF; return TEST_SKIPPED_ITSELF;
} }
cl_platform_id platform; cl_platform_id platform;
cl_int error = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM, cl_int error = clGetDeviceInfo(device, CL_DEVICE_PLATFORM,
sizeof(cl_platform_id), &platform, NULL); sizeof(cl_platform_id), &platform, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed"); test_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed");
@@ -136,7 +130,7 @@ int test_negative_create_command_queue_with_properties_khr(
} }
cl_command_queue_properties device_props = 0; cl_command_queue_properties device_props = 0;
error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_PROPERTIES, error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_PROPERTIES,
sizeof(device_props), &device_props, NULL); sizeof(device_props), &device_props, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_QUEUE_PROPERTIES failed"); test_error(error, "clGetDeviceInfo for CL_DEVICE_QUEUE_PROPERTIES failed");
@@ -160,7 +154,7 @@ int test_negative_create_command_queue_with_properties_khr(
cl_int test_error = CL_SUCCESS; cl_int test_error = CL_SUCCESS;
clCommandQueueWrapper test_khr_queue = clCommandQueueWrapper test_khr_queue =
clCreateCommandQueueWithPropertiesKHR(context, deviceID, queue_prop_def, clCreateCommandQueueWithPropertiesKHR(context, device, queue_prop_def,
&test_error); &test_error);
test_failure_error_ret(test_error, CL_INVALID_QUEUE_PROPERTIES, test_failure_error_ret(test_error, CL_INVALID_QUEUE_PROPERTIES,

View File

@@ -1,258 +0,0 @@
//
// Copyright (c) 2017 The Khronos Group Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "harness/errorHelpers.h"
#include "harness/kernelHelpers.h"
#include "harness/typeWrappers.h"
#include "harness/clImageHelper.h"
#include "harness/imageHelpers.h"
extern float calculate_ulperror(float a, float b);
extern int test_load_single_kernel(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_load_two_kernels(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_load_two_kernels_in_one(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_load_two_kernels_manually(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_get_program_info_kernel_names( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_create_kernels_in_program(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_enqueue_task(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_repeated_setup_cleanup(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_bool_type(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_platform_extensions(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_get_platform_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_get_sampler_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_get_sampler_info_compatibility(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_get_command_queue_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_get_command_queue_info_compatibility(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_get_context_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_get_device_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_kernel_required_group_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_binary_get(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_binary_create(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_release_kernel_order(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_release_during_execute(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_get_kernel_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_kernel_private_memory_size(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_execute_kernel_local_sizes(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_set_kernel_arg_by_index(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_set_kernel_arg_struct(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_set_kernel_arg_constant(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_set_kernel_arg_struct_array(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_kernel_global_constant(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_set_command_queue_property(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_min_max_thread_dimensions(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_work_items_sizes(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_work_group_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_read_image_args(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_write_image_args(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_mem_alloc_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_image_2d_width(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_image_2d_height(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_image_3d_width(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_image_3d_height(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_image_3d_depth(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_image_array_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_image_buffer_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_parameter_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_samplers(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_constant_buffer_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_constant_args(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_compute_units(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_address_bits(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_single_fp_config(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_double_fp_config(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_local_mem_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_kernel_preferred_work_group_size_multiple(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_execution_capabilities(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_queue_properties(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_device_version(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_max_language_version(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_native_kernel(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems );
extern int test_create_context_from_type(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_create_context_from_type_device_type_all(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_create_context_from_type_device_type_default(
cl_device_id deviceID, cl_context context, cl_command_queue queue,
int num_elements);
extern int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_kernel_arg_changes(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_kernel_arg_multi_setup_random(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_retain_queue_single(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_retain_queue_multiple(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_retain_mem_object_single(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_retain_mem_object_multiple(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_retain_mem_object_set_kernel_arg(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_min_data_type_align_size_alignment(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems );
extern int test_context_destructor_callback(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_mem_object_destructor_callback(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_null_buffer_arg( cl_device_id device_id, cl_context context, cl_command_queue queue, int num_elements );
extern int test_get_buffer_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements );
extern int test_get_image2d_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements );
extern int test_get_image3d_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements );
extern int test_get_image1d_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements );
extern int test_get_image1d_array_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements );
extern int test_get_image2d_array_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements );
extern int test_get_kernel_arg_info( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements );
extern int test_queue_hint(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_sub_group_dispatch(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_clone_kernel(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_zero_sized_enqueue(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_queue_properties( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements );
extern int test_queue_flush_on_release(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_buffer_properties_queries(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_image_properties_queries(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_queue_properties_queries(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
int test_pipe_properties_queries(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements);
extern int test_consistency_svm(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements);
extern int test_consistency_memory_model(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_consistency_device_enqueue(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_consistency_pipes(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements);
extern int test_consistency_progvar(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements);
extern int test_consistency_non_uniform_work_group(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_consistency_read_write_images(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_consistency_2d_image_from_buffer(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_consistency_depth_images(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_consistency_device_and_host_timer(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_consistency_il_programs(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_consistency_subgroups(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements);
extern int test_consistency_prog_ctor_dtor(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_consistency_3d_image_writes(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_consistency_requirements_fp64(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_consistency_requirements_fp16(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_min_image_formats(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements);
extern int test_kernel_local_memory_size(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_negative_get_platform_info(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_negative_get_platform_ids(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_kernel_attributes(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements);
extern int test_work_group_suggested_local_size_1D(cl_device_id device,
cl_context context,
cl_command_queue queue,
int n_elems);
extern int test_work_group_suggested_local_size_2D(cl_device_id device,
cl_context context,
cl_command_queue queue,
int n_elems);
extern int test_work_group_suggested_local_size_3D(cl_device_id device,
cl_context context,
cl_command_queue queue,
int n_elems);
extern int test_negative_create_command_queue(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);
extern int test_negative_create_command_queue_with_properties(
cl_device_id deviceID, cl_context context, cl_command_queue queue,
int num_elements);
extern int test_negative_create_command_queue_with_properties_khr(
cl_device_id deviceID, cl_context context, cl_command_queue queue,
int num_elements);
extern int test_set_default_device_command_queue(cl_device_id deviceID,
cl_context context,
cl_command_queue queue,
int num_elements);

View File

@@ -17,15 +17,14 @@
#define _testBase_h #define _testBase_h
#include "harness/compat.h" #include "harness/compat.h"
#include "harness/testHarness.h"
#include "harness/typeWrappers.h"
#include "harness/imageHelpers.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.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"
#endif // _testBase_h #endif // _testBase_h

View File

@@ -25,8 +25,7 @@ __kernel void test(__global int* dst) {
} }
)CLC"; )CLC";
int test_consistency_svm(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(consistency_svm, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
// clGetDeviceInfo, passing CL_DEVICE_SVM_CAPABILITIES: // clGetDeviceInfo, passing CL_DEVICE_SVM_CAPABILITIES:
// May return 0, indicating that device does not support Shared Virtual // May return 0, indicating that device does not support Shared Virtual
@@ -39,8 +38,8 @@ int test_consistency_svm(cl_device_id deviceID, cl_context context,
clKernelWrapper kernel; clKernelWrapper kernel;
cl_device_svm_capabilities svmCaps = 0; cl_device_svm_capabilities svmCaps = 0;
error = clGetDeviceInfo(deviceID, CL_DEVICE_SVM_CAPABILITIES, error = clGetDeviceInfo(device, CL_DEVICE_SVM_CAPABILITIES, sizeof(svmCaps),
sizeof(svmCaps), &svmCaps, NULL); &svmCaps, NULL);
test_error(error, "Unable to query CL_DEVICE_SVM_CAPABILITIES"); test_error(error, "Unable to query CL_DEVICE_SVM_CAPABILITIES");
if (svmCaps == 0) if (svmCaps == 0)
@@ -202,13 +201,12 @@ static int check_atomic_capabilities(cl_device_atomic_capabilities atomicCaps,
return TEST_PASS; return TEST_PASS;
} }
int test_consistency_memory_model(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(consistency_memory_model, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
cl_int error; cl_int error;
cl_device_atomic_capabilities atomicCaps = 0; cl_device_atomic_capabilities atomicCaps = 0;
error = clGetDeviceInfo(deviceID, CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES, error = clGetDeviceInfo(device, CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES,
sizeof(atomicCaps), &atomicCaps, NULL); sizeof(atomicCaps), &atomicCaps, NULL);
test_error(error, "Unable to query CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES"); test_error(error, "Unable to query CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES");
@@ -221,7 +219,7 @@ int test_consistency_memory_model(cl_device_id deviceID, cl_context context,
return error; return error;
} }
error = clGetDeviceInfo(deviceID, CL_DEVICE_ATOMIC_FENCE_CAPABILITIES, error = clGetDeviceInfo(device, CL_DEVICE_ATOMIC_FENCE_CAPABILITIES,
sizeof(atomicCaps), &atomicCaps, NULL); sizeof(atomicCaps), &atomicCaps, NULL);
test_error(error, "Unable to query CL_DEVICE_ATOMIC_FENCE_CAPABILITIES"); test_error(error, "Unable to query CL_DEVICE_ATOMIC_FENCE_CAPABILITIES");
@@ -238,8 +236,7 @@ int test_consistency_memory_model(cl_device_id deviceID, cl_context context,
return TEST_PASS; return TEST_PASS;
} }
int test_consistency_device_enqueue(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(consistency_device_enqueue, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
// clGetDeviceInfo, passing CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES // clGetDeviceInfo, passing CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES
// May return 0, indicating that device does not support Device-Side Enqueue // May return 0, indicating that device does not support Device-Side Enqueue
@@ -247,7 +244,7 @@ int test_consistency_device_enqueue(cl_device_id deviceID, cl_context context,
cl_int error; cl_int error;
cl_device_device_enqueue_capabilities dseCaps = 0; cl_device_device_enqueue_capabilities dseCaps = 0;
error = clGetDeviceInfo(deviceID, CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES, error = clGetDeviceInfo(device, CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES,
sizeof(dseCaps), &dseCaps, NULL); sizeof(dseCaps), &dseCaps, NULL);
test_error(error, "Unable to query CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES"); test_error(error, "Unable to query CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES");
@@ -258,7 +255,7 @@ int test_consistency_device_enqueue(cl_device_id deviceID, cl_context context,
// On-Device Queues. // On-Device Queues.
cl_command_queue_properties devQueueProps = 0; cl_command_queue_properties devQueueProps = 0;
error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES, error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES,
sizeof(devQueueProps), &devQueueProps, NULL); sizeof(devQueueProps), &devQueueProps, NULL);
test_error(error, test_error(error,
"Unable to query CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES"); "Unable to query CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES");
@@ -278,7 +275,7 @@ int test_consistency_device_enqueue(cl_device_id deviceID, cl_context context,
cl_uint u = 0; cl_uint u = 0;
error = error =
clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE, clGetDeviceInfo(device, CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE,
sizeof(u), &u, NULL); sizeof(u), &u, NULL);
test_error(error, test_error(error,
"Unable to query CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE"); "Unable to query CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE");
@@ -287,7 +284,7 @@ int test_consistency_device_enqueue(cl_device_id deviceID, cl_context context,
"but CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE " "but CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE "
"returned a non-zero value"); "returned a non-zero value");
error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE, error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE,
sizeof(u), &u, NULL); sizeof(u), &u, NULL);
test_error(error, "Unable to query CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE"); test_error(error, "Unable to query CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE");
test_assert_error( test_assert_error(
@@ -295,7 +292,7 @@ int test_consistency_device_enqueue(cl_device_id deviceID, cl_context context,
"CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES returned 0 but " "CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES returned 0 but "
"CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE returned a non-zero value"); "CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE returned a non-zero value");
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_ON_DEVICE_QUEUES, error = clGetDeviceInfo(device, CL_DEVICE_MAX_ON_DEVICE_QUEUES,
sizeof(u), &u, NULL); sizeof(u), &u, NULL);
test_error(error, "Unable to query CL_DEVICE_MAX_ON_DEVICE_QUEUES"); test_error(error, "Unable to query CL_DEVICE_MAX_ON_DEVICE_QUEUES");
test_assert_error( test_assert_error(
@@ -303,7 +300,7 @@ int test_consistency_device_enqueue(cl_device_id deviceID, cl_context context,
"CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES returned 0 but " "CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES returned 0 but "
"CL_DEVICE_MAX_ON_DEVICE_QUEUES returned a non-zero value"); "CL_DEVICE_MAX_ON_DEVICE_QUEUES returned a non-zero value");
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_ON_DEVICE_EVENTS, error = clGetDeviceInfo(device, CL_DEVICE_MAX_ON_DEVICE_EVENTS,
sizeof(u), &u, NULL); sizeof(u), &u, NULL);
test_error(error, "Unable to query CL_DEVICE_MAX_ON_DEVICE_EVENTS"); test_error(error, "Unable to query CL_DEVICE_MAX_ON_DEVICE_EVENTS");
test_assert_error( test_assert_error(
@@ -334,7 +331,7 @@ int test_consistency_device_enqueue(cl_device_id deviceID, cl_context context,
// clSetDefaultDeviceCommandQueue // clSetDefaultDeviceCommandQueue
// Returns CL_INVALID_OPERATION if device does not support On-Device // Returns CL_INVALID_OPERATION if device does not support On-Device
// Queues. // Queues.
error = clSetDefaultDeviceCommandQueue(context, deviceID, NULL); error = clSetDefaultDeviceCommandQueue(context, device, NULL);
test_failure_error(error, CL_INVALID_OPERATION, test_failure_error(error, CL_INVALID_OPERATION,
"CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES returned 0 " "CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES returned 0 "
"but clSetDefaultDeviceCommandQueue did not return " "but clSetDefaultDeviceCommandQueue did not return "
@@ -347,7 +344,7 @@ int test_consistency_device_enqueue(cl_device_id deviceID, cl_context context,
// clSetDefaultDeviceCommandQueue // clSetDefaultDeviceCommandQueue
// Returns CL_INVALID_OPERATION if device does not support a // Returns CL_INVALID_OPERATION if device does not support a
// replaceable default On-Device Queue. // replaceable default On-Device Queue.
error = clSetDefaultDeviceCommandQueue(context, deviceID, NULL); error = clSetDefaultDeviceCommandQueue(context, device, NULL);
test_failure_error( test_failure_error(
error, CL_INVALID_OPERATION, error, CL_INVALID_OPERATION,
"CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES did not " "CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES did not "
@@ -371,8 +368,8 @@ int test_consistency_device_enqueue(cl_device_id deviceID, cl_context context,
if ((dseCaps & CL_DEVICE_QUEUE_SUPPORTED) != 0) if ((dseCaps & CL_DEVICE_QUEUE_SUPPORTED) != 0)
{ {
cl_bool b; cl_bool b;
error = clGetDeviceInfo(deviceID, error =
CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT, clGetDeviceInfo(device, CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT,
sizeof(b), &b, NULL); sizeof(b), &b, NULL);
test_error( test_error(
error, error,
@@ -387,16 +384,15 @@ int test_consistency_device_enqueue(cl_device_id deviceID, cl_context context,
return TEST_PASS; return TEST_PASS;
} }
int test_consistency_pipes(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(consistency_pipes, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
// clGetDeviceInfo, passing CL_DEVICE_PIPE_SUPPORT // clGetDeviceInfo, passing CL_DEVICE_PIPE_SUPPORT
// May return CL_FALSE, indicating that device does not support Pipes. // May return CL_FALSE, indicating that device does not support Pipes.
cl_int error; cl_int error;
cl_bool pipeSupport = CL_FALSE; cl_bool pipeSupport = CL_FALSE;
error = clGetDeviceInfo(deviceID, CL_DEVICE_PIPE_SUPPORT, error = clGetDeviceInfo(device, CL_DEVICE_PIPE_SUPPORT, sizeof(pipeSupport),
sizeof(pipeSupport), &pipeSupport, NULL); &pipeSupport, NULL);
test_error(error, "Unable to query CL_DEVICE_PIPE_SUPPORT"); test_error(error, "Unable to query CL_DEVICE_PIPE_SUPPORT");
if (pipeSupport == CL_FALSE) if (pipeSupport == CL_FALSE)
@@ -409,15 +405,14 @@ int test_consistency_pipes(cl_device_id deviceID, cl_context context,
cl_uint u = 0; cl_uint u = 0;
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_PIPE_ARGS, sizeof(u), error = clGetDeviceInfo(device, CL_DEVICE_MAX_PIPE_ARGS, sizeof(u), &u,
&u, NULL); NULL);
test_error(error, "Unable to query CL_DEVICE_MAX_PIPE_ARGS"); test_error(error, "Unable to query CL_DEVICE_MAX_PIPE_ARGS");
test_assert_error(u == 0, test_assert_error(u == 0,
"CL_DEVICE_PIPE_SUPPORT returned CL_FALSE, but " "CL_DEVICE_PIPE_SUPPORT returned CL_FALSE, but "
"CL_DEVICE_MAX_PIPE_ARGS returned a non-zero value"); "CL_DEVICE_MAX_PIPE_ARGS returned a non-zero value");
error = error = clGetDeviceInfo(device, CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS,
clGetDeviceInfo(deviceID, CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS,
sizeof(u), &u, NULL); sizeof(u), &u, NULL);
test_error(error, test_error(error,
"Unable to query CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS"); "Unable to query CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS");
@@ -426,7 +421,7 @@ int test_consistency_pipes(cl_device_id deviceID, cl_context context,
"CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS returned " "CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS returned "
"a non-zero value"); "a non-zero value");
error = clGetDeviceInfo(deviceID, CL_DEVICE_PIPE_MAX_PACKET_SIZE, error = clGetDeviceInfo(device, CL_DEVICE_PIPE_MAX_PACKET_SIZE,
sizeof(u), &u, NULL); sizeof(u), &u, NULL);
test_error(error, "Unable to query CL_DEVICE_PIPE_MAX_PACKET_SIZE"); test_error(error, "Unable to query CL_DEVICE_PIPE_MAX_PACKET_SIZE");
test_assert_error( test_assert_error(
@@ -461,8 +456,7 @@ int test_consistency_pipes(cl_device_id deviceID, cl_context context,
// Devices that support pipes must also return CL_TRUE // Devices that support pipes must also return CL_TRUE
// for CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT. // for CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT.
cl_bool b; cl_bool b;
error = error = clGetDeviceInfo(device, CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT,
clGetDeviceInfo(deviceID, CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT,
sizeof(b), &b, NULL); sizeof(b), &b, NULL);
test_error(error, test_error(error,
"Unable to query CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT"); "Unable to query CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT");
@@ -475,8 +469,7 @@ int test_consistency_pipes(cl_device_id deviceID, cl_context context,
return TEST_PASS; return TEST_PASS;
} }
int test_consistency_progvar(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(consistency_progvar, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
// clGetDeviceInfo, passing CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE // clGetDeviceInfo, passing CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE
// May return 0, indicating that device does not support Program Scope // May return 0, indicating that device does not support Program Scope
@@ -487,7 +480,7 @@ int test_consistency_progvar(cl_device_id deviceID, cl_context context,
clKernelWrapper kernel; clKernelWrapper kernel;
size_t maxGlobalVariableSize = 0; size_t maxGlobalVariableSize = 0;
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE, error = clGetDeviceInfo(device, CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE,
sizeof(maxGlobalVariableSize), sizeof(maxGlobalVariableSize),
&maxGlobalVariableSize, NULL); &maxGlobalVariableSize, NULL);
test_error(error, "Unable to query CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE"); test_error(error, "Unable to query CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE");
@@ -506,7 +499,7 @@ int test_consistency_progvar(cl_device_id deviceID, cl_context context,
// CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE // CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE
// Returns 0 if device does not support Program Scope Global Variables. // Returns 0 if device does not support Program Scope Global Variables.
error = clGetDeviceInfo(deviceID, error = clGetDeviceInfo(device,
CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE, CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE,
sizeof(sz), &sz, NULL); sizeof(sz), &sz, NULL);
test_error( test_error(
@@ -523,7 +516,7 @@ int test_consistency_progvar(cl_device_id deviceID, cl_context context,
// Returns 0 if device does not support Program Scope Global Variables. // Returns 0 if device does not support Program Scope Global Variables.
error = clGetProgramBuildInfo( error = clGetProgramBuildInfo(
program, deviceID, CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE, program, device, CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE,
sizeof(sz), &sz, NULL); sizeof(sz), &sz, NULL);
test_error( test_error(
error, error,
@@ -537,10 +530,7 @@ int test_consistency_progvar(cl_device_id deviceID, cl_context context,
return TEST_PASS; return TEST_PASS;
} }
int test_consistency_non_uniform_work_group(cl_device_id deviceID, REGISTER_TEST_VERSION(consistency_non_uniform_work_group, Version(3, 0))
cl_context context,
cl_command_queue queue,
int num_elements)
{ {
// clGetDeviceInfo, passing CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT: // clGetDeviceInfo, passing CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT:
// May return CL_FALSE, indicating that device does not support Non-Uniform // May return CL_FALSE, indicating that device does not support Non-Uniform
@@ -553,7 +543,7 @@ int test_consistency_non_uniform_work_group(cl_device_id deviceID,
clKernelWrapper kernel; clKernelWrapper kernel;
cl_bool nonUniformWorkGroupSupport = CL_FALSE; cl_bool nonUniformWorkGroupSupport = CL_FALSE;
error = clGetDeviceInfo(deviceID, CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT, error = clGetDeviceInfo(device, CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT,
sizeof(nonUniformWorkGroupSupport), sizeof(nonUniformWorkGroupSupport),
&nonUniformWorkGroupSupport, NULL); &nonUniformWorkGroupSupport, NULL);
test_error(error, test_error(error,
@@ -620,9 +610,7 @@ int test_consistency_non_uniform_work_group(cl_device_id deviceID,
return TEST_PASS; return TEST_PASS;
} }
int test_consistency_read_write_images(cl_device_id deviceID, REGISTER_TEST_VERSION(consistency_read_write_images, Version(3, 0))
cl_context context,
cl_command_queue queue, int num_elements)
{ {
// clGetDeviceInfo, passing // clGetDeviceInfo, passing
// CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS May return 0, // CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS May return 0,
@@ -630,7 +618,7 @@ int test_consistency_read_write_images(cl_device_id deviceID,
cl_int error; cl_int error;
cl_uint maxReadWriteImageArgs = 0; cl_uint maxReadWriteImageArgs = 0;
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS, error = clGetDeviceInfo(device, CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS,
sizeof(maxReadWriteImageArgs), sizeof(maxReadWriteImageArgs),
&maxReadWriteImageArgs, NULL); &maxReadWriteImageArgs, NULL);
test_error(error, test_error(error,
@@ -683,10 +671,7 @@ int test_consistency_read_write_images(cl_device_id deviceID,
return TEST_PASS; return TEST_PASS;
} }
int test_consistency_2d_image_from_buffer(cl_device_id deviceID, REGISTER_TEST_VERSION(consistency_2d_image_from_buffer, Version(3, 0))
cl_context context,
cl_command_queue queue,
int num_elements)
{ {
// clGetDeviceInfo, passing CL_DEVICE_IMAGE_PITCH_ALIGNMENT or // clGetDeviceInfo, passing CL_DEVICE_IMAGE_PITCH_ALIGNMENT or
// CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT // CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT
@@ -703,7 +688,7 @@ int test_consistency_2d_image_from_buffer(cl_device_id deviceID,
clMemWrapper image; clMemWrapper image;
cl_uint imagePitchAlignment = 0; cl_uint imagePitchAlignment = 0;
error = clGetDeviceInfo(deviceID, CL_DEVICE_IMAGE_PITCH_ALIGNMENT, error = clGetDeviceInfo(device, CL_DEVICE_IMAGE_PITCH_ALIGNMENT,
sizeof(imagePitchAlignment), &imagePitchAlignment, sizeof(imagePitchAlignment), &imagePitchAlignment,
NULL); NULL);
test_error(error, test_error(error,
@@ -711,7 +696,7 @@ int test_consistency_2d_image_from_buffer(cl_device_id deviceID,
"CL_DEVICE_IMAGE_PITCH_ALIGNMENT"); "CL_DEVICE_IMAGE_PITCH_ALIGNMENT");
cl_uint imageBaseAddressAlignment = 0; cl_uint imageBaseAddressAlignment = 0;
error = clGetDeviceInfo(deviceID, CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT, error = clGetDeviceInfo(device, CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT,
sizeof(imageBaseAddressAlignment), sizeof(imageBaseAddressAlignment),
&imageBaseAddressAlignment, NULL); &imageBaseAddressAlignment, NULL);
test_error(error, test_error(error,
@@ -719,7 +704,7 @@ int test_consistency_2d_image_from_buffer(cl_device_id deviceID,
"CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT"); "CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT");
bool supports_cl_khr_image2d_from_buffer = bool supports_cl_khr_image2d_from_buffer =
is_extension_available(deviceID, "cl_khr_image2d_from_buffer"); is_extension_available(device, "cl_khr_image2d_from_buffer");
if (imagePitchAlignment == 0 || imageBaseAddressAlignment == 0) if (imagePitchAlignment == 0 || imageBaseAddressAlignment == 0)
{ {
@@ -790,8 +775,7 @@ int test_consistency_2d_image_from_buffer(cl_device_id deviceID,
// All of the sRGB Image Channel Orders (such as CL_sRGBA) are optional for // All of the sRGB Image Channel Orders (such as CL_sRGBA) are optional for
// devices supporting OpenCL 3.0. // devices supporting OpenCL 3.0.
int test_consistency_depth_images(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(consistency_depth_images, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
// The CL_DEPTH Image Channel Order is optional for devices supporting // The CL_DEPTH Image Channel Order is optional for devices supporting
// OpenCL 3.0. // OpenCL 3.0.
@@ -830,7 +814,7 @@ int test_consistency_depth_images(cl_device_id deviceID, cl_context context,
} }
bool supports_cl_khr_depth_images = bool supports_cl_khr_depth_images =
is_extension_available(deviceID, "cl_khr_depth_images"); is_extension_available(device, "cl_khr_depth_images");
if (totalDepthImageFormats == 0) if (totalDepthImageFormats == 0)
{ {
@@ -848,10 +832,7 @@ int test_consistency_depth_images(cl_device_id deviceID, cl_context context,
return TEST_PASS; return TEST_PASS;
} }
int test_consistency_device_and_host_timer(cl_device_id deviceID, REGISTER_TEST_VERSION(consistency_device_and_host_timer, Version(3, 0))
cl_context context,
cl_command_queue queue,
int num_elements)
{ {
// clGetPlatformInfo, passing CL_PLATFORM_HOST_TIMER_RESOLUTION // clGetPlatformInfo, passing CL_PLATFORM_HOST_TIMER_RESOLUTION
// May return 0, indicating that platform does not support Device and Host // May return 0, indicating that platform does not support Device and Host
@@ -859,7 +840,7 @@ int test_consistency_device_and_host_timer(cl_device_id deviceID,
cl_int error; cl_int error;
cl_platform_id platform = NULL; cl_platform_id platform = NULL;
error = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM, sizeof(platform), error = clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(platform),
&platform, NULL); &platform, NULL);
test_error(error, "Unable to query CL_DEVICE_PLATFORM"); test_error(error, "Unable to query CL_DEVICE_PLATFORM");
@@ -878,13 +859,13 @@ int test_consistency_device_and_host_timer(cl_device_id deviceID,
cl_ulong dt = 0; cl_ulong dt = 0;
cl_ulong ht = 0; cl_ulong ht = 0;
error = clGetDeviceAndHostTimer(deviceID, &dt, &ht); error = clGetDeviceAndHostTimer(device, &dt, &ht);
test_failure_error( test_failure_error(
error, CL_INVALID_OPERATION, error, CL_INVALID_OPERATION,
"CL_PLATFORM_HOST_TIMER_RESOLUTION returned 0 but " "CL_PLATFORM_HOST_TIMER_RESOLUTION returned 0 but "
"clGetDeviceAndHostTimer did not return CL_INVALID_OPERATION"); "clGetDeviceAndHostTimer did not return CL_INVALID_OPERATION");
error = clGetHostTimer(deviceID, &ht); error = clGetHostTimer(device, &ht);
test_failure_error( test_failure_error(
error, CL_INVALID_OPERATION, error, CL_INVALID_OPERATION,
"CL_PLATFORM_HOST_TIMER_RESOLUTION returned 0 but " "CL_PLATFORM_HOST_TIMER_RESOLUTION returned 0 but "
@@ -894,8 +875,7 @@ int test_consistency_device_and_host_timer(cl_device_id deviceID,
return TEST_PASS; return TEST_PASS;
} }
int test_consistency_il_programs(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(consistency_il_programs, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
// clGetDeviceInfo, passing CL_DEVICE_IL_VERSION or // clGetDeviceInfo, passing CL_DEVICE_IL_VERSION or
// CL_DEVICE_ILS_WITH_VERSION // CL_DEVICE_ILS_WITH_VERSION
@@ -909,14 +889,14 @@ int test_consistency_il_programs(cl_device_id deviceID, cl_context context,
// Even if the device does not support Intermediate Language Programs the // Even if the device does not support Intermediate Language Programs the
// size of the string query should not be zero. // size of the string query should not be zero.
size_t sz = SIZE_MAX; size_t sz = SIZE_MAX;
error = clGetDeviceInfo(deviceID, CL_DEVICE_IL_VERSION, 0, NULL, &sz); error = clGetDeviceInfo(device, CL_DEVICE_IL_VERSION, 0, NULL, &sz);
test_error(error, "Unable to query CL_DEVICE_IL_VERSION"); test_error(error, "Unable to query CL_DEVICE_IL_VERSION");
test_assert_error(sz != 0, test_assert_error(sz != 0,
"CL_DEVICE_IL_VERSION should return a non-zero size"); "CL_DEVICE_IL_VERSION should return a non-zero size");
std::string ilVersion = get_device_il_version_string(deviceID); std::string ilVersion = get_device_il_version_string(device);
error = clGetDeviceInfo(deviceID, CL_DEVICE_ILS_WITH_VERSION, 0, NULL, &sz); error = clGetDeviceInfo(device, CL_DEVICE_ILS_WITH_VERSION, 0, NULL, &sz);
test_error(error, "Unable to query CL_DEVICE_ILS_WITH_VERSION"); test_error(error, "Unable to query CL_DEVICE_ILS_WITH_VERSION");
if (ilVersion == "" || sz == 0) if (ilVersion == "" || sz == 0)
@@ -935,7 +915,7 @@ int test_consistency_il_programs(cl_device_id deviceID, cl_context context,
"but CL_DEVICE_IL_VERSION returned an empty string"); "but CL_DEVICE_IL_VERSION returned an empty string");
bool supports_cl_khr_il_program = bool supports_cl_khr_il_program =
is_extension_available(deviceID, "cl_khr_il_program"); is_extension_available(device, "cl_khr_il_program");
test_assert_error(supports_cl_khr_il_program == false, test_assert_error(supports_cl_khr_il_program == false,
"Device does not support IL Programs but does " "Device does not support IL Programs but does "
"support cl_khr_il_program"); "support cl_khr_il_program");
@@ -985,8 +965,7 @@ int test_consistency_il_programs(cl_device_id deviceID, cl_context context,
return TEST_PASS; return TEST_PASS;
} }
int test_consistency_subgroups(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(consistency_subgroups, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
// clGetDeviceInfo, passing CL_DEVICE_MAX_NUM_SUB_GROUPS // clGetDeviceInfo, passing CL_DEVICE_MAX_NUM_SUB_GROUPS
// May return 0, indicating that device does not support Subgroups. // May return 0, indicating that device does not support Subgroups.
@@ -996,7 +975,7 @@ int test_consistency_subgroups(cl_device_id deviceID, cl_context context,
clKernelWrapper kernel; clKernelWrapper kernel;
cl_uint maxNumSubGroups = 0; cl_uint maxNumSubGroups = 0;
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_NUM_SUB_GROUPS, error = clGetDeviceInfo(device, CL_DEVICE_MAX_NUM_SUB_GROUPS,
sizeof(maxNumSubGroups), &maxNumSubGroups, NULL); sizeof(maxNumSubGroups), &maxNumSubGroups, NULL);
test_error(error, "Unable to query CL_DEVICE_MAX_NUM_SUB_GROUPS"); test_error(error, "Unable to query CL_DEVICE_MAX_NUM_SUB_GROUPS");
@@ -1014,7 +993,7 @@ int test_consistency_subgroups(cl_device_id deviceID, cl_context context,
cl_bool ifp = CL_FALSE; cl_bool ifp = CL_FALSE;
error = clGetDeviceInfo( error = clGetDeviceInfo(
deviceID, CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS, device, CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS,
sizeof(ifp), &ifp, NULL); sizeof(ifp), &ifp, NULL);
test_error( test_error(
error, error,
@@ -1029,7 +1008,7 @@ int test_consistency_subgroups(cl_device_id deviceID, cl_context context,
// device does not support Subgroups. // device does not support Subgroups.
bool supports_cl_khr_subgroups = bool supports_cl_khr_subgroups =
is_extension_available(deviceID, "cl_khr_subgroups"); is_extension_available(device, "cl_khr_subgroups");
test_assert_error(supports_cl_khr_subgroups == false, test_assert_error(supports_cl_khr_subgroups == false,
"Device does not support Subgroups but does " "Device does not support Subgroups but does "
"support cl_khr_subgroups"); "support cl_khr_subgroups");
@@ -1038,7 +1017,7 @@ int test_consistency_subgroups(cl_device_id deviceID, cl_context context,
// Returns CL_INVALID_OPERATION if device does not support Subgroups. // Returns CL_INVALID_OPERATION if device does not support Subgroups.
size_t sz = SIZE_MAX; size_t sz = SIZE_MAX;
error = clGetKernelSubGroupInfo(kernel, deviceID, error = clGetKernelSubGroupInfo(kernel, device,
CL_KERNEL_MAX_NUM_SUB_GROUPS, 0, NULL, CL_KERNEL_MAX_NUM_SUB_GROUPS, 0, NULL,
sizeof(sz), &sz, NULL); sizeof(sz), &sz, NULL);
test_failure_error( test_failure_error(
@@ -1052,8 +1031,7 @@ int test_consistency_subgroups(cl_device_id deviceID, cl_context context,
static void CL_CALLBACK program_callback(cl_program, void*) {} static void CL_CALLBACK program_callback(cl_program, void*) {}
int test_consistency_prog_ctor_dtor(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(consistency_prog_ctor_dtor, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
cl_int error; cl_int error;
@@ -1099,8 +1077,7 @@ int test_consistency_prog_ctor_dtor(cl_device_id deviceID, cl_context context,
return TEST_PASS; return TEST_PASS;
} }
int test_consistency_3d_image_writes(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(consistency_3d_image_writes, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
// clGetSupportedImageFormats, passing CL_MEM_OBJECT_IMAGE3D and one of // clGetSupportedImageFormats, passing CL_MEM_OBJECT_IMAGE3D and one of
// CL_MEM_WRITE_ONLY, CL_MEM_READ_WRITE, or CL_MEM_KERNEL_READ_AND_WRITE // CL_MEM_WRITE_ONLY, CL_MEM_READ_WRITE, or CL_MEM_KERNEL_READ_AND_WRITE
@@ -1131,7 +1108,7 @@ int test_consistency_3d_image_writes(cl_device_id deviceID, cl_context context,
} }
bool supports_cl_khr_3d_image_writes = bool supports_cl_khr_3d_image_writes =
is_extension_available(deviceID, "cl_khr_3d_image_writes"); is_extension_available(device, "cl_khr_3d_image_writes");
if (total3DImageWriteFormats == 0) if (total3DImageWriteFormats == 0)
{ {
@@ -1152,18 +1129,16 @@ int test_consistency_3d_image_writes(cl_device_id deviceID, cl_context context,
return TEST_PASS; return TEST_PASS;
} }
int test_consistency_requirements_fp64(cl_device_id deviceID, REGISTER_TEST(consistency_requirements_fp64)
cl_context context,
cl_command_queue queue, int num_elements)
{ {
cl_int error = CL_SUCCESS; cl_int error = CL_SUCCESS;
cl_device_fp_config value = 0; cl_device_fp_config value = 0;
if (is_extension_available(deviceID, "cl_khr_fp64")) if (is_extension_available(device, "cl_khr_fp64"))
{ {
const Version version = get_device_cl_version(deviceID); const Version version = get_device_cl_version(device);
error = clGetDeviceInfo(deviceID, CL_DEVICE_DOUBLE_FP_CONFIG, error = clGetDeviceInfo(device, CL_DEVICE_DOUBLE_FP_CONFIG,
sizeof(value), &value, nullptr); sizeof(value), &value, nullptr);
test_error(error, "Unable to get device CL_DEVICE_DOUBLE_FP_CONFIG"); test_error(error, "Unable to get device CL_DEVICE_DOUBLE_FP_CONFIG");
test_assert_error( test_assert_error(
@@ -1187,8 +1162,7 @@ int test_consistency_requirements_fp64(cl_device_id deviceID,
"for OpenCL 2.0 or newer devices"); "for OpenCL 2.0 or newer devices");
} }
error = error = clGetDeviceInfo(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE,
clGetDeviceInfo(deviceID, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE,
sizeof(value), &value, nullptr); sizeof(value), &value, nullptr);
test_error( test_error(
error, error,
@@ -1197,7 +1171,7 @@ int test_consistency_requirements_fp64(cl_device_id deviceID,
"CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE must return " "CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE must return "
"nonzero value"); "nonzero value");
error = clGetDeviceInfo(deviceID, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, error = clGetDeviceInfo(device, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE,
sizeof(value), &value, nullptr); sizeof(value), &value, nullptr);
test_error(error, test_error(error,
"Unable to get device CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE"); "Unable to get device CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE");
@@ -1207,14 +1181,13 @@ int test_consistency_requirements_fp64(cl_device_id deviceID,
} }
else else
{ {
error = clGetDeviceInfo(deviceID, CL_DEVICE_DOUBLE_FP_CONFIG, error = clGetDeviceInfo(device, CL_DEVICE_DOUBLE_FP_CONFIG,
sizeof(value), &value, nullptr); sizeof(value), &value, nullptr);
test_error(error, "Unable to get device CL_DEVICE_DOUBLE_FP_CONFIG"); test_error(error, "Unable to get device CL_DEVICE_DOUBLE_FP_CONFIG");
test_assert_error(value == 0, test_assert_error(value == 0,
"CL_DEVICE_DOUBLE_FP_CONFIG must return 0"); "CL_DEVICE_DOUBLE_FP_CONFIG must return 0");
error = error = clGetDeviceInfo(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE,
clGetDeviceInfo(deviceID, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE,
sizeof(value), &value, nullptr); sizeof(value), &value, nullptr);
test_error( test_error(
error, error,
@@ -1223,7 +1196,7 @@ int test_consistency_requirements_fp64(cl_device_id deviceID,
value == 0, value == 0,
"CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE must return 0"); "CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE must return 0");
error = clGetDeviceInfo(deviceID, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, error = clGetDeviceInfo(device, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE,
sizeof(value), &value, nullptr); sizeof(value), &value, nullptr);
test_error(error, test_error(error,
"Unable to get device CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE"); "Unable to get device CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE");
@@ -1234,17 +1207,15 @@ int test_consistency_requirements_fp64(cl_device_id deviceID,
return TEST_PASS; return TEST_PASS;
} }
int test_consistency_requirements_fp16(cl_device_id deviceID, REGISTER_TEST(consistency_requirements_fp16)
cl_context context,
cl_command_queue queue, int num_elements)
{ {
cl_int error = CL_SUCCESS; cl_int error = CL_SUCCESS;
cl_device_fp_config value = 0; cl_device_fp_config value = 0;
if (is_extension_available(deviceID, "cl_khr_fp16")) if (is_extension_available(device, "cl_khr_fp16"))
{ {
error = clGetDeviceInfo(deviceID, CL_DEVICE_HALF_FP_CONFIG, error = clGetDeviceInfo(device, CL_DEVICE_HALF_FP_CONFIG, sizeof(value),
sizeof(value), &value, nullptr); &value, nullptr);
test_error(error, "Unable to get device CL_DEVICE_HALF_FP_CONFIG"); test_error(error, "Unable to get device CL_DEVICE_HALF_FP_CONFIG");
test_assert_error(value > 0, test_assert_error(value > 0,
"CL_DEVICE_HALF_FP_CONFIG must return nonzero value"); "CL_DEVICE_HALF_FP_CONFIG must return nonzero value");
@@ -1253,7 +1224,7 @@ int test_consistency_requirements_fp16(cl_device_id deviceID,
|| (value & CL_FP_ROUND_TO_ZERO), || (value & CL_FP_ROUND_TO_ZERO),
"Reported half fp config doesn't meet minimum set"); "Reported half fp config doesn't meet minimum set");
error = clGetDeviceInfo(deviceID, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, error = clGetDeviceInfo(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF,
sizeof(value), &value, nullptr); sizeof(value), &value, nullptr);
test_error( test_error(
error, error,
@@ -1262,7 +1233,7 @@ int test_consistency_requirements_fp16(cl_device_id deviceID,
"CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF must return " "CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF must return "
"nonzero value"); "nonzero value");
error = clGetDeviceInfo(deviceID, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, error = clGetDeviceInfo(device, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF,
sizeof(value), &value, nullptr); sizeof(value), &value, nullptr);
test_error(error, test_error(error,
"Unable to get device CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF"); "Unable to get device CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF");
@@ -1272,14 +1243,14 @@ int test_consistency_requirements_fp16(cl_device_id deviceID,
} }
else else
{ {
error = clGetDeviceInfo(deviceID, CL_DEVICE_HALF_FP_CONFIG, error = clGetDeviceInfo(device, CL_DEVICE_HALF_FP_CONFIG, sizeof(value),
sizeof(value), &value, nullptr); &value, nullptr);
test_failure_error( test_failure_error(
error, CL_INVALID_VALUE, error, CL_INVALID_VALUE,
"cl_khr_fp16 is not available; CL_DEVICE_HALF_FP_CONFIG must fail " "cl_khr_fp16 is not available; CL_DEVICE_HALF_FP_CONFIG must fail "
"with CL_INVALID_VALUE"); "with CL_INVALID_VALUE");
error = clGetDeviceInfo(deviceID, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, error = clGetDeviceInfo(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF,
sizeof(value), &value, nullptr); sizeof(value), &value, nullptr);
test_error( test_error(
error, error,
@@ -1288,7 +1259,7 @@ int test_consistency_requirements_fp16(cl_device_id deviceID,
"CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF must return " "CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF must return "
"0"); "0");
error = clGetDeviceInfo(deviceID, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, error = clGetDeviceInfo(device, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF,
sizeof(value), &value, nullptr); sizeof(value), &value, nullptr);
test_error(error, test_error(error,
"Unable to get device CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF"); "Unable to get device CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF");

View File

@@ -115,8 +115,7 @@ const char *sample_const_max_arg_kernel_pattern =
#define MAX_REDUCTION_FACTOR 4 #define MAX_REDUCTION_FACTOR 4
int test_min_max_thread_dimensions(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_thread_dimensions)
cl_command_queue queue, int num_elements)
{ {
int error, retVal; int error, retVal;
unsigned int maxThreadDim, threadDim, i; unsigned int maxThreadDim, threadDim, i;
@@ -129,7 +128,7 @@ int test_min_max_thread_dimensions(cl_device_id deviceID, cl_context context,
/* Get the max thread dimensions */ /* Get the max thread dimensions */
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, error = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS,
sizeof(maxThreadDim), &maxThreadDim, NULL); sizeof(maxThreadDim), &maxThreadDim, NULL);
test_error(error, "Unable to get max work item dimensions from device"); test_error(error, "Unable to get max work item dimensions from device");
@@ -202,22 +201,21 @@ int test_min_max_thread_dimensions(cl_device_id deviceID, cl_context context,
} }
int test_min_max_work_items_sizes(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_work_items_sizes)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
size_t *deviceMaxWorkItemSize; size_t *deviceMaxWorkItemSize;
unsigned int maxWorkItemDim; unsigned int maxWorkItemDim;
/* Get the max work item dimensions */ /* Get the max work item dimensions */
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, error = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS,
sizeof(maxWorkItemDim), &maxWorkItemDim, NULL); sizeof(maxWorkItemDim), &maxWorkItemDim, NULL);
test_error(error, "Unable to get max work item dimensions from device"); test_error(error, "Unable to get max work item dimensions from device");
log_info("CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS returned %d\n", log_info("CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS returned %d\n",
maxWorkItemDim); maxWorkItemDim);
deviceMaxWorkItemSize = (size_t *)malloc(sizeof(size_t) * maxWorkItemDim); deviceMaxWorkItemSize = (size_t *)malloc(sizeof(size_t) * maxWorkItemDim);
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_WORK_ITEM_SIZES, error = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_SIZES,
sizeof(size_t) * maxWorkItemDim, sizeof(size_t) * maxWorkItemDim,
deviceMaxWorkItemSize, NULL); deviceMaxWorkItemSize, NULL);
test_error(error, "clDeviceInfo for CL_DEVICE_MAX_WORK_ITEM_SIZES failed"); test_error(error, "clDeviceInfo for CL_DEVICE_MAX_WORK_ITEM_SIZES failed");
@@ -246,14 +244,13 @@ int test_min_max_work_items_sizes(cl_device_id deviceID, cl_context context,
} }
int test_min_max_work_group_size(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_work_group_size)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
size_t deviceMaxThreadSize; size_t deviceMaxThreadSize;
/* Get the max thread dimensions */ /* Get the max thread dimensions */
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_WORK_GROUP_SIZE, error = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_GROUP_SIZE,
sizeof(deviceMaxThreadSize), &deviceMaxThreadSize, sizeof(deviceMaxThreadSize), &deviceMaxThreadSize,
NULL); NULL);
test_error(error, "Unable to get max work group size from device"); test_error(error, "Unable to get max work group size from device");
@@ -268,8 +265,7 @@ int test_min_max_work_group_size(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_read_image_args(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_read_image_args)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
unsigned int maxReadImages, i; unsigned int maxReadImages, i;
@@ -290,12 +286,12 @@ int test_min_max_read_image_args(cl_device_id deviceID, cl_context context,
cl_uint minRequiredReadImages = gIsEmbedded ? 8 : 128; cl_uint minRequiredReadImages = gIsEmbedded ? 8 : 128;
cl_device_type deviceType; cl_device_type deviceType;
PASSIVE_REQUIRE_IMAGE_SUPPORT(deviceID) PASSIVE_REQUIRE_IMAGE_SUPPORT(device)
image_format_desc.image_channel_order = CL_RGBA; image_format_desc.image_channel_order = CL_RGBA;
image_format_desc.image_channel_data_type = CL_FLOAT; image_format_desc.image_channel_data_type = CL_FLOAT;
/* Get the max read image arg count */ /* Get the max read image arg count */
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_READ_IMAGE_ARGS, error = clGetDeviceInfo(device, CL_DEVICE_MAX_READ_IMAGE_ARGS,
sizeof(maxReadImages), &maxReadImages, NULL); sizeof(maxReadImages), &maxReadImages, NULL);
test_error(error, "Unable to get max read image arg count from device"); test_error(error, "Unable to get max read image arg count from device");
@@ -310,19 +306,19 @@ int test_min_max_read_image_args(cl_device_id deviceID, cl_context context,
log_info("Reported %d max read image args.\n", maxReadImages); log_info("Reported %d max read image args.\n", maxReadImages);
error = error =
clGetDeviceInfo(deviceID, CL_DEVICE_ADDRESS_BITS, clGetDeviceInfo(device, CL_DEVICE_ADDRESS_BITS,
sizeof(deviceAddressSize), &deviceAddressSize, NULL); sizeof(deviceAddressSize), &deviceAddressSize, NULL);
test_error(error, "Unable to query CL_DEVICE_ADDRESS_BITS for device"); test_error(error, "Unable to query CL_DEVICE_ADDRESS_BITS for device");
deviceAddressSize /= 8; // convert from bits to bytes deviceAddressSize /= 8; // convert from bits to bytes
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_PARAMETER_SIZE, error = clGetDeviceInfo(device, CL_DEVICE_MAX_PARAMETER_SIZE,
sizeof(maxParameterSize), &maxParameterSize, NULL); sizeof(maxParameterSize), &maxParameterSize, NULL);
test_error(error, "Unable to get max parameter size from device"); test_error(error, "Unable to get max parameter size from device");
if (!gIsEmbedded && maxReadImages >= 128 && maxParameterSize == 1024) if (!gIsEmbedded && maxReadImages >= 128 && maxParameterSize == 1024)
{ {
error = clGetDeviceInfo(deviceID, CL_DEVICE_TYPE, sizeof(deviceType), error = clGetDeviceInfo(device, CL_DEVICE_TYPE, sizeof(deviceType),
&deviceType, NULL); &deviceType, NULL);
test_error(error, "Unable to get device type from device"); test_error(error, "Unable to get device type from device");
@@ -434,8 +430,7 @@ int test_min_max_read_image_args(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_write_image_args(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_write_image_args)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
unsigned int maxWriteImages, i; unsigned int maxWriteImages, i;
@@ -452,12 +447,12 @@ int test_min_max_write_image_args(cl_device_id deviceID, cl_context context,
cl_uint minRequiredWriteImages = gIsEmbedded ? 1 : 8; cl_uint minRequiredWriteImages = gIsEmbedded ? 1 : 8;
PASSIVE_REQUIRE_IMAGE_SUPPORT(deviceID) PASSIVE_REQUIRE_IMAGE_SUPPORT(device)
image_format_desc.image_channel_order = CL_RGBA; image_format_desc.image_channel_order = CL_RGBA;
image_format_desc.image_channel_data_type = CL_UNORM_INT8; image_format_desc.image_channel_data_type = CL_UNORM_INT8;
/* Get the max read image arg count */ /* Get the max read image arg count */
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_WRITE_IMAGE_ARGS, error = clGetDeviceInfo(device, CL_DEVICE_MAX_WRITE_IMAGE_ARGS,
sizeof(maxWriteImages), &maxWriteImages, NULL); sizeof(maxWriteImages), &maxWriteImages, NULL);
test_error(error, "Unable to get max write image arg count from device"); test_error(error, "Unable to get max write image arg count from device");
@@ -480,7 +475,7 @@ int test_min_max_write_image_args(cl_device_id deviceID, cl_context context,
log_info("Reported %d max write image args.\n", maxWriteImages); log_info("Reported %d max write image args.\n", maxWriteImages);
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_PARAMETER_SIZE, error = clGetDeviceInfo(device, CL_DEVICE_MAX_PARAMETER_SIZE,
sizeof(maxParameterSize), &maxParameterSize, NULL); sizeof(maxParameterSize), &maxParameterSize, NULL);
test_error(error, "Unable to get max parameter size from device"); test_error(error, "Unable to get max parameter size from device");
@@ -563,8 +558,7 @@ int test_min_max_write_image_args(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_mem_alloc_size(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_mem_alloc_size)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
cl_ulong maxAllocSize, memSize, minSizeToTry, currentSize; cl_ulong maxAllocSize, memSize, minSizeToTry, currentSize;
@@ -580,9 +574,9 @@ int test_min_max_mem_alloc_size(cl_device_id deviceID, cl_context context,
/* Get the max mem alloc size, limit the alloc to half of the available /* Get the max mem alloc size, limit the alloc to half of the available
* memory */ * memory */
maxAllocSize = get_device_info_max_mem_alloc_size( maxAllocSize = get_device_info_max_mem_alloc_size(
deviceID, MAX_DEVICE_MEMORY_SIZE_DIVISOR); device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
memSize = get_device_info_global_mem_size(deviceID, memSize =
MAX_DEVICE_MEMORY_SIZE_DIVISOR); get_device_info_global_mem_size(device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
if (memSize < maxAllocSize) if (memSize < maxAllocSize)
{ {
@@ -635,8 +629,7 @@ int test_min_max_mem_alloc_size(cl_device_id deviceID, cl_context context,
return -1; return -1;
} }
int test_min_max_image_2d_width(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_image_2d_width)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
size_t maxDimension; size_t maxDimension;
@@ -645,9 +638,9 @@ int test_min_max_image_2d_width(cl_device_id deviceID, cl_context context,
cl_ulong maxAllocSize; cl_ulong maxAllocSize;
cl_uint minRequiredDimension; cl_uint minRequiredDimension;
PASSIVE_REQUIRE_IMAGE_SUPPORT(deviceID) PASSIVE_REQUIRE_IMAGE_SUPPORT(device)
auto version = get_device_cl_version(deviceID); auto version = get_device_cl_version(device);
if (version == Version(1, 0)) if (version == Version(1, 0))
{ {
minRequiredDimension = gIsEmbedded ? 2048 : 4096; minRequiredDimension = gIsEmbedded ? 2048 : 4096;
@@ -664,7 +657,7 @@ int test_min_max_image_2d_width(cl_device_id deviceID, cl_context context,
test_error(error, "Unable to obtain suitable image format to test with!"); test_error(error, "Unable to obtain suitable image format to test with!");
/* Get the max 2d image width */ /* Get the max 2d image width */
error = clGetDeviceInfo(deviceID, CL_DEVICE_IMAGE2D_MAX_WIDTH, error = clGetDeviceInfo(device, CL_DEVICE_IMAGE2D_MAX_WIDTH,
sizeof(maxDimension), &maxDimension, NULL); sizeof(maxDimension), &maxDimension, NULL);
test_error(error, "Unable to get max image 2d width from device"); test_error(error, "Unable to get max image 2d width from device");
@@ -689,7 +682,7 @@ int test_min_max_image_2d_width(cl_device_id deviceID, cl_context context,
/* Verify that we can actually allocate an image that large */ /* Verify that we can actually allocate an image that large */
maxAllocSize = get_device_info_max_mem_alloc_size( maxAllocSize = get_device_info_max_mem_alloc_size(
deviceID, MAX_DEVICE_MEMORY_SIZE_DIVISOR); device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
if ((cl_ulong)maxDimension * 1 * 4 > maxAllocSize) if ((cl_ulong)maxDimension * 1 * 4 > maxAllocSize)
{ {
log_error("Can not allocate a large enough image (min size: %" PRIu64 log_error("Can not allocate a large enough image (min size: %" PRIu64
@@ -713,8 +706,7 @@ int test_min_max_image_2d_width(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_image_2d_height(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_image_2d_height)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
size_t maxDimension; size_t maxDimension;
@@ -723,9 +715,9 @@ int test_min_max_image_2d_height(cl_device_id deviceID, cl_context context,
cl_ulong maxAllocSize; cl_ulong maxAllocSize;
cl_uint minRequiredDimension; cl_uint minRequiredDimension;
PASSIVE_REQUIRE_IMAGE_SUPPORT(deviceID) PASSIVE_REQUIRE_IMAGE_SUPPORT(device)
auto version = get_device_cl_version(deviceID); auto version = get_device_cl_version(device);
if (version == Version(1, 0)) if (version == Version(1, 0))
{ {
minRequiredDimension = gIsEmbedded ? 2048 : 4096; minRequiredDimension = gIsEmbedded ? 2048 : 4096;
@@ -741,7 +733,7 @@ int test_min_max_image_2d_height(cl_device_id deviceID, cl_context context,
test_error(error, "Unable to obtain suitable image format to test with!"); test_error(error, "Unable to obtain suitable image format to test with!");
/* Get the max 2d image width */ /* Get the max 2d image width */
error = clGetDeviceInfo(deviceID, CL_DEVICE_IMAGE2D_MAX_HEIGHT, error = clGetDeviceInfo(device, CL_DEVICE_IMAGE2D_MAX_HEIGHT,
sizeof(maxDimension), &maxDimension, NULL); sizeof(maxDimension), &maxDimension, NULL);
test_error(error, "Unable to get max image 2d height from device"); test_error(error, "Unable to get max image 2d height from device");
@@ -766,7 +758,7 @@ int test_min_max_image_2d_height(cl_device_id deviceID, cl_context context,
/* Verify that we can actually allocate an image that large */ /* Verify that we can actually allocate an image that large */
maxAllocSize = get_device_info_max_mem_alloc_size( maxAllocSize = get_device_info_max_mem_alloc_size(
deviceID, MAX_DEVICE_MEMORY_SIZE_DIVISOR); device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
if ((cl_ulong)maxDimension * 1 * 4 > maxAllocSize) if ((cl_ulong)maxDimension * 1 * 4 > maxAllocSize)
{ {
log_error("Can not allocate a large enough image (min size: %" PRIu64 log_error("Can not allocate a large enough image (min size: %" PRIu64
@@ -790,8 +782,7 @@ int test_min_max_image_2d_height(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_image_3d_width(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_image_3d_width)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
size_t maxDimension; size_t maxDimension;
@@ -800,7 +791,7 @@ int test_min_max_image_3d_width(cl_device_id deviceID, cl_context context,
cl_ulong maxAllocSize; cl_ulong maxAllocSize;
PASSIVE_REQUIRE_3D_IMAGE_SUPPORT(deviceID) PASSIVE_REQUIRE_3D_IMAGE_SUPPORT(device)
/* Just get any ol format to test with */ /* Just get any ol format to test with */
error = get_8_bit_image_format(context, CL_MEM_OBJECT_IMAGE3D, error = get_8_bit_image_format(context, CL_MEM_OBJECT_IMAGE3D,
@@ -808,7 +799,7 @@ int test_min_max_image_3d_width(cl_device_id deviceID, cl_context context,
test_error(error, "Unable to obtain suitable image format to test with!"); test_error(error, "Unable to obtain suitable image format to test with!");
/* Get the max 2d image width */ /* Get the max 2d image width */
error = clGetDeviceInfo(deviceID, CL_DEVICE_IMAGE3D_MAX_WIDTH, error = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_WIDTH,
sizeof(maxDimension), &maxDimension, NULL); sizeof(maxDimension), &maxDimension, NULL);
test_error(error, "Unable to get max image 3d width from device"); test_error(error, "Unable to get max image 3d width from device");
@@ -833,7 +824,7 @@ int test_min_max_image_3d_width(cl_device_id deviceID, cl_context context,
/* Verify that we can actually allocate an image that large */ /* Verify that we can actually allocate an image that large */
maxAllocSize = get_device_info_max_mem_alloc_size( maxAllocSize = get_device_info_max_mem_alloc_size(
deviceID, MAX_DEVICE_MEMORY_SIZE_DIVISOR); device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
if ((cl_ulong)maxDimension * 2 * 4 > maxAllocSize) if ((cl_ulong)maxDimension * 2 * 4 > maxAllocSize)
{ {
log_error("Can not allocate a large enough image (min size: %" PRIu64 log_error("Can not allocate a large enough image (min size: %" PRIu64
@@ -858,8 +849,7 @@ int test_min_max_image_3d_width(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_image_3d_height(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_image_3d_height)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
size_t maxDimension; size_t maxDimension;
@@ -868,7 +858,7 @@ int test_min_max_image_3d_height(cl_device_id deviceID, cl_context context,
cl_ulong maxAllocSize; cl_ulong maxAllocSize;
PASSIVE_REQUIRE_3D_IMAGE_SUPPORT(deviceID) PASSIVE_REQUIRE_3D_IMAGE_SUPPORT(device)
/* Just get any ol format to test with */ /* Just get any ol format to test with */
error = get_8_bit_image_format(context, CL_MEM_OBJECT_IMAGE3D, error = get_8_bit_image_format(context, CL_MEM_OBJECT_IMAGE3D,
@@ -876,7 +866,7 @@ int test_min_max_image_3d_height(cl_device_id deviceID, cl_context context,
test_error(error, "Unable to obtain suitable image format to test with!"); test_error(error, "Unable to obtain suitable image format to test with!");
/* Get the max 2d image width */ /* Get the max 2d image width */
error = clGetDeviceInfo(deviceID, CL_DEVICE_IMAGE3D_MAX_HEIGHT, error = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_HEIGHT,
sizeof(maxDimension), &maxDimension, NULL); sizeof(maxDimension), &maxDimension, NULL);
test_error(error, "Unable to get max image 3d height from device"); test_error(error, "Unable to get max image 3d height from device");
@@ -901,7 +891,7 @@ int test_min_max_image_3d_height(cl_device_id deviceID, cl_context context,
/* Verify that we can actually allocate an image that large */ /* Verify that we can actually allocate an image that large */
maxAllocSize = get_device_info_max_mem_alloc_size( maxAllocSize = get_device_info_max_mem_alloc_size(
deviceID, MAX_DEVICE_MEMORY_SIZE_DIVISOR); device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
if ((cl_ulong)maxDimension * 2 * 4 > maxAllocSize) if ((cl_ulong)maxDimension * 2 * 4 > maxAllocSize)
{ {
log_error("Can not allocate a large enough image (min size: %" PRIu64 log_error("Can not allocate a large enough image (min size: %" PRIu64
@@ -927,8 +917,7 @@ int test_min_max_image_3d_height(cl_device_id deviceID, cl_context context,
} }
int test_min_max_image_3d_depth(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_image_3d_depth)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
size_t maxDimension; size_t maxDimension;
@@ -937,7 +926,7 @@ int test_min_max_image_3d_depth(cl_device_id deviceID, cl_context context,
cl_ulong maxAllocSize; cl_ulong maxAllocSize;
PASSIVE_REQUIRE_3D_IMAGE_SUPPORT(deviceID) PASSIVE_REQUIRE_3D_IMAGE_SUPPORT(device)
/* Just get any ol format to test with */ /* Just get any ol format to test with */
error = get_8_bit_image_format(context, CL_MEM_OBJECT_IMAGE3D, error = get_8_bit_image_format(context, CL_MEM_OBJECT_IMAGE3D,
@@ -945,7 +934,7 @@ int test_min_max_image_3d_depth(cl_device_id deviceID, cl_context context,
test_error(error, "Unable to obtain suitable image format to test with!"); test_error(error, "Unable to obtain suitable image format to test with!");
/* Get the max 2d image width */ /* Get the max 2d image width */
error = clGetDeviceInfo(deviceID, CL_DEVICE_IMAGE3D_MAX_DEPTH, error = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_DEPTH,
sizeof(maxDimension), &maxDimension, NULL); sizeof(maxDimension), &maxDimension, NULL);
test_error(error, "Unable to get max image 3d depth from device"); test_error(error, "Unable to get max image 3d depth from device");
@@ -970,7 +959,7 @@ int test_min_max_image_3d_depth(cl_device_id deviceID, cl_context context,
/* Verify that we can actually allocate an image that large */ /* Verify that we can actually allocate an image that large */
maxAllocSize = get_device_info_max_mem_alloc_size( maxAllocSize = get_device_info_max_mem_alloc_size(
deviceID, MAX_DEVICE_MEMORY_SIZE_DIVISOR); device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
if ((cl_ulong)maxDimension * 1 * 4 > maxAllocSize) if ((cl_ulong)maxDimension * 1 * 4 > maxAllocSize)
{ {
log_error("Can not allocate a large enough image (min size: %" PRIu64 log_error("Can not allocate a large enough image (min size: %" PRIu64
@@ -994,8 +983,7 @@ int test_min_max_image_3d_depth(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_image_array_size(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_image_array_size)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
size_t maxDimension; size_t maxDimension;
@@ -1004,7 +992,7 @@ int test_min_max_image_array_size(cl_device_id deviceID, cl_context context,
cl_ulong maxAllocSize; cl_ulong maxAllocSize;
size_t minRequiredDimension = gIsEmbedded ? 256 : 2048; size_t minRequiredDimension = gIsEmbedded ? 256 : 2048;
PASSIVE_REQUIRE_IMAGE_SUPPORT(deviceID); PASSIVE_REQUIRE_IMAGE_SUPPORT(device);
/* Just get any ol format to test with */ /* Just get any ol format to test with */
error = get_8_bit_image_format(context, CL_MEM_OBJECT_IMAGE2D_ARRAY, error = get_8_bit_image_format(context, CL_MEM_OBJECT_IMAGE2D_ARRAY,
@@ -1012,7 +1000,7 @@ int test_min_max_image_array_size(cl_device_id deviceID, cl_context context,
test_error(error, "Unable to obtain suitable image format to test with!"); test_error(error, "Unable to obtain suitable image format to test with!");
/* Get the max image array width */ /* Get the max image array width */
error = clGetDeviceInfo(deviceID, CL_DEVICE_IMAGE_MAX_ARRAY_SIZE, error = clGetDeviceInfo(device, CL_DEVICE_IMAGE_MAX_ARRAY_SIZE,
sizeof(maxDimension), &maxDimension, NULL); sizeof(maxDimension), &maxDimension, NULL);
test_error(error, "Unable to get max image array size from device"); test_error(error, "Unable to get max image array size from device");
@@ -1038,7 +1026,7 @@ int test_min_max_image_array_size(cl_device_id deviceID, cl_context context,
/* Verify that we can actually allocate an image that large */ /* Verify that we can actually allocate an image that large */
maxAllocSize = get_device_info_max_mem_alloc_size( maxAllocSize = get_device_info_max_mem_alloc_size(
deviceID, MAX_DEVICE_MEMORY_SIZE_DIVISOR); device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
if ((cl_ulong)maxDimension * 1 * 4 > maxAllocSize) if ((cl_ulong)maxDimension * 1 * 4 > maxAllocSize)
{ {
log_error("Can not allocate a large enough image (min size: %" PRIu64 log_error("Can not allocate a large enough image (min size: %" PRIu64
@@ -1064,8 +1052,7 @@ int test_min_max_image_array_size(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_image_buffer_size(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_image_buffer_size)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
size_t maxDimensionPixels; size_t maxDimensionPixels;
@@ -1076,15 +1063,15 @@ int test_min_max_image_buffer_size(cl_device_id deviceID, cl_context context,
unsigned int i = 0; unsigned int i = 0;
size_t pixelBytes = 0; size_t pixelBytes = 0;
PASSIVE_REQUIRE_IMAGE_SUPPORT(deviceID); PASSIVE_REQUIRE_IMAGE_SUPPORT(device);
/* Get the max memory allocation size, divide it */ /* Get the max memory allocation size, divide it */
maxAllocSize = get_device_info_max_mem_alloc_size( maxAllocSize = get_device_info_max_mem_alloc_size(
deviceID, MAX_DEVICE_MEMORY_SIZE_DIVISOR); device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
/* Get the max image array width */ /* Get the max image array width */
error = error =
clGetDeviceInfo(deviceID, CL_DEVICE_IMAGE_MAX_BUFFER_SIZE, clGetDeviceInfo(device, CL_DEVICE_IMAGE_MAX_BUFFER_SIZE,
sizeof(maxDimensionPixels), &maxDimensionPixels, NULL); sizeof(maxDimensionPixels), &maxDimensionPixels, NULL);
test_error(error, "Unable to get max image buffer size from device"); test_error(error, "Unable to get max image buffer size from device");
@@ -1154,8 +1141,7 @@ int test_min_max_image_buffer_size(cl_device_id deviceID, cl_context context,
} }
int test_min_max_parameter_size(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_parameter_size)
cl_command_queue queue, int num_elements)
{ {
int error, i; int error, i;
size_t maxSize; size_t maxSize;
@@ -1174,7 +1160,7 @@ int test_min_max_parameter_size(cl_device_id deviceID, cl_context context,
/* Get the max param size */ /* Get the max param size */
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_PARAMETER_SIZE, error = clGetDeviceInfo(device, CL_DEVICE_MAX_PARAMETER_SIZE,
sizeof(maxSize), &maxSize, NULL); sizeof(maxSize), &maxSize, NULL);
test_error(error, "Unable to get max parameter size from device"); test_error(error, "Unable to get max parameter size from device");
@@ -1407,8 +1393,7 @@ int test_min_max_parameter_size(cl_device_id deviceID, cl_context context,
return -1; return -1;
} }
int test_min_max_samplers(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_samplers)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
cl_uint maxSamplers, i; cl_uint maxSamplers, i;
@@ -1421,11 +1406,11 @@ int test_min_max_samplers(cl_device_id deviceID, cl_context context,
cl_uint minRequiredSamplers = gIsEmbedded ? 8 : 16; cl_uint minRequiredSamplers = gIsEmbedded ? 8 : 16;
PASSIVE_REQUIRE_IMAGE_SUPPORT(deviceID) PASSIVE_REQUIRE_IMAGE_SUPPORT(device)
/* Get the max value */ /* Get the max value */
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_SAMPLERS, error = clGetDeviceInfo(device, CL_DEVICE_MAX_SAMPLERS, sizeof(maxSamplers),
sizeof(maxSamplers), &maxSamplers, NULL); &maxSamplers, NULL);
test_error(error, "Unable to get max sampler count from device"); test_error(error, "Unable to get max sampler count from device");
if (maxSamplers < minRequiredSamplers) if (maxSamplers < minRequiredSamplers)
@@ -1438,7 +1423,7 @@ int test_min_max_samplers(cl_device_id deviceID, cl_context context,
log_info("Reported max %d samplers.\n", maxSamplers); log_info("Reported max %d samplers.\n", maxSamplers);
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_PARAMETER_SIZE, error = clGetDeviceInfo(device, CL_DEVICE_MAX_PARAMETER_SIZE,
sizeof(maxParameterSize), &maxParameterSize, NULL); sizeof(maxParameterSize), &maxParameterSize, NULL);
test_error(error, "Unable to get max parameter size from device"); test_error(error, "Unable to get max parameter size from device");
@@ -1531,8 +1516,7 @@ int test_min_max_samplers(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_constant_buffer_size(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_constant_buffer_size)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -1547,7 +1531,7 @@ int test_min_max_constant_buffer_size(cl_device_id deviceID, cl_context context,
/* Verify our test buffer won't be bigger than allowed */ /* Verify our test buffer won't be bigger than allowed */
maxSize = get_device_info_max_constant_buffer_size( maxSize = get_device_info_max_constant_buffer_size(
deviceID, MAX_DEVICE_MEMORY_SIZE_DIVISOR); device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
if ((0 == gIsEmbedded if ((0 == gIsEmbedded
&& (maxSize * MAX_DEVICE_MEMORY_SIZE_DIVISOR) < 64L * 1024L) && (maxSize * MAX_DEVICE_MEMORY_SIZE_DIVISOR) < 64L * 1024L)
@@ -1564,12 +1548,12 @@ int test_min_max_constant_buffer_size(cl_device_id deviceID, cl_context context,
/* We have four buffers allocations */ /* We have four buffers allocations */
maxGlobalSize = get_device_info_global_mem_size( maxGlobalSize = get_device_info_global_mem_size(
deviceID, MAX_DEVICE_MEMORY_SIZE_DIVISOR * 4); device, MAX_DEVICE_MEMORY_SIZE_DIVISOR * 4);
if (maxSize > maxGlobalSize) maxSize = maxGlobalSize; if (maxSize > maxGlobalSize) maxSize = maxGlobalSize;
maxAllocSize = get_device_info_max_mem_alloc_size( maxAllocSize = get_device_info_max_mem_alloc_size(
deviceID, MAX_DEVICE_MEMORY_SIZE_DIVISOR); device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
if (maxSize > maxAllocSize) maxSize = maxAllocSize; if (maxSize > maxAllocSize) maxSize = maxAllocSize;
@@ -1731,8 +1715,7 @@ int test_min_max_constant_buffer_size(cl_device_id deviceID, cl_context context,
return -1; return -1;
} }
int test_min_max_constant_args(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_constant_args)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -1751,11 +1734,11 @@ int test_min_max_constant_args(cl_device_id deviceID, cl_context context,
/* Verify our test buffer won't be bigger than allowed */ /* Verify our test buffer won't be bigger than allowed */
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_CONSTANT_ARGS, error = clGetDeviceInfo(device, CL_DEVICE_MAX_CONSTANT_ARGS,
sizeof(maxArgs), &maxArgs, 0); sizeof(maxArgs), &maxArgs, 0);
test_error(error, "Unable to get max constant arg count"); test_error(error, "Unable to get max constant arg count");
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_PARAMETER_SIZE, error = clGetDeviceInfo(device, CL_DEVICE_MAX_PARAMETER_SIZE,
sizeof(maxParameterSize), &maxParameterSize, NULL); sizeof(maxParameterSize), &maxParameterSize, NULL);
test_error(error, "Unable to get max parameter size from device"); test_error(error, "Unable to get max parameter size from device");
@@ -1782,7 +1765,7 @@ int test_min_max_constant_args(cl_device_id deviceID, cl_context context,
} }
maxSize = get_device_info_max_constant_buffer_size( maxSize = get_device_info_max_constant_buffer_size(
deviceID, MAX_DEVICE_MEMORY_SIZE_DIVISOR); device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
individualBufferSize = ((int)maxSize / 2) / maxArgs; individualBufferSize = ((int)maxSize / 2) / maxArgs;
log_info("Reported max constant arg count of %u and max constant buffer " log_info("Reported max constant arg count of %u and max constant buffer "
@@ -1873,15 +1856,14 @@ int test_min_max_constant_args(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_compute_units(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_compute_units)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
cl_uint value; cl_uint value;
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_COMPUTE_UNITS, error = clGetDeviceInfo(device, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(value),
sizeof(value), &value, 0); &value, 0);
test_error(error, "Unable to get compute unit count"); test_error(error, "Unable to get compute unit count");
if (value < 1) if (value < 1)
@@ -1897,14 +1879,13 @@ int test_min_max_compute_units(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_address_bits(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_address_bits)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
cl_uint value; cl_uint value;
error = clGetDeviceInfo(deviceID, CL_DEVICE_ADDRESS_BITS, sizeof(value), error = clGetDeviceInfo(device, CL_DEVICE_ADDRESS_BITS, sizeof(value),
&value, 0); &value, 0);
test_error(error, "Unable to get address bit count"); test_error(error, "Unable to get address bit count");
@@ -1921,19 +1902,18 @@ int test_min_max_address_bits(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_single_fp_config(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_single_fp_config)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
cl_device_fp_config value; cl_device_fp_config value;
char profile[128] = ""; char profile[128] = "";
error = clGetDeviceInfo(deviceID, CL_DEVICE_SINGLE_FP_CONFIG, sizeof(value), error = clGetDeviceInfo(device, CL_DEVICE_SINGLE_FP_CONFIG, sizeof(value),
&value, 0); &value, 0);
test_error(error, "Unable to get device single fp config"); test_error(error, "Unable to get device single fp config");
// Check to see if we are an embedded profile device // Check to see if we are an embedded profile device
if ((error = clGetDeviceInfo(deviceID, CL_DEVICE_PROFILE, sizeof(profile), if ((error = clGetDeviceInfo(device, CL_DEVICE_PROFILE, sizeof(profile),
profile, NULL))) profile, NULL)))
{ {
log_error("FAILURE: Unable to get CL_DEVICE_PROFILE: error %d\n", log_error("FAILURE: Unable to get CL_DEVICE_PROFILE: error %d\n",
@@ -1965,13 +1945,12 @@ int test_min_max_single_fp_config(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_double_fp_config(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_double_fp_config)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
cl_device_fp_config value; cl_device_fp_config value;
error = clGetDeviceInfo(deviceID, CL_DEVICE_DOUBLE_FP_CONFIG, sizeof(value), error = clGetDeviceInfo(device, CL_DEVICE_DOUBLE_FP_CONFIG, sizeof(value),
&value, 0); &value, 0);
test_error(error, "Unable to get device double fp config"); test_error(error, "Unable to get device double fp config");
@@ -1991,8 +1970,7 @@ int test_min_max_double_fp_config(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_local_mem_size(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_local_mem_size)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -2007,13 +1985,13 @@ int test_min_max_local_mem_size(cl_device_id deviceID, cl_context context,
MTdata d; MTdata d;
/* Verify our test buffer won't be bigger than allowed */ /* Verify our test buffer won't be bigger than allowed */
error = clGetDeviceInfo(deviceID, CL_DEVICE_LOCAL_MEM_SIZE, sizeof(maxSize), error = clGetDeviceInfo(device, CL_DEVICE_LOCAL_MEM_SIZE, sizeof(maxSize),
&maxSize, 0); &maxSize, 0);
test_error(error, "Unable to get max local buffer size"); test_error(error, "Unable to get max local buffer size");
try try
{ {
device_version = get_device_cl_version(deviceID); device_version = get_device_cl_version(device);
} catch (const std::runtime_error &e) } catch (const std::runtime_error &e)
{ {
log_error("%s", e.what()); log_error("%s", e.what());
@@ -2052,7 +2030,7 @@ int test_min_max_local_mem_size(cl_device_id deviceID, cl_context context,
return -1; return -1;
} }
error = clGetKernelWorkGroupInfo(kernel, deviceID, CL_KERNEL_LOCAL_MEM_SIZE, error = clGetKernelWorkGroupInfo(kernel, device, CL_KERNEL_LOCAL_MEM_SIZE,
sizeof(kernelLocalUsage), sizeof(kernelLocalUsage),
&kernelLocalUsage, NULL); &kernelLocalUsage, NULL);
test_error(error, test_error(error,
@@ -2142,9 +2120,7 @@ int test_min_max_local_mem_size(cl_device_id deviceID, cl_context context,
return err; return err;
} }
int test_min_max_kernel_preferred_work_group_size_multiple( REGISTER_TEST(min_max_kernel_preferred_work_group_size_multiple)
cl_device_id deviceID, cl_context context, cl_command_queue queue,
int num_elements)
{ {
int err; int err;
clProgramWrapper program; clProgramWrapper program;
@@ -2157,17 +2133,17 @@ int test_min_max_kernel_preferred_work_group_size_multiple(
sample_local_arg_kernel, "sample_test"); sample_local_arg_kernel, "sample_test");
test_error(err, "Failed to build kernel/program."); test_error(err, "Failed to build kernel/program.");
err = clGetKernelWorkGroupInfo(kernel, deviceID, CL_KERNEL_WORK_GROUP_SIZE, err = clGetKernelWorkGroupInfo(kernel, device, CL_KERNEL_WORK_GROUP_SIZE,
sizeof(max_workgroup_size), sizeof(max_workgroup_size),
&max_workgroup_size, NULL); &max_workgroup_size, NULL);
test_error(err, "clGetKernelWorkgroupInfo failed."); test_error(err, "clGetKernelWorkgroupInfo failed.");
err = clGetKernelWorkGroupInfo( err = clGetKernelWorkGroupInfo(
kernel, deviceID, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, kernel, device, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE,
sizeof(preferred_workgroup_size), &preferred_workgroup_size, NULL); sizeof(preferred_workgroup_size), &preferred_workgroup_size, NULL);
test_error(err, "clGetKernelWorkgroupInfo failed."); test_error(err, "clGetKernelWorkgroupInfo failed.");
err = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_WORK_ITEM_SIZES, err = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_SIZES,
sizeof(max_local_workgroup_size), sizeof(max_local_workgroup_size),
max_local_workgroup_size, NULL); max_local_workgroup_size, NULL);
test_error(err, "clGetDeviceInfo failed for CL_DEVICE_MAX_WORK_ITEM_SIZES"); test_error(err, "clGetDeviceInfo failed for CL_DEVICE_MAX_WORK_ITEM_SIZES");
@@ -2188,16 +2164,13 @@ int test_min_max_kernel_preferred_work_group_size_multiple(
return 0; return 0;
} }
int test_min_max_execution_capabilities(cl_device_id deviceID, REGISTER_TEST(min_max_execution_capabilities)
cl_context context,
cl_command_queue queue,
int num_elements)
{ {
int error; int error;
cl_device_exec_capabilities value; cl_device_exec_capabilities value;
error = clGetDeviceInfo(deviceID, CL_DEVICE_EXECUTION_CAPABILITIES, error = clGetDeviceInfo(device, CL_DEVICE_EXECUTION_CAPABILITIES,
sizeof(value), &value, 0); sizeof(value), &value, 0);
test_error(error, "Unable to get execution capabilities"); test_error(error, "Unable to get execution capabilities");
@@ -2211,14 +2184,13 @@ int test_min_max_execution_capabilities(cl_device_id deviceID,
return 0; return 0;
} }
int test_min_max_queue_properties(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_queue_properties)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
cl_command_queue_properties value; cl_command_queue_properties value;
error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES, error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES,
sizeof(value), &value, 0); sizeof(value), &value, 0);
test_error(error, "Unable to get queue properties"); test_error(error, "Unable to get queue properties");
@@ -2232,11 +2204,10 @@ int test_min_max_queue_properties(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_device_version(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_device_version)
cl_command_queue queue, int num_elements)
{ {
// Query for the device version. // Query for the device version.
Version device_cl_version = get_device_cl_version(deviceID); Version device_cl_version = get_device_cl_version(device);
log_info("Returned version %s.\n", device_cl_version.to_string().c_str()); log_info("Returned version %s.\n", device_cl_version.to_string().c_str());
// Make sure 2.x devices support required extensions for 2.x // Make sure 2.x devices support required extensions for 2.x
@@ -2264,7 +2235,7 @@ int test_min_max_device_version(cl_device_id deviceID, cl_context context,
"devices...\n"); "devices...\n");
for (size_t i = 0; i < ARRAY_SIZE(requiredExtensions11); i++) for (size_t i = 0; i < ARRAY_SIZE(requiredExtensions11); i++)
{ {
if (!is_extension_available(deviceID, requiredExtensions11[i])) if (!is_extension_available(device, requiredExtensions11[i]))
{ {
log_error("ERROR: Required extension for 1.1 and greater " log_error("ERROR: Required extension for 1.1 and greater "
"devices is not in extension string: %s\n", "devices is not in extension string: %s\n",
@@ -2283,13 +2254,13 @@ int test_min_max_device_version(cl_device_id deviceID, cl_context context,
// cl_khr_fp64 and it is only required if double precision is // cl_khr_fp64 and it is only required if double precision is
// supported. // supported.
cl_device_fp_config doubles_supported; cl_device_fp_config doubles_supported;
cl_int error = clGetDeviceInfo(deviceID, CL_DEVICE_DOUBLE_FP_CONFIG, cl_int error = clGetDeviceInfo(device, CL_DEVICE_DOUBLE_FP_CONFIG,
sizeof(doubles_supported), sizeof(doubles_supported),
&doubles_supported, 0); &doubles_supported, 0);
test_error(error, "Unable to get device double fp config"); test_error(error, "Unable to get device double fp config");
if (doubles_supported) if (doubles_supported)
{ {
if (!is_extension_available(deviceID, "cl_khr_fp64")) if (!is_extension_available(device, "cl_khr_fp64"))
{ {
log_error( log_error(
"ERROR: Required extension for 1.2 and greater devices " "ERROR: Required extension for 1.2 and greater devices "
@@ -2309,7 +2280,7 @@ int test_min_max_device_version(cl_device_id deviceID, cl_context context,
"2.2 devices...\n"); "2.2 devices...\n");
for (size_t i = 0; i < ARRAY_SIZE(requiredExtensions2x); i++) for (size_t i = 0; i < ARRAY_SIZE(requiredExtensions2x); i++)
{ {
if (!is_extension_available(deviceID, requiredExtensions2x[i])) if (!is_extension_available(device, requiredExtensions2x[i]))
{ {
log_error("ERROR: Required extension for 2.0, 2.1 and 2.2 " log_error("ERROR: Required extension for 2.0, 2.1 and 2.2 "
"devices is not in extension string: %s\n", "devices is not in extension string: %s\n",
@@ -2329,16 +2300,15 @@ int test_min_max_device_version(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_min_max_language_version(cl_device_id deviceID, cl_context context, REGISTER_TEST(min_max_language_version)
cl_command_queue queue, int num_elements)
{ {
cl_int error; cl_int error;
cl_char buffer[4098]; cl_char buffer[4098];
size_t length; size_t length;
// Device version should fit the regex "OpenCL [0-9]+\.[0-9]+ *.*" // Device version should fit the regex "OpenCL [0-9]+\.[0-9]+ *.*"
error = clGetDeviceInfo(deviceID, CL_DEVICE_OPENCL_C_VERSION, error = clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_VERSION, sizeof(buffer),
sizeof(buffer), buffer, &length); buffer, &length);
test_error(error, "Unable to get device opencl c version string"); test_error(error, "Unable to get device opencl c version string");
if (memcmp(buffer, "OpenCL C ", strlen("OpenCL C ")) != 0) if (memcmp(buffer, "OpenCL C ", strlen("OpenCL C ")) != 0)
{ {

View File

@@ -25,7 +25,7 @@ static const char *sample_binary_kernel_source[] = {
"}\n" }; "}\n" };
int test_binary_get(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(binary_get)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -71,7 +71,7 @@ int test_binary_get(cl_device_id deviceID, cl_context context, cl_command_queue
} }
int test_binary_create(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(binary_create)
{ {
/* To test this in a self-contained fashion, we have to create a program with /* To test this in a self-contained fashion, we have to create a program with
source, then get the binary, then use that binary to reload the program, and then verify */ source, then get the binary, then use that binary to reload the program, and then verify */
@@ -103,11 +103,12 @@ int test_binary_create(cl_device_id deviceID, cl_context context, cl_command_que
test_error( error, "Unable to get program binary" ); test_error( error, "Unable to get program binary" );
cl_int loadErrors[ 1 ]; cl_int loadErrors[ 1 ];
program_from_binary = clCreateProgramWithBinary( context, 1, &deviceID, &binarySize, buffers, loadErrors, &error ); program_from_binary = clCreateProgramWithBinary(
context, 1, &device, &binarySize, buffers, loadErrors, &error);
test_error( error, "Unable to load valid program binary" ); test_error( error, "Unable to load valid program binary" );
test_error( loadErrors[ 0 ], "Unable to load valid device binary into program" ); test_error( loadErrors[ 0 ], "Unable to load valid device binary into program" );
error = clBuildProgram( program_from_binary, 1, &deviceID, NULL, NULL, NULL ); error = clBuildProgram(program_from_binary, 1, &device, NULL, NULL, NULL);
test_error(error, "Unable to build binary program"); test_error(error, "Unable to build binary program");
// Get the size of the binary built from the first binary // Get the size of the binary built from the first binary
@@ -123,10 +124,11 @@ int test_binary_create(cl_device_id deviceID, cl_context context, cl_command_que
// Try again, this time without passing the status ptr in, to make sure we still // Try again, this time without passing the status ptr in, to make sure we still
// get a valid binary // get a valid binary
clProgramWrapper programWithoutStatus = clCreateProgramWithBinary( context, 1, &deviceID, &binary2Size, buffers, NULL, &error ); clProgramWrapper programWithoutStatus = clCreateProgramWithBinary(
context, 1, &device, &binary2Size, buffers, NULL, &error);
test_error( error, "Unable to load valid program binary when binary_status pointer is NULL" ); test_error( error, "Unable to load valid program binary when binary_status pointer is NULL" );
error = clBuildProgram( programWithoutStatus, 1, &deviceID, NULL, NULL, NULL ); error = clBuildProgram(programWithoutStatus, 1, &device, NULL, NULL, NULL);
test_error( error, "Unable to build binary program created without binary_status" ); test_error( error, "Unable to build binary program created without binary_status" );
// Get the size of the binary created without passing binary_status // Get the size of the binary created without passing binary_status
@@ -214,5 +216,3 @@ int test_binary_create(cl_device_id deviceID, cl_context context, cl_command_que
free(out_data_binary); free(out_data_binary);
return 0; return 0;
} }

View File

@@ -35,7 +35,7 @@ const char *kernel_with_bool[] = {
"}\n" "}\n"
}; };
int test_bool_type(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(bool_type)
{ {
clProgramWrapper program; clProgramWrapper program;
@@ -48,4 +48,3 @@ int test_bool_type(cl_device_id deviceID, cl_context context, cl_command_queue q
"kernel_with_bool" ); "kernel_with_bool" );
return err; return err;
} }

View File

@@ -92,7 +92,9 @@ struct structArg
float f; float f;
}; };
int test_image_arg_shallow_clone(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements, void* pbufRes, clMemWrapper& bufOut) int test_image_arg_shallow_clone(cl_device_id device, cl_context context,
cl_command_queue queue, int num_elements,
void* pbufRes, clMemWrapper& bufOut)
{ {
int error; int error;
cl_image_format img_format; cl_image_format img_format;
@@ -191,7 +193,9 @@ int test_image_arg_shallow_clone(cl_device_id deviceID, cl_context context, cl_c
return 0; return 0;
} }
int test_double_arg_clone(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements, void* pbufRes, clMemWrapper& bufOut) int test_double_arg_clone(cl_device_id device, cl_context context,
cl_command_queue queue, int num_elements,
void* pbufRes, clMemWrapper& bufOut)
{ {
int error = 0; int error = 0;
clProgramWrapper program; clProgramWrapper program;
@@ -228,7 +232,7 @@ int test_double_arg_clone(cl_device_id deviceID, cl_context context, cl_command_
return 0; return 0;
} }
int test_clone_kernel(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST_VERSION(clone_kernel, Version(2, 1))
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -250,11 +254,12 @@ int test_clone_kernel(cl_device_id deviceID, cl_context context, cl_command_queu
cl_bool bimg = CL_FALSE; cl_bool bimg = CL_FALSE;
cl_bool bdouble = CL_FALSE; cl_bool bdouble = CL_FALSE;
// test image support // test image support
error = clGetDeviceInfo(deviceID, CL_DEVICE_IMAGE_SUPPORT, sizeof(cl_bool), &bimg, NULL); error = clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT, sizeof(cl_bool),
&bimg, NULL);
test_error( error, "clGetDeviceInfo failed." ); test_error( error, "clGetDeviceInfo failed." );
// test double support // test double support
if (is_extension_available(deviceID, "cl_khr_fp64")) if (is_extension_available(device, "cl_khr_fp64"))
{ {
bdouble = CL_TRUE; bdouble = CL_TRUE;
} }
@@ -377,13 +382,15 @@ int test_clone_kernel(cl_device_id deviceID, cl_context context, cl_command_queu
if (bimg) if (bimg)
{ {
error = test_image_arg_shallow_clone(deviceID, context, queue, num_elements, pbufRes, bufOut); error = test_image_arg_shallow_clone(device, context, queue,
num_elements, pbufRes, bufOut);
test_error( error, "image arg shallow clone test failed." ); test_error( error, "image arg shallow clone test failed." );
} }
if (bdouble) if (bdouble)
{ {
error = test_double_arg_clone(deviceID, context, queue, num_elements, pbufRes, bufOut); error = test_double_arg_clone(device, context, queue, num_elements,
pbufRes, bufOut);
test_error( error, "double arg clone test failed." ); test_error( error, "double arg clone test failed." );
} }
@@ -392,4 +399,3 @@ int test_clone_kernel(cl_device_id deviceID, cl_context context, cl_command_queu
return 0; return 0;
} }

View File

@@ -26,12 +26,11 @@ void CL_CALLBACK context_destructor_callback(cl_context context, void *userData)
*userPtr = ++sDestructorIndex; *userPtr = ++sDestructorIndex;
} }
int test_context_destructor_callback(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(context_destructor_callback, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
cl_int error; cl_int error;
clContextWrapper localContext = clContextWrapper localContext =
clCreateContext(NULL, 1, &deviceID, NULL, NULL, &error); clCreateContext(NULL, 1, &device, NULL, NULL, &error);
test_error(error, "Unable to create local context"); test_error(error, "Unable to create local context");
// Set up some variables to catch the order in which callbacks are called // Set up some variables to catch the order in which callbacks are called

View File

@@ -23,7 +23,7 @@
#include "harness/conversions.h" #include "harness/conversions.h"
#include <bitset> #include <bitset>
int test_create_context_from_type(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(create_context_from_type)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -47,11 +47,12 @@ int test_create_context_from_type(cl_device_id deviceID, cl_context context, cl_
"}\n" }; "}\n" };
cl_device_type type; cl_device_type type;
error = clGetDeviceInfo(deviceID, CL_DEVICE_TYPE, sizeof(type), &type, NULL); error = clGetDeviceInfo(device, CL_DEVICE_TYPE, sizeof(type), &type, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_TYPE failed\n"); test_error(error, "clGetDeviceInfo for CL_DEVICE_TYPE failed\n");
cl_platform_id platform; cl_platform_id platform;
error = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM, sizeof(platform), &platform, NULL); error = clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(platform),
&platform, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed\n"); test_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed\n");
cl_context_properties properties[3] = { cl_context_properties properties[3] = {
@@ -67,7 +68,7 @@ int test_create_context_from_type(cl_device_id deviceID, cl_context context, cl_
return -1; return -1;
} }
queue_to_test = clCreateCommandQueue(context_to_test, deviceID, 0, &error); queue_to_test = clCreateCommandQueue(context_to_test, device, 0, &error);
test_error(error, "clCreateCommandQueue failed"); test_error(error, "clCreateCommandQueue failed");
if (queue_to_test == NULL) { if (queue_to_test == NULL) {
log_error("clCreateCommandQueue returned NULL, but error was CL_SUCCESS."); log_error("clCreateCommandQueue returned NULL, but error was CL_SUCCESS.");
@@ -128,14 +129,11 @@ int test_create_context_from_type(cl_device_id deviceID, cl_context context, cl_
return 0; return 0;
} }
int test_create_context_from_type_device_type_all(cl_device_id deviceID, REGISTER_TEST(create_context_from_type_device_type_all)
cl_context context,
cl_command_queue queue,
int num_elements)
{ {
cl_device_type type; cl_device_type type;
cl_int error = cl_int error =
clGetDeviceInfo(deviceID, CL_DEVICE_TYPE, sizeof(type), &type, NULL); clGetDeviceInfo(device, CL_DEVICE_TYPE, sizeof(type), &type, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_TYPE failed\n"); test_error(error, "clGetDeviceInfo for CL_DEVICE_TYPE failed\n");
std::bitset<sizeof(cl_device_type)> type_bits(type); std::bitset<sizeof(cl_device_type)> type_bits(type);
@@ -148,7 +146,7 @@ int test_create_context_from_type_device_type_all(cl_device_id deviceID,
return -1; return -1;
} }
cl_platform_id platform; cl_platform_id platform;
error = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM, sizeof(platform), error = clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(platform),
&platform, NULL); &platform, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed\n"); test_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed\n");
@@ -172,14 +170,11 @@ int test_create_context_from_type_device_type_all(cl_device_id deviceID,
return 0; return 0;
} }
int test_create_context_from_type_device_type_default(cl_device_id deviceID, REGISTER_TEST(create_context_from_type_device_type_default)
cl_context context,
cl_command_queue queue,
int num_elements)
{ {
cl_device_type type; cl_device_type type;
cl_int error = cl_int error =
clGetDeviceInfo(deviceID, CL_DEVICE_TYPE, sizeof(type), &type, NULL); clGetDeviceInfo(device, CL_DEVICE_TYPE, sizeof(type), &type, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_TYPE failed\n"); test_error(error, "clGetDeviceInfo for CL_DEVICE_TYPE failed\n");
std::bitset<sizeof(cl_device_type)> type_bits(type); std::bitset<sizeof(cl_device_type)> type_bits(type);
@@ -192,7 +187,7 @@ int test_create_context_from_type_device_type_default(cl_device_id deviceID,
return -1; return -1;
} }
cl_platform_id platform; cl_platform_id platform;
error = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM, sizeof(platform), error = clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(platform),
&platform, NULL); &platform, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed\n"); test_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed\n");

View File

@@ -72,8 +72,7 @@ const char *repeate_test_kernel =
"}\n"; "}\n";
REGISTER_TEST(load_single_kernel)
int test_load_single_kernel(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -159,7 +158,7 @@ int test_load_single_kernel(cl_device_id deviceID, cl_context context, cl_comman
return 0; return 0;
} }
int test_load_two_kernels(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(load_two_kernels)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -239,7 +238,7 @@ int test_load_two_kernels(cl_device_id deviceID, cl_context context, cl_command_
return 0; return 0;
} }
int test_load_two_kernels_in_one(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(load_two_kernels_in_one)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -320,7 +319,7 @@ int test_load_two_kernels_in_one(cl_device_id deviceID, cl_context context, cl_c
return 0; return 0;
} }
int test_load_two_kernels_manually( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(load_two_kernels_manually)
{ {
clProgramWrapper program; clProgramWrapper program;
clKernelWrapper kernel1, kernel2; clKernelWrapper kernel1, kernel2;
@@ -351,7 +350,7 @@ int test_load_two_kernels_manually( cl_device_id deviceID, cl_context context, c
return 0; return 0;
} }
int test_get_program_info_kernel_names( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(get_program_info_kernel_names)
{ {
clProgramWrapper program; clProgramWrapper program;
clKernelWrapper kernel1, kernel2; clKernelWrapper kernel1, kernel2;
@@ -442,7 +441,7 @@ static const char *single_task_kernel[] = {
"\n" "\n"
"}\n" }; "}\n" };
int test_enqueue_task(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(enqueue_task)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -491,9 +490,8 @@ int test_enqueue_task(cl_device_id deviceID, cl_context context, cl_command_queu
} }
#define TEST_SIZE 1000 #define TEST_SIZE 1000
int test_repeated_setup_cleanup(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(repeated_setup_cleanup)
{ {
cl_context local_context; cl_context local_context;
@@ -519,10 +517,11 @@ int test_repeated_setup_cleanup(cl_device_id deviceID, cl_context context, cl_co
for (i=0; i<100; i++) { for (i=0; i<100; i++) {
memset(outData, 0, sizeof(cl_int)*TEST_SIZE); memset(outData, 0, sizeof(cl_int)*TEST_SIZE);
local_context = clCreateContext(NULL, 1, &deviceID, notify_callback, NULL, &error); local_context =
clCreateContext(NULL, 1, &device, notify_callback, NULL, &error);
test_error( error, "clCreateContext failed"); test_error( error, "clCreateContext failed");
local_queue = clCreateCommandQueue(local_context, deviceID, 0, &error); local_queue = clCreateCommandQueue(local_context, device, 0, &error);
test_error( error, "clCreateCommandQueue failed"); test_error( error, "clCreateCommandQueue failed");
error = create_single_kernel_helper( error = create_single_kernel_helper(
@@ -590,6 +589,3 @@ int test_repeated_setup_cleanup(cl_device_id deviceID, cl_context context, cl_co
return 0; return 0;
} }

View File

@@ -39,10 +39,7 @@ int test_command_queue_helper(cl_context context, cl_device_id deviceID,
return TEST_PASS; return TEST_PASS;
} }
int test_set_default_device_command_queue(cl_device_id deviceID, REGISTER_TEST_VERSION(set_default_device_command_queue, Version(2, 1))
cl_context context,
cl_command_queue queue,
int num_elements)
{ {
cl_int error; cl_int error;
constexpr cl_command_queue_properties PROPERTIES = CL_QUEUE_ON_DEVICE constexpr cl_command_queue_properties PROPERTIES = CL_QUEUE_ON_DEVICE
@@ -51,10 +48,10 @@ int test_set_default_device_command_queue(cl_device_id deviceID,
CL_QUEUE_PROPERTIES, (PROPERTIES | CL_QUEUE_ON_DEVICE_DEFAULT), 0 CL_QUEUE_PROPERTIES, (PROPERTIES | CL_QUEUE_ON_DEVICE_DEFAULT), 0
}; };
if (get_device_cl_version(deviceID) >= Version(3, 0)) if (get_device_cl_version(device) >= Version(3, 0))
{ {
cl_device_device_enqueue_capabilities dseCaps = 0; cl_device_device_enqueue_capabilities dseCaps = 0;
error = clGetDeviceInfo(deviceID, CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES, error = clGetDeviceInfo(device, CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES,
sizeof(dseCaps), &dseCaps, NULL); sizeof(dseCaps), &dseCaps, NULL);
test_error(error, test_error(error,
"Unable to query CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES"); "Unable to query CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES");
@@ -64,22 +61,22 @@ int test_set_default_device_command_queue(cl_device_id deviceID,
} }
clCommandQueueWrapper cmd_queue_1 = clCreateCommandQueueWithProperties( clCommandQueueWrapper cmd_queue_1 = clCreateCommandQueueWithProperties(
context, deviceID, properties.data(), &error); context, device, properties.data(), &error);
test_error(error, "clCreateCommandQueueWithProperties failed"); test_error(error, "clCreateCommandQueueWithProperties failed");
properties[1] = PROPERTIES; properties[1] = PROPERTIES;
clCommandQueueWrapper cmd_queue_2 = clCreateCommandQueueWithProperties( clCommandQueueWrapper cmd_queue_2 = clCreateCommandQueueWithProperties(
context, deviceID, properties.data(), &error); context, device, properties.data(), &error);
test_error(error, "clCreateCommandQueueWithProperties failed"); test_error(error, "clCreateCommandQueueWithProperties failed");
// cmd_queue_1 // cmd_queue_1
if (test_command_queue_helper(context, deviceID, cmd_queue_1) != 0) if (test_command_queue_helper(context, device, cmd_queue_1) != 0)
{ {
test_fail("test_command_queue_helper failed for cmd_queue_1.\n"); test_fail("test_command_queue_helper failed for cmd_queue_1.\n");
} }
// cmd_queue_2 - without CL_QUEUE_ON_DEVICE_DEFAULT // cmd_queue_2 - without CL_QUEUE_ON_DEVICE_DEFAULT
if (test_command_queue_helper(context, deviceID, cmd_queue_2) != 0) if (test_command_queue_helper(context, device, cmd_queue_2) != 0)
{ {
test_fail("test_command_queue_helper failed for cmd_queue_2.\n"); test_fail("test_command_queue_helper failed for cmd_queue_2.\n");
} }

View File

@@ -25,7 +25,7 @@ int IsAPowerOfTwo( unsigned long x )
} }
int test_min_data_type_align_size_alignment(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems ) REGISTER_TEST(min_data_type_align_size_alignment)
{ {
cl_uint min_alignment; cl_uint min_alignment;
@@ -37,24 +37,29 @@ int test_min_data_type_align_size_alignment(cl_device_id device, cl_context cont
int error = 0; int error = 0;
cl_uint alignment; cl_uint alignment;
error = clGetDeviceInfo(device, CL_DEVICE_MEM_BASE_ADDR_ALIGN, sizeof(alignment), &alignment, NULL); error = clGetDeviceInfo(device, CL_DEVICE_MEM_BASE_ADDR_ALIGN,
test_error(error, "clGetDeviceInfo for CL_DEVICE_MEM_BASE_ADDR_ALIGN failed"); sizeof(alignment), &alignment, NULL);
log_info("Device reported CL_DEVICE_MEM_BASE_ADDR_ALIGN = %lu bits.\n", (unsigned long)alignment); test_error(error,
"clGetDeviceInfo for CL_DEVICE_MEM_BASE_ADDR_ALIGN failed");
log_info("Device reported CL_DEVICE_MEM_BASE_ADDR_ALIGN = %lu bits.\n",
(unsigned long)alignment);
// Verify the size is large enough // Verify the size is large enough
if (alignment < min_alignment*8) { if (alignment < min_alignment * 8)
log_error("ERROR: alignment too small. Minimum alignment for %s16 is %lu bits, device reported %lu bits.", {
log_error("ERROR: alignment too small. Minimum alignment for %s16 is "
"%lu bits, device reported %lu bits.",
(gHasLong) ? "long" : "int", (gHasLong) ? "long" : "int",
(unsigned long)(min_alignment * 8), (unsigned long)alignment); (unsigned long)(min_alignment * 8), (unsigned long)alignment);
return -1; return -1;
} }
// Verify the size is a power of two // Verify the size is a power of two
if (!IsAPowerOfTwo((unsigned long)alignment)) { if (!IsAPowerOfTwo((unsigned long)alignment))
{
log_error("ERROR: alignment is not a power of two.\n"); log_error("ERROR: alignment is not a power of two.\n");
return -1; return -1;
} }
return 0; return 0;
} }

View File

@@ -32,7 +32,7 @@ const char *inspect_image_kernel_source[] = {
#define NUM_TRIES 100 #define NUM_TRIES 100
#define NUM_THREADS 2048 #define NUM_THREADS 2048
int test_kernel_arg_changes(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(kernel_arg_changes)
{ {
clProgramWrapper program; clProgramWrapper program;
clKernelWrapper kernel; clKernelWrapper kernel;
@@ -137,5 +137,3 @@ int test_kernel_arg_changes(cl_device_id device, cl_context context, cl_command_
// If we got here, everything verified successfully // If we got here, everything verified successfully
return 0; return 0;
} }

View File

@@ -300,16 +300,16 @@ static int compare_expected_actual(const KernelArgInfo& expected,
return ret; return ret;
} }
static bool device_supports_pipes(cl_device_id deviceID) static bool device_supports_pipes(cl_device_id device)
{ {
auto version = get_device_cl_version(deviceID); auto version = get_device_cl_version(device);
if (version < MINIMUM_OPENCL_PIPE_VERSION) if (version < MINIMUM_OPENCL_PIPE_VERSION)
{ {
return false; return false;
} }
cl_uint max_packet_size = 0; cl_uint max_packet_size = 0;
cl_int err = cl_int err =
clGetDeviceInfo(deviceID, CL_DEVICE_PIPE_MAX_PACKET_SIZE, clGetDeviceInfo(device, CL_DEVICE_PIPE_MAX_PACKET_SIZE,
sizeof(max_packet_size), &max_packet_size, nullptr); sizeof(max_packet_size), &max_packet_size, nullptr);
test_error_ret(err, "clGetDeviceInfo", false); test_error_ret(err, "clGetDeviceInfo", false);
if ((max_packet_size == 0) && (version >= Version(3, 0))) if ((max_packet_size == 0) && (version >= Version(3, 0)))
@@ -319,14 +319,14 @@ static bool device_supports_pipes(cl_device_id deviceID)
return true; return true;
} }
static std::string get_build_options(cl_device_id deviceID) static std::string get_build_options(cl_device_id device)
{ {
std::string ret = "-cl-kernel-arg-info"; std::string ret = "-cl-kernel-arg-info";
if (get_device_cl_version(deviceID) >= MINIMUM_OPENCL_PIPE_VERSION) if (get_device_cl_version(device) >= MINIMUM_OPENCL_PIPE_VERSION)
{ {
if (device_supports_pipes(deviceID)) if (device_supports_pipes(device))
{ {
if (get_device_cl_version(deviceID) >= Version(3, 0)) if (get_device_cl_version(device) >= Version(3, 0))
{ {
ret += " -cl-std=CL3.0"; ret += " -cl-std=CL3.0";
} }
@@ -435,8 +435,7 @@ create_expected_arg_info(const KernelArgInfo& kernel_argument, bool is_pointer)
/* There are too many vector arguments for it to be worth writing down /* There are too many vector arguments for it to be worth writing down
* statically and are instead generated here and combined with all of the scalar * statically and are instead generated here and combined with all of the scalar
* and unsigned scalar types in a single data structure */ * and unsigned scalar types in a single data structure */
static std::vector<std::string> static std::vector<std::string> generate_all_type_arguments(cl_device_id device)
generate_all_type_arguments(cl_device_id deviceID)
{ {
std::vector<std::string> ret = { std::vector<std::string> ret = {
"char", "short", "int", "float", "char", "short", "int", "float",
@@ -460,11 +459,11 @@ generate_all_type_arguments(cl_device_id deviceID)
vector_types.push_back("long"); vector_types.push_back("long");
vector_types.push_back("ulong"); vector_types.push_back("ulong");
} }
if (device_supports_half(deviceID)) if (device_supports_half(device))
{ {
vector_types.push_back("half"); vector_types.push_back("half");
} }
if (device_supports_double(deviceID)) if (device_supports_double(device))
{ {
vector_types.push_back("double"); vector_types.push_back("double");
} }
@@ -481,7 +480,7 @@ generate_all_type_arguments(cl_device_id deviceID)
} }
static int static int
compare_kernel_with_expected(cl_context context, cl_device_id deviceID, compare_kernel_with_expected(cl_context context, cl_device_id device,
const char* kernel_src, const char* kernel_src,
const std::vector<KernelArgInfo>& expected_args) const std::vector<KernelArgInfo>& expected_args)
{ {
@@ -490,7 +489,7 @@ compare_kernel_with_expected(cl_context context, cl_device_id deviceID,
clProgramWrapper program; clProgramWrapper program;
cl_int err = create_single_kernel_helper_with_build_options( cl_int err = create_single_kernel_helper_with_build_options(
context, &program, &kernel, 1, &kernel_src, "get_kernel_arg_info", context, &program, &kernel, 1, &kernel_src, "get_kernel_arg_info",
get_build_options(deviceID).c_str()); get_build_options(device).c_str());
test_error(err, "create_single_kernel_helper_with_build_options"); test_error(err, "create_single_kernel_helper_with_build_options");
for (size_t i = 0; i < expected_args.size(); ++i) for (size_t i = 0; i < expected_args.size(); ++i)
{ {
@@ -525,7 +524,7 @@ compare_kernel_with_expected(cl_context context, cl_device_id deviceID,
return failed_tests; return failed_tests;
} }
size_t get_param_size(const std::string& arg_type, cl_device_id deviceID, size_t get_param_size(const std::string& arg_type, cl_device_id device,
bool is_pipe) bool is_pipe)
{ {
if (is_pipe) if (is_pipe)
@@ -535,7 +534,7 @@ size_t get_param_size(const std::string& arg_type, cl_device_id deviceID,
if (arg_type.find("*") != std::string::npos) if (arg_type.find("*") != std::string::npos)
{ {
cl_uint device_address_bits = 0; cl_uint device_address_bits = 0;
cl_int err = clGetDeviceInfo(deviceID, CL_DEVICE_ADDRESS_BITS, cl_int err = clGetDeviceInfo(device, CL_DEVICE_ADDRESS_BITS,
sizeof(device_address_bits), sizeof(device_address_bits),
&device_address_bits, NULL); &device_address_bits, NULL);
test_error_ret(err, "clGetDeviceInfo", 0); test_error_ret(err, "clGetDeviceInfo", 0);
@@ -595,12 +594,12 @@ size_t get_param_size(const std::string& arg_type, cl_device_id deviceID,
return ret; return ret;
} }
static int run_scalar_vector_tests(cl_context context, cl_device_id deviceID) static int run_scalar_vector_tests(cl_context context, cl_device_id device)
{ {
int failed_tests = 0; int failed_tests = 0;
std::vector<std::string> type_arguments = std::vector<std::string> type_arguments =
generate_all_type_arguments(deviceID); generate_all_type_arguments(device);
const std::vector<cl_kernel_arg_access_qualifier> access_qualifiers = { const std::vector<cl_kernel_arg_access_qualifier> access_qualifiers = {
CL_KERNEL_ARG_ACCESS_NONE, CL_KERNEL_ARG_ACCESS_READ_ONLY, CL_KERNEL_ARG_ACCESS_NONE, CL_KERNEL_ARG_ACCESS_READ_ONLY,
@@ -608,7 +607,7 @@ static int run_scalar_vector_tests(cl_context context, cl_device_id deviceID)
}; };
std::vector<KernelArgInfo> all_args, expected_args; std::vector<KernelArgInfo> all_args, expected_args;
size_t max_param_size = get_max_param_size(deviceID); size_t max_param_size = get_max_param_size(device);
size_t total_param_size(0); size_t total_param_size(0);
for (auto address_qualifier : address_qualifiers) for (auto address_qualifier : address_qualifiers)
{ {
@@ -671,15 +670,14 @@ static int run_scalar_vector_tests(cl_context context, cl_device_id deviceID)
arg_type += "*"; arg_type += "*";
} }
size_t param_size = size_t param_size =
get_param_size(arg_type, deviceID, is_pipe); get_param_size(arg_type, device, is_pipe);
if (param_size + total_param_size >= max_param_size if (param_size + total_param_size >= max_param_size
|| all_args.size() == MAX_NUMBER_OF_KERNEL_ARGS) || all_args.size() == MAX_NUMBER_OF_KERNEL_ARGS)
{ {
const std::string kernel_src = generate_kernel( const std::string kernel_src = generate_kernel(
all_args, false, device_supports_half(deviceID)); all_args, false, device_supports_half(device));
failed_tests += compare_kernel_with_expected( failed_tests += compare_kernel_with_expected(
context, deviceID, kernel_src.c_str(), context, device, kernel_src.c_str(), expected_args);
expected_args);
all_args.clear(); all_args.clear();
expected_args.clear(); expected_args.clear();
total_param_size = 0; total_param_size = 0;
@@ -699,36 +697,36 @@ static int run_scalar_vector_tests(cl_context context, cl_device_id deviceID)
} }
} }
const std::string kernel_src = const std::string kernel_src =
generate_kernel(all_args, false, device_supports_half(deviceID)); generate_kernel(all_args, false, device_supports_half(device));
failed_tests += compare_kernel_with_expected( failed_tests += compare_kernel_with_expected(
context, deviceID, kernel_src.c_str(), expected_args); context, device, kernel_src.c_str(), expected_args);
return failed_tests; return failed_tests;
} }
static cl_uint get_max_number_of_pipes(cl_device_id deviceID, cl_int& err) static cl_uint get_max_number_of_pipes(cl_device_id device, cl_int& err)
{ {
cl_uint ret(0); cl_uint ret(0);
err = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_PIPE_ARGS, sizeof(ret), &ret, err = clGetDeviceInfo(device, CL_DEVICE_MAX_PIPE_ARGS, sizeof(ret), &ret,
nullptr); nullptr);
return ret; return ret;
} }
static int run_pipe_tests(cl_context context, cl_device_id deviceID) static int run_pipe_tests(cl_context context, cl_device_id device)
{ {
int failed_tests = 0; int failed_tests = 0;
cl_kernel_arg_address_qualifier address_qualifier = cl_kernel_arg_address_qualifier address_qualifier =
CL_KERNEL_ARG_ADDRESS_PRIVATE; CL_KERNEL_ARG_ADDRESS_PRIVATE;
std::vector<std::string> type_arguments = std::vector<std::string> type_arguments =
generate_all_type_arguments(deviceID); generate_all_type_arguments(device);
const std::vector<cl_kernel_arg_access_qualifier> access_qualifiers = { const std::vector<cl_kernel_arg_access_qualifier> access_qualifiers = {
CL_KERNEL_ARG_ACCESS_READ_ONLY, CL_KERNEL_ARG_ACCESS_WRITE_ONLY CL_KERNEL_ARG_ACCESS_READ_ONLY, CL_KERNEL_ARG_ACCESS_WRITE_ONLY
}; };
std::vector<KernelArgInfo> all_args, expected_args; std::vector<KernelArgInfo> all_args, expected_args;
size_t max_param_size = get_max_param_size(deviceID); size_t max_param_size = get_max_param_size(device);
size_t total_param_size(0); size_t total_param_size(0);
cl_int err = CL_SUCCESS; cl_int err = CL_SUCCESS;
cl_uint max_number_of_pipes = get_max_number_of_pipes(deviceID, err); cl_uint max_number_of_pipes = get_max_number_of_pipes(device, err);
test_error_ret(err, "get_max_number_of_pipes", TEST_FAIL); test_error_ret(err, "get_max_number_of_pipes", TEST_FAIL);
cl_uint number_of_pipes(0); cl_uint number_of_pipes(0);
@@ -747,13 +745,13 @@ static int run_pipe_tests(cl_context context, cl_device_id deviceID)
continue; continue;
} }
size_t param_size = get_param_size(arg_type, deviceID, is_pipe); size_t param_size = get_param_size(arg_type, device, is_pipe);
if (param_size + total_param_size >= max_param_size if (param_size + total_param_size >= max_param_size
|| number_of_pipes == max_number_of_pipes) || number_of_pipes == max_number_of_pipes)
{ {
const std::string kernel_src = generate_kernel(all_args); const std::string kernel_src = generate_kernel(all_args);
failed_tests += compare_kernel_with_expected( failed_tests += compare_kernel_with_expected(
context, deviceID, kernel_src.c_str(), expected_args); context, device, kernel_src.c_str(), expected_args);
all_args.clear(); all_args.clear();
expected_args.clear(); expected_args.clear();
total_param_size = 0; total_param_size = 0;
@@ -775,11 +773,11 @@ static int run_pipe_tests(cl_context context, cl_device_id deviceID)
} }
const std::string kernel_src = generate_kernel(all_args); const std::string kernel_src = generate_kernel(all_args);
failed_tests += compare_kernel_with_expected( failed_tests += compare_kernel_with_expected(
context, deviceID, kernel_src.c_str(), expected_args); context, device, kernel_src.c_str(), expected_args);
return failed_tests; return failed_tests;
} }
static int run_sampler_test(cl_context context, cl_device_id deviceID) static int run_sampler_test(cl_context context, cl_device_id device)
{ {
cl_kernel_arg_address_qualifier address_qualifier = cl_kernel_arg_address_qualifier address_qualifier =
CL_KERNEL_ARG_ADDRESS_PRIVATE; CL_KERNEL_ARG_ADDRESS_PRIVATE;
@@ -797,27 +795,27 @@ static int run_sampler_test(cl_context context, cl_device_id deviceID)
const std::string kernel_src = generate_kernel({ kernel_argument }); const std::string kernel_src = generate_kernel({ kernel_argument });
return compare_kernel_with_expected(context, deviceID, kernel_src.c_str(), return compare_kernel_with_expected(context, device, kernel_src.c_str(),
{ expected }); { expected });
} }
static int run_image_tests(cl_context context, cl_device_id deviceID) static int run_image_tests(cl_context context, cl_device_id device)
{ {
int failed_tests = 0; int failed_tests = 0;
bool supports_3d_image_writes = bool supports_3d_image_writes =
is_extension_available(deviceID, "cl_khr_3d_image_writes"); is_extension_available(device, "cl_khr_3d_image_writes");
bool is_pointer = false; bool is_pointer = false;
cl_kernel_arg_type_qualifier type_qualifier = CL_KERNEL_ARG_TYPE_NONE; cl_kernel_arg_type_qualifier type_qualifier = CL_KERNEL_ARG_TYPE_NONE;
cl_kernel_arg_address_qualifier address_qualifier = cl_kernel_arg_address_qualifier address_qualifier =
CL_KERNEL_ARG_ADDRESS_GLOBAL; CL_KERNEL_ARG_ADDRESS_GLOBAL;
Version version = get_device_cl_version(deviceID); Version version = get_device_cl_version(device);
bool supports_read_write_images = false; bool supports_read_write_images = false;
if (version >= Version(3, 0)) if (version >= Version(3, 0))
{ {
cl_uint maxReadWriteImageArgs = 0; cl_uint maxReadWriteImageArgs = 0;
cl_int error = clGetDeviceInfo( cl_int error = clGetDeviceInfo(
deviceID, CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS, device, CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS,
sizeof(maxReadWriteImageArgs), &maxReadWriteImageArgs, NULL); sizeof(maxReadWriteImageArgs), &maxReadWriteImageArgs, NULL);
test_error(error, test_error(error,
"Unable to query " "Unable to query "
@@ -862,23 +860,23 @@ static int run_image_tests(cl_context context, cl_device_id deviceID)
generate_kernel({ kernel_argument }, supports_3d_image_writes); generate_kernel({ kernel_argument }, supports_3d_image_writes);
failed_tests += compare_kernel_with_expected( failed_tests += compare_kernel_with_expected(
context, deviceID, kernel_src.c_str(), { expected }); context, device, kernel_src.c_str(), { expected });
} }
} }
failed_tests += run_sampler_test(context, deviceID); failed_tests += run_sampler_test(context, device);
return failed_tests; return failed_tests;
} }
/* Ensure clGetKernelArgInfo returns successfully when param_value is /* Ensure clGetKernelArgInfo returns successfully when param_value is
* set to null */ * set to null */
static int test_null_param(cl_context context, cl_device_id deviceID, static int test_null_param(cl_context context, cl_device_id device,
char const* kernel_src) char const* kernel_src)
{ {
clProgramWrapper program; clProgramWrapper program;
clKernelWrapper kernel; clKernelWrapper kernel;
cl_int err = create_single_kernel_helper_with_build_options( cl_int err = create_single_kernel_helper_with_build_options(
context, &program, &kernel, 1, &kernel_src, "get_kernel_arg_info", context, &program, &kernel, 1, &kernel_src, "get_kernel_arg_info",
get_build_options(deviceID).c_str()); get_build_options(device).c_str());
test_error_ret(err, "create_single_kernel_helper_with_build_options", test_error_ret(err, "create_single_kernel_helper_with_build_options",
TEST_FAIL); TEST_FAIL);
@@ -909,7 +907,7 @@ static int test_null_param(cl_context context, cl_device_id deviceID,
/* Ensure clGetKernelArgInfo returns the correct size in bytes for the /* Ensure clGetKernelArgInfo returns the correct size in bytes for the
* kernel arg name */ * kernel arg name */
static int test_arg_name_size(cl_context context, cl_device_id deviceID, static int test_arg_name_size(cl_context context, cl_device_id device,
char const* kernel_src) char const* kernel_src)
{ {
size_t size; size_t size;
@@ -920,7 +918,7 @@ static int test_arg_name_size(cl_context context, cl_device_id deviceID,
clKernelWrapper kernel; clKernelWrapper kernel;
cl_int err = create_single_kernel_helper_with_build_options( cl_int err = create_single_kernel_helper_with_build_options(
context, &program, &kernel, 1, &kernel_src, "get_kernel_arg_info", context, &program, &kernel, 1, &kernel_src, "get_kernel_arg_info",
get_build_options(deviceID).c_str()); get_build_options(device).c_str());
test_error_ret(err, "create_single_kernel_helper_with_build_options", test_error_ret(err, "create_single_kernel_helper_with_build_options",
TEST_FAIL); TEST_FAIL);
@@ -939,7 +937,7 @@ static int test_arg_name_size(cl_context context, cl_device_id deviceID,
} }
} }
static int run_boundary_tests(cl_context context, cl_device_id deviceID) static int run_boundary_tests(cl_context context, cl_device_id device)
{ {
int failed_tests = 0; int failed_tests = 0;
@@ -952,9 +950,9 @@ static int run_boundary_tests(cl_context context, cl_device_id deviceID)
arg_type, SINGLE_KERNEL_ARG_NUMBER); arg_type, SINGLE_KERNEL_ARG_NUMBER);
const std::string kernel_src = generate_kernel({ arg_info }); const std::string kernel_src = generate_kernel({ arg_info });
failed_tests += test_arg_name_size(context, deviceID, kernel_src.c_str()); failed_tests += test_arg_name_size(context, device, kernel_src.c_str());
if (test_null_param(context, deviceID, kernel_src.c_str()) != TEST_PASS) if (test_null_param(context, device, kernel_src.c_str()) != TEST_PASS)
{ {
failed_tests++; failed_tests++;
} }
@@ -962,10 +960,10 @@ static int run_boundary_tests(cl_context context, cl_device_id deviceID)
return failed_tests; return failed_tests;
} }
static int run_all_tests(cl_context context, cl_device_id deviceID) static int run_all_tests(cl_context context, cl_device_id device)
{ {
int failed_scalar_tests = run_scalar_vector_tests(context, deviceID); int failed_scalar_tests = run_scalar_vector_tests(context, device);
if (failed_scalar_tests == 0) if (failed_scalar_tests == 0)
{ {
log_info("All Data Type Tests Passed\n"); log_info("All Data Type Tests Passed\n");
@@ -976,9 +974,9 @@ static int run_all_tests(cl_context context, cl_device_id deviceID)
} }
int failed_image_tests = 0; int failed_image_tests = 0;
if (checkForImageSupport(deviceID) == 0) if (checkForImageSupport(device) == 0)
{ {
failed_image_tests = run_image_tests(context, deviceID); failed_image_tests = run_image_tests(context, device);
if (failed_image_tests == 0) if (failed_image_tests == 0)
{ {
log_info("All Image Tests Passed\n"); log_info("All Image Tests Passed\n");
@@ -992,7 +990,7 @@ static int run_all_tests(cl_context context, cl_device_id deviceID)
// TODO https://github.com/KhronosGroup/OpenCL-CTS/issues/1244 // TODO https://github.com/KhronosGroup/OpenCL-CTS/issues/1244
if (false) if (false)
{ {
failed_pipe_tests = run_pipe_tests(context, deviceID); failed_pipe_tests = run_pipe_tests(context, device);
if (failed_pipe_tests == 0) if (failed_pipe_tests == 0)
{ {
log_info("All Pipe Tests Passed\n"); log_info("All Pipe Tests Passed\n");
@@ -1003,7 +1001,7 @@ static int run_all_tests(cl_context context, cl_device_id deviceID)
} }
} }
int failed_boundary_tests = run_boundary_tests(context, deviceID); int failed_boundary_tests = run_boundary_tests(context, device);
if (failed_boundary_tests == 0) if (failed_boundary_tests == 0)
{ {
log_info("All Edge Case Tests Passed\n"); log_info("All Edge Case Tests Passed\n");
@@ -1017,10 +1015,9 @@ static int run_all_tests(cl_context context, cl_device_id deviceID)
+ failed_boundary_tests); + failed_boundary_tests);
} }
int test_get_kernel_arg_info(cl_device_id deviceID, cl_context context, REGISTER_TEST(get_kernel_arg_info)
cl_command_queue queue, int num_elements)
{ {
int failed_tests = run_all_tests(context, deviceID); int failed_tests = run_all_tests(context, device);
if (failed_tests != 0) if (failed_tests != 0)
{ {
log_error("%d Test(s) Failed\n", failed_tests); log_error("%d Test(s) Failed\n", failed_tests);

View File

@@ -240,7 +240,7 @@ int test_kernel_arg_multi_setup_exhaustive(cl_device_id device, cl_context conte
return 0; return 0;
} }
int test_kernel_arg_multi_setup_random(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(kernel_arg_multi_setup_random)
{ {
// Loop through a selection of combinations // Loop through a selection of combinations
ExplicitType types[] = { kChar, kShort, kInt, kFloat, kNumExplicitTypes }; ExplicitType types[] = { kChar, kShort, kInt, kFloat, kNumExplicitTypes };
@@ -282,7 +282,3 @@ int test_kernel_arg_multi_setup_random(cl_device_id device, cl_context context,
} }
return 0; return 0;
} }

View File

@@ -17,7 +17,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <algorithm> #include <algorithm>
#include "procs.h"
#include "harness/errorHelpers.h" #include "harness/errorHelpers.h"
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
#include "harness/parseParameters.h" #include "harness/parseParameters.h"
@@ -57,7 +57,7 @@ AttributePermutations reqd_vect_work_tests;
// Generate a vector with vec_type_hint(<data_type>) so that it can be used to // Generate a vector with vec_type_hint(<data_type>) so that it can be used to
// generate different kernels // generate different kernels
static KernelAttributes generate_vec_type_hint_data(cl_device_id deviceID) static KernelAttributes generate_vec_type_hint_data(cl_device_id device)
{ {
KernelAttributes vec_type_hint_data; KernelAttributes vec_type_hint_data;
// TODO Test for signed vectors (char/short/int/etc) // TODO Test for signed vectors (char/short/int/etc)
@@ -67,11 +67,11 @@ static KernelAttributes generate_vec_type_hint_data(cl_device_id deviceID)
{ {
vector_types.push_back("ulong"); vector_types.push_back("ulong");
} }
if (device_supports_half(deviceID)) if (device_supports_half(device))
{ {
vector_types.push_back("half"); vector_types.push_back("half");
} }
if (device_supports_double(deviceID)) if (device_supports_double(device))
{ {
vector_types.push_back("double"); vector_types.push_back("double");
} }
@@ -239,7 +239,7 @@ generate_attribute_tests(const KernelAttributes& vec_type_hint_data,
} }
static const std::vector<AttributePermutations*> static const std::vector<AttributePermutations*>
initialise_attribute_data(cl_device_id deviceID) initialise_attribute_data(cl_device_id device)
{ {
// This vector stores different work group dimensions that can be used by // This vector stores different work group dimensions that can be used by
// the reqd_work_group_size and work_group_size_hint attributes. It // the reqd_work_group_size and work_group_size_hint attributes. It
@@ -248,7 +248,7 @@ initialise_attribute_data(cl_device_id deviceID)
static const std::vector<WorkGroupDimensions> work_group_dimensions = { static const std::vector<WorkGroupDimensions> work_group_dimensions = {
{ 1, 1, 1 } { 1, 1, 1 }
}; };
KernelAttributes vec_type_hint_data = generate_vec_type_hint_data(deviceID); KernelAttributes vec_type_hint_data = generate_vec_type_hint_data(device);
KernelAttributes work_group_size_hint_data = KernelAttributes work_group_size_hint_data =
generate_work_group_size_data(work_group_dimensions); generate_work_group_size_data(work_group_dimensions);
KernelAttributes reqd_work_group_size_data = KernelAttributes reqd_work_group_size_data =
@@ -261,7 +261,7 @@ initialise_attribute_data(cl_device_id deviceID)
reqd_work_group_size_data); reqd_work_group_size_data);
} }
static bool run_test(cl_context context, cl_device_id deviceID, static bool run_test(cl_context context, cl_device_id device,
const AttributePermutations& permutations) const AttributePermutations& permutations)
{ {
bool success = true; bool success = true;
@@ -322,18 +322,17 @@ static bool run_test(cl_context context, cl_device_id deviceID,
return success; return success;
} }
int test_kernel_attributes(cl_device_id deviceID, cl_context context, REGISTER_TEST(kernel_attributes)
cl_command_queue queue, int num_elements)
{ {
bool success = true; bool success = true;
// Vector to store all of the tests // Vector to store all of the tests
const std::vector<AttributePermutations*> all_tests = const std::vector<AttributePermutations*> all_tests =
initialise_attribute_data(deviceID); initialise_attribute_data(device);
for (auto permutations : all_tests) for (auto permutations : all_tests)
{ {
success = success && run_test(context, deviceID, *permutations); success = success && run_test(context, device, *permutations);
} }
return success ? TEST_PASS : TEST_FAIL; return success ? TEST_PASS : TEST_FAIL;
} }

View File

@@ -78,8 +78,7 @@ __kernel void local_param_local_memory_kernel(__local int* local_ptr,
} }
)CLC"; )CLC";
int test_kernel_local_memory_size(cl_device_id deviceID, cl_context context, REGISTER_TEST(kernel_local_memory_size)
cl_command_queue queue, int num_elements)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -97,7 +96,7 @@ int test_kernel_local_memory_size(cl_device_id deviceID, cl_context context,
} }
error = clGetKernelWorkGroupInfo( error = clGetKernelWorkGroupInfo(
kernel, deviceID, CL_KERNEL_LOCAL_MEM_SIZE, sizeof(kernel_local_usage), kernel, device, CL_KERNEL_LOCAL_MEM_SIZE, sizeof(kernel_local_usage),
&kernel_local_usage, &param_value_size_ret); &kernel_local_usage, &param_value_size_ret);
test_error(error, test_error(error,
"clGetKernelWorkGroupInfo for CL_KERNEL_LOCAL_MEM_SIZE failed"); "clGetKernelWorkGroupInfo for CL_KERNEL_LOCAL_MEM_SIZE failed");
@@ -194,7 +193,7 @@ int test_kernel_local_memory_size(cl_device_id deviceID, cl_context context,
test_error(error, "clEnqueueReadBuffer failed"); test_error(error, "clEnqueueReadBuffer failed");
error = clGetKernelWorkGroupInfo( error = clGetKernelWorkGroupInfo(
kernel, deviceID, CL_KERNEL_LOCAL_MEM_SIZE, sizeof(kernel_local_usage), kernel, device, CL_KERNEL_LOCAL_MEM_SIZE, sizeof(kernel_local_usage),
&kernel_local_usage, &param_value_size_ret); &kernel_local_usage, &param_value_size_ret);
test_error(error, test_error(error,
"clGetKernelWorkGroupInfo for CL_KERNEL_LOCAL_MEM_SIZE failed"); "clGetKernelWorkGroupInfo for CL_KERNEL_LOCAL_MEM_SIZE failed");
@@ -268,7 +267,7 @@ int test_kernel_local_memory_size(cl_device_id deviceID, cl_context context,
error = clGetKernelWorkGroupInfo( error = clGetKernelWorkGroupInfo(
kernel, deviceID, CL_KERNEL_LOCAL_MEM_SIZE, sizeof(kernel_local_usage), kernel, device, CL_KERNEL_LOCAL_MEM_SIZE, sizeof(kernel_local_usage),
&kernel_local_usage, &param_value_size_ret); &kernel_local_usage, &param_value_size_ret);
test_error(error, test_error(error,
"clGetKernelWorkGroupInfo for CL_KERNEL_LOCAL_MEM_SIZE failed"); "clGetKernelWorkGroupInfo for CL_KERNEL_LOCAL_MEM_SIZE failed");

View File

@@ -16,10 +16,8 @@
#include "harness/errorHelpers.h" #include "harness/errorHelpers.h"
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
#include <iostream> #include <iostream>
#include "procs.h"
int test_kernel_private_memory_size(cl_device_id deviceID, cl_context context, REGISTER_TEST(kernel_private_memory_size)
cl_command_queue queue, int num_elements)
{ {
const char* TEST_KERNEL = const char* TEST_KERNEL =
R"(__kernel void private_memory( __global uint *buffer ){ R"(__kernel void private_memory( __global uint *buffer ){
@@ -33,7 +31,7 @@ int test_kernel_private_memory_size(cl_device_id deviceID, cl_context context,
&TEST_KERNEL, "private_memory"); &TEST_KERNEL, "private_memory");
test_error(err, "create_single_kernel_helper"); test_error(err, "create_single_kernel_helper");
cl_ulong size = CL_ULONG_MAX; cl_ulong size = CL_ULONG_MAX;
err = clGetKernelWorkGroupInfo(kernel, deviceID, CL_KERNEL_PRIVATE_MEM_SIZE, err = clGetKernelWorkGroupInfo(kernel, device, CL_KERNEL_PRIVATE_MEM_SIZE,
sizeof(cl_ulong), &size, nullptr); sizeof(cl_ulong), &size, nullptr);
test_error(err, "clGetKernelWorkGroupInfo"); test_error(err, "clGetKernelWorkGroupInfo");

View File

@@ -76,9 +76,7 @@ const char *sample_two_kernel_program[] = {
"}\n" }; "}\n" };
REGISTER_TEST(get_kernel_info)
int test_get_kernel_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
{ {
int error; int error;
cl_program program, testProgram; cl_program program, testProgram;
@@ -171,7 +169,7 @@ int test_get_kernel_info(cl_device_id deviceID, cl_context context, cl_command_q
return 0; return 0;
} }
int test_execute_kernel_local_sizes(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(execute_kernel_local_sizes)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -302,7 +300,7 @@ int test_execute_kernel_local_sizes(cl_device_id deviceID, cl_context context, c
return 0; return 0;
} }
int test_set_kernel_arg_by_index(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(set_kernel_arg_by_index)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -372,7 +370,7 @@ int test_set_kernel_arg_by_index(cl_device_id deviceID, cl_context context, cl_c
return 0; return 0;
} }
int test_set_kernel_arg_constant(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(set_kernel_arg_constant)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -390,7 +388,7 @@ int test_set_kernel_arg_constant(cl_device_id deviceID, cl_context context, cl_c
/* Verify our test buffer won't be bigger than allowed */ /* Verify our test buffer won't be bigger than allowed */
maxSize = get_device_info_max_constant_buffer_size( maxSize = get_device_info_max_constant_buffer_size(
deviceID, MAX_DEVICE_MEMORY_SIZE_DIVISOR); device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
if (maxSize < sizeof(cl_int) * num_elements) if (maxSize < sizeof(cl_int) * num_elements)
{ {
log_error( "ERROR: Unable to test constant argument to kernel: max size of constant buffer is reported as %d!\n", (int)maxSize ); log_error( "ERROR: Unable to test constant argument to kernel: max size of constant buffer is reported as %d!\n", (int)maxSize );
@@ -459,7 +457,7 @@ int test_set_kernel_arg_constant(cl_device_id deviceID, cl_context context, cl_c
return 0; return 0;
} }
int test_set_kernel_arg_struct_array(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(set_kernel_arg_struct_array)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -536,7 +534,7 @@ int test_set_kernel_arg_struct_array(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_create_kernels_in_program(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(create_kernels_in_program)
{ {
int error; int error;
cl_program program; cl_program program;
@@ -565,7 +563,7 @@ int test_create_kernels_in_program(cl_device_id deviceID, cl_context context, cl
return 0; return 0;
} }
int test_kernel_global_constant(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(kernel_global_constant)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -633,6 +631,3 @@ int test_kernel_global_constant(cl_device_id deviceID, cl_context context, cl_co
return 0; return 0;
} }

View File

@@ -56,7 +56,7 @@ get_image_dim(MTdata *d, unsigned int mod)
} }
int test_get_buffer_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements ) REGISTER_TEST(get_buffer_info)
{ {
int error; int error;
size_t size; size_t size;
@@ -150,7 +150,8 @@ int test_get_buffer_info( cl_device_id deviceID, cl_context context, cl_command_
// Get the address alignment, so we can make sure the sub-buffer test later works properly. // Get the address alignment, so we can make sure the sub-buffer test later works properly.
cl_uint addressAlignBits; cl_uint addressAlignBits;
error = clGetDeviceInfo( deviceID, CL_DEVICE_MEM_BASE_ADDR_ALIGN, sizeof(addressAlignBits), &addressAlignBits, NULL ); error = clGetDeviceInfo(device, CL_DEVICE_MEM_BASE_ADDR_ALIGN,
sizeof(addressAlignBits), &addressAlignBits, NULL);
size_t addressAlign = addressAlignBits/8; size_t addressAlign = addressAlignBits/8;
if ( addressAlign < 128 ) if ( addressAlign < 128 )
@@ -420,7 +421,8 @@ int test_get_imageObject_info( cl_mem * image, cl_mem_flags objectFlags, cl_imag
} }
int test_get_image_info( cl_device_id deviceID, cl_context context, cl_mem_object_type type ) int test_get_image_info(cl_device_id device, cl_context context,
cl_mem_object_type type)
{ {
int error; int error;
size_t size; size_t size;
@@ -494,7 +496,7 @@ int test_get_image_info( cl_device_id deviceID, cl_context context, cl_mem_objec
MTdataHolder d_holder(gRandomSeed); MTdataHolder d_holder(gRandomSeed);
MTdata d = static_cast<MTdata>(d_holder); MTdata d = static_cast<MTdata>(d_holder);
PASSIVE_REQUIRE_IMAGE_SUPPORT( deviceID ) PASSIVE_REQUIRE_IMAGE_SUPPORT(device)
cl_image_format imageFormat; cl_image_format imageFormat;
size_t pixelSize = 4; size_t pixelSize = 4;
@@ -530,7 +532,7 @@ int test_get_image_info( cl_device_id deviceID, cl_context context, cl_mem_objec
break; break;
case CL_MEM_OBJECT_IMAGE3D: case CL_MEM_OBJECT_IMAGE3D:
error = checkFor3DImageSupport(deviceID); error = checkFor3DImageSupport(device);
if (error == CL_IMAGE_FORMAT_NOT_SUPPORTED) if (error == CL_IMAGE_FORMAT_NOT_SUPPORTED)
{ {
log_info("Device doesn't support 3D images. Skipping test.\n"); log_info("Device doesn't support 3D images. Skipping test.\n");
@@ -738,29 +740,27 @@ int test_get_image_info( cl_device_id deviceID, cl_context context, cl_mem_objec
} }
int test_get_image2d_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements ) REGISTER_TEST(get_image2d_info)
{ {
return test_get_image_info(deviceID, context, CL_MEM_OBJECT_IMAGE2D); return test_get_image_info(device, context, CL_MEM_OBJECT_IMAGE2D);
} }
int test_get_image3d_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements ) REGISTER_TEST(get_image3d_info)
{ {
return test_get_image_info(deviceID, context, CL_MEM_OBJECT_IMAGE3D); return test_get_image_info(device, context, CL_MEM_OBJECT_IMAGE3D);
} }
int test_get_image1d_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements ) REGISTER_TEST(get_image1d_info)
{ {
return test_get_image_info(deviceID, context, CL_MEM_OBJECT_IMAGE1D); return test_get_image_info(device, context, CL_MEM_OBJECT_IMAGE1D);
} }
int test_get_image1d_array_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements ) REGISTER_TEST(get_image1d_array_info)
{ {
return test_get_image_info(deviceID, context, CL_MEM_OBJECT_IMAGE1D_ARRAY); return test_get_image_info(device, context, CL_MEM_OBJECT_IMAGE1D_ARRAY);
} }
int test_get_image2d_array_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements ) REGISTER_TEST(get_image2d_array_info)
{ {
return test_get_image_info(deviceID, context, CL_MEM_OBJECT_IMAGE2D_ARRAY); return test_get_image_info(device, context, CL_MEM_OBJECT_IMAGE2D_ARRAY);
} }

View File

@@ -271,13 +271,12 @@ static int run_test_query_properties(cl_context context, cl_command_queue queue,
return TEST_PASS; return TEST_PASS;
} }
int test_image_properties_queries(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(image_properties_queries, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
int error = CL_SUCCESS; int error = CL_SUCCESS;
cl_bool supports_images = CL_TRUE; cl_bool supports_images = CL_TRUE;
error = clGetDeviceInfo(deviceID, CL_DEVICE_IMAGE_SUPPORT, error = clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT,
sizeof(supports_images), &supports_images, NULL); sizeof(supports_images), &supports_images, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_IMAGE_SUPPORT failed"); test_error(error, "clGetDeviceInfo for CL_DEVICE_IMAGE_SUPPORT failed");
@@ -321,8 +320,7 @@ int test_image_properties_queries(cl_device_id deviceID, cl_context context,
return error; return error;
} }
int test_buffer_properties_queries(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(buffer_properties_queries, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
int error = CL_SUCCESS; int error = CL_SUCCESS;

View File

@@ -83,10 +83,7 @@ int test_mem_object_destructor_callback_single(clMemWrapper &memObject)
return (numErrors > 0) ? TEST_FAIL : TEST_PASS; return (numErrors > 0) ? TEST_FAIL : TEST_PASS;
} }
int test_mem_object_destructor_callback(cl_device_id deviceID, REGISTER_TEST(mem_object_destructor_callback)
cl_context context,
cl_command_queue queue,
int num_elements)
{ {
clMemWrapper testBuffer, testImage; clMemWrapper testBuffer, testImage;
cl_int error; cl_int error;
@@ -102,7 +99,7 @@ int test_mem_object_destructor_callback(cl_device_id deviceID,
return TEST_FAIL; return TEST_FAIL;
} }
if (checkForImageSupport(deviceID) == 0) if (checkForImageSupport(device) == 0)
{ {
cl_image_format imageFormat = { CL_RGBA, CL_SIGNED_INT8 }; cl_image_format imageFormat = { CL_RGBA, CL_SIGNED_INT8 };
testImage = create_image_2d(context, CL_MEM_READ_ONLY, &imageFormat, 16, testImage = create_image_2d(context, CL_MEM_READ_ONLY, &imageFormat, 16,

View File

@@ -15,8 +15,7 @@
// //
#include "testBase.h" #include "testBase.h"
int test_min_image_formats(cl_device_id device, cl_context context, REGISTER_TEST(min_image_formats)
cl_command_queue queue, int num_elements)
{ {
int missingFormats = 0; int missingFormats = 0;

View File

@@ -33,7 +33,7 @@ static void CL_CALLBACK test_native_kernel_fn( void *userData )
args->dest[ i ] = args->source[ i ]; args->dest[ i ] = args->source[ i ];
} }
int test_native_kernel(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems ) REGISTER_TEST(native_kernel)
{ {
int error; int error;
RandomSeed seed( gRandomSeed ); RandomSeed seed( gRandomSeed );
@@ -46,7 +46,7 @@ int test_native_kernel(cl_device_id device, cl_context context, cl_command_queue
} }
clMemWrapper streams[ 2 ]; clMemWrapper streams[ 2 ];
std::vector<cl_int> inBuffer(n_elems), outBuffer(n_elems); std::vector<cl_int> inBuffer(num_elements), outBuffer(num_elements);
clEventWrapper finishEvent; clEventWrapper finishEvent;
struct arg_struct struct arg_struct
@@ -58,21 +58,22 @@ int test_native_kernel(cl_device_id device, cl_context context, cl_command_queue
// Create some input values // Create some input values
generate_random_data(kInt, n_elems, seed, inBuffer.data()); generate_random_data(kInt, num_elements, seed, inBuffer.data());
// Create I/O streams // Create I/O streams
streams[0] = streams[0] =
clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, n_elems * sizeof(cl_int), clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
inBuffer.data(), &error); num_elements * sizeof(cl_int), inBuffer.data(), &error);
test_error( error, "Unable to create I/O stream" ); test_error( error, "Unable to create I/O stream" );
streams[ 1 ] = clCreateBuffer( context, 0, n_elems * sizeof(cl_int), NULL, &error ); streams[1] =
clCreateBuffer(context, 0, num_elements * sizeof(cl_int), NULL, &error);
test_error( error, "Unable to create I/O stream" ); test_error( error, "Unable to create I/O stream" );
// Set up the arrays to call with // Set up the arrays to call with
args.inputStream = streams[ 0 ]; args.inputStream = streams[ 0 ];
args.outputStream = streams[ 1 ]; args.outputStream = streams[ 1 ];
args.count = n_elems; args.count = num_elements;
void * memLocs[ 2 ] = { &args.inputStream, &args.outputStream }; void * memLocs[ 2 ] = { &args.inputStream, &args.outputStream };
@@ -94,11 +95,11 @@ int test_native_kernel(cl_device_id device, cl_context context, cl_command_queue
// Now read the results and verify // Now read the results and verify
error = clEnqueueReadBuffer(queue, streams[1], CL_TRUE, 0, error = clEnqueueReadBuffer(queue, streams[1], CL_TRUE, 0,
n_elems * sizeof(cl_int), outBuffer.data(), 0, num_elements * sizeof(cl_int), outBuffer.data(),
NULL, NULL); 0, NULL, NULL);
test_error( error, "Unable to read results" ); test_error( error, "Unable to read results" );
for( int i = 0; i < n_elems; i++ ) for (int i = 0; i < num_elements; i++)
{ {
if (inBuffer[i] != outBuffer[i]) if (inBuffer[i] != outBuffer[i])
{ {
@@ -111,8 +112,3 @@ int test_native_kernel(cl_device_id device, cl_context context, cl_command_queue
return 0; return 0;
} }

View File

@@ -24,8 +24,6 @@
#include "testBase.h" #include "testBase.h"
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
#include "harness/testHarness.h" #include "harness/testHarness.h"
#include "procs.h"
enum { SUCCESS, FAILURE }; enum { SUCCESS, FAILURE };
typedef enum { NON_NULL_PATH, ADDROF_NULL_PATH, NULL_PATH } test_type; typedef enum { NON_NULL_PATH, ADDROF_NULL_PATH, NULL_PATH } test_type;
@@ -150,8 +148,7 @@ static int test_setargs_and_execution(cl_command_queue queue, cl_kernel kernel,
return test_success; return test_success;
} }
int test_null_buffer_arg(cl_device_id device, cl_context context, REGISTER_TEST(null_buffer_arg)
cl_command_queue queue, int num_elements)
{ {
unsigned int test_success = 0; unsigned int test_success = 0;
unsigned int buffer_size; unsigned int buffer_size;

View File

@@ -71,14 +71,13 @@ static int create_pipe_and_check_array_properties(
return TEST_FAIL; return TEST_FAIL;
} }
int test_pipe_properties_queries(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(pipe_properties_queries, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
cl_int error = CL_SUCCESS; cl_int error = CL_SUCCESS;
cl_bool pipeSupport = CL_FALSE; cl_bool pipeSupport = CL_FALSE;
error = clGetDeviceInfo(deviceID, CL_DEVICE_PIPE_SUPPORT, error = clGetDeviceInfo(device, CL_DEVICE_PIPE_SUPPORT, sizeof(pipeSupport),
sizeof(pipeSupport), &pipeSupport, NULL); &pipeSupport, NULL);
test_error(error, "Unable to query CL_DEVICE_PIPE_SUPPORT"); test_error(error, "Unable to query CL_DEVICE_PIPE_SUPPORT");
if (pipeSupport == CL_FALSE) if (pipeSupport == CL_FALSE)

View File

@@ -21,8 +21,7 @@
#define PRINT_EXTENSION_INFO 0 #define PRINT_EXTENSION_INFO 0
int test_platform_extensions(cl_device_id deviceID, cl_context context, REGISTER_TEST(platform_extensions)
cl_command_queue queue, int num_elements)
{ {
const char * extensions[] = { const char * extensions[] = {
"cl_khr_byte_addressable_store", "cl_khr_byte_addressable_store",
@@ -64,17 +63,14 @@ int test_platform_extensions(cl_device_id deviceID, cl_context context,
char device_extensions[EXTENSION_NAME_BUF_SIZE]; char device_extensions[EXTENSION_NAME_BUF_SIZE];
// Okay, so what we're going to do is just check the device indicated by // Okay, so what we're going to do is just check the device indicated by
// deviceID against the platform that includes this device // device against the platform that includes this device
// pass CL_DEVICE_PLATFORM to clGetDeviceInfo // pass CL_DEVICE_PLATFORM to clGetDeviceInfo
// to get a result of type cl_platform_id // to get a result of type cl_platform_id
err = clGetDeviceInfo(deviceID, err = clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(cl_platform_id),
CL_DEVICE_PLATFORM, (void *)(&platformID), NULL);
sizeof(cl_platform_id),
(void *)(&platformID),
NULL);
if(err != CL_SUCCESS) if(err != CL_SUCCESS)
{ {
@@ -115,11 +111,9 @@ int test_platform_extensions(cl_device_id deviceID, cl_context context,
// and then we grab the set of extensions specified by the device // and then we grab the set of extensions specified by the device
// (this can be turned into a "loop over all devices in this platform") // (this can be turned into a "loop over all devices in this platform")
err = clGetDeviceInfo(deviceID, err =
CL_DEVICE_EXTENSIONS, clGetDeviceInfo(device, CL_DEVICE_EXTENSIONS, sizeof(device_extensions),
sizeof(device_extensions), (void *)(&device_extensions[0]), NULL);
(void *)(&device_extensions[0]),
NULL);
if(err != CL_SUCCESS) if(err != CL_SUCCESS)
{ {
vlog_error("test_platform_extensions : could not get extension string from device\n"); vlog_error("test_platform_extensions : could not get extension string from device\n");
@@ -149,7 +143,8 @@ int test_platform_extensions(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { REGISTER_TEST(get_platform_ids)
{
cl_platform_id platforms[16]; cl_platform_id platforms[16];
cl_uint num_platforms; cl_uint num_platforms;
char *string_returned; char *string_returned;
@@ -163,20 +158,23 @@ int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_
err = clGetPlatformIDs(16, platforms, &num_platforms); err = clGetPlatformIDs(16, platforms, &num_platforms);
test_error(err, "clGetPlatformIDs failed"); test_error(err, "clGetPlatformIDs failed");
if (num_platforms <= 16) { if (num_platforms <= 16)
{
// Try with NULL // Try with NULL
err = clGetPlatformIDs(num_platforms, platforms, NULL); err = clGetPlatformIDs(num_platforms, platforms, NULL);
test_error(err, "clGetPlatformIDs failed with NULL for return size"); test_error(err, "clGetPlatformIDs failed with NULL for return size");
} }
if (num_platforms < 1) { if (num_platforms < 1)
{
log_error("Found 0 platforms.\n"); log_error("Found 0 platforms.\n");
return -1; return -1;
} }
log_info("Found %d platforms.\n", num_platforms); log_info("Found %d platforms.\n", num_platforms);
for (int p=0; p<(int)num_platforms; p++) { for (int p = 0; p < (int)num_platforms; p++)
{
cl_device_id *devices; cl_device_id *devices;
cl_uint num_devices; cl_uint num_devices;
size_t size; size_t size;
@@ -185,10 +183,12 @@ int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_
log_info("Platform %d (%p):\n", p, platforms[p]); log_info("Platform %d (%p):\n", p, platforms[p]);
memset(string_returned, 0, 8192); memset(string_returned, 0, 8192);
err = clGetPlatformInfo(platforms[p], CL_PLATFORM_PROFILE, 8192, string_returned, &size); err = clGetPlatformInfo(platforms[p], CL_PLATFORM_PROFILE, 8192,
string_returned, &size);
test_error(err, "clGetPlatformInfo for CL_PLATFORM_PROFILE failed"); test_error(err, "clGetPlatformInfo for CL_PLATFORM_PROFILE failed");
log_info("\tCL_PLATFORM_PROFILE: %s\n", string_returned); log_info("\tCL_PLATFORM_PROFILE: %s\n", string_returned);
if (strlen(string_returned)+1 != size) { if (strlen(string_returned) + 1 != size)
{
log_error( log_error(
"Returned string length %zu does not equal reported one %zu.\n", "Returned string length %zu does not equal reported one %zu.\n",
strlen(string_returned) + 1, size); strlen(string_returned) + 1, size);
@@ -196,10 +196,12 @@ int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_
} }
memset(string_returned, 0, 8192); memset(string_returned, 0, 8192);
err = clGetPlatformInfo(platforms[p], CL_PLATFORM_VERSION, 8192, string_returned, &size); err = clGetPlatformInfo(platforms[p], CL_PLATFORM_VERSION, 8192,
string_returned, &size);
test_error(err, "clGetPlatformInfo for CL_PLATFORM_VERSION failed"); test_error(err, "clGetPlatformInfo for CL_PLATFORM_VERSION failed");
log_info("\tCL_PLATFORM_VERSION: %s\n", string_returned); log_info("\tCL_PLATFORM_VERSION: %s\n", string_returned);
if (strlen(string_returned)+1 != size) { if (strlen(string_returned) + 1 != size)
{
log_error( log_error(
"Returned string length %zu does not equal reported one %zu.\n", "Returned string length %zu does not equal reported one %zu.\n",
strlen(string_returned) + 1, size); strlen(string_returned) + 1, size);
@@ -207,10 +209,12 @@ int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_
} }
memset(string_returned, 0, 8192); memset(string_returned, 0, 8192);
err = clGetPlatformInfo(platforms[p], CL_PLATFORM_NAME, 8192, string_returned, &size); err = clGetPlatformInfo(platforms[p], CL_PLATFORM_NAME, 8192,
string_returned, &size);
test_error(err, "clGetPlatformInfo for CL_PLATFORM_NAME failed"); test_error(err, "clGetPlatformInfo for CL_PLATFORM_NAME failed");
log_info("\tCL_PLATFORM_NAME: %s\n", string_returned); log_info("\tCL_PLATFORM_NAME: %s\n", string_returned);
if (strlen(string_returned)+1 != size) { if (strlen(string_returned) + 1 != size)
{
log_error( log_error(
"Returned string length %zu does not equal reported one %zu.\n", "Returned string length %zu does not equal reported one %zu.\n",
strlen(string_returned) + 1, size); strlen(string_returned) + 1, size);
@@ -218,10 +222,12 @@ int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_
} }
memset(string_returned, 0, 8192); memset(string_returned, 0, 8192);
err = clGetPlatformInfo(platforms[p], CL_PLATFORM_VENDOR, 8192, string_returned, &size); err = clGetPlatformInfo(platforms[p], CL_PLATFORM_VENDOR, 8192,
string_returned, &size);
test_error(err, "clGetPlatformInfo for CL_PLATFORM_VENDOR failed"); test_error(err, "clGetPlatformInfo for CL_PLATFORM_VENDOR failed");
log_info("\tCL_PLATFORM_VENDOR: %s\n", string_returned); log_info("\tCL_PLATFORM_VENDOR: %s\n", string_returned);
if (strlen(string_returned)+1 != size) { if (strlen(string_returned) + 1 != size)
{
log_error( log_error(
"Returned string length %zu does not equal reported one %zu.\n", "Returned string length %zu does not equal reported one %zu.\n",
strlen(string_returned) + 1, size); strlen(string_returned) + 1, size);
@@ -229,17 +235,20 @@ int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_
} }
memset(string_returned, 0, 8192); memset(string_returned, 0, 8192);
err = clGetPlatformInfo(platforms[p], CL_PLATFORM_EXTENSIONS, 8192, string_returned, &size); err = clGetPlatformInfo(platforms[p], CL_PLATFORM_EXTENSIONS, 8192,
string_returned, &size);
test_error(err, "clGetPlatformInfo for CL_PLATFORM_EXTENSIONS failed"); test_error(err, "clGetPlatformInfo for CL_PLATFORM_EXTENSIONS failed");
log_info("\tCL_PLATFORM_EXTENSIONS: %s\n", string_returned); log_info("\tCL_PLATFORM_EXTENSIONS: %s\n", string_returned);
if (strlen(string_returned)+1 != size) { if (strlen(string_returned) + 1 != size)
{
log_error( log_error(
"Returned string length %zu does not equal reported one %zu.\n", "Returned string length %zu does not equal reported one %zu.\n",
strlen(string_returned) + 1, size); strlen(string_returned) + 1, size);
total_errors++; total_errors++;
} }
err = clGetDeviceIDs(platforms[p], CL_DEVICE_TYPE_ALL, 0, NULL, &num_devices); err = clGetDeviceIDs(platforms[p], CL_DEVICE_TYPE_ALL, 0, NULL,
&num_devices);
test_error(err, "clGetDeviceIDs failed.\n"); test_error(err, "clGetDeviceIDs failed.\n");
if (num_devices == 0) if (num_devices == 0)
{ {
@@ -249,7 +258,8 @@ int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_
devices = (cl_device_id *)malloc(num_devices * sizeof(cl_device_id)); devices = (cl_device_id *)malloc(num_devices * sizeof(cl_device_id));
memset(devices, 0, sizeof(cl_device_id) * num_devices); memset(devices, 0, sizeof(cl_device_id) * num_devices);
err = clGetDeviceIDs(platforms[p], CL_DEVICE_TYPE_ALL, num_devices, devices, NULL); err = clGetDeviceIDs(platforms[p], CL_DEVICE_TYPE_ALL, num_devices,
devices, NULL);
test_error(err, "clGetDeviceIDs failed.\n"); test_error(err, "clGetDeviceIDs failed.\n");
log_info("\tPlatform has %d devices.\n", (int)num_devices); log_info("\tPlatform has %d devices.\n", (int)num_devices);
@@ -268,33 +278,37 @@ int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_
test_error(err, "clGetDeviceInfo failed for CL_DEVICE_PLATFORM\n"); test_error(err, "clGetDeviceInfo failed for CL_DEVICE_PLATFORM\n");
if (returned_size != sizeof(cl_platform_id)) if (returned_size != sizeof(cl_platform_id))
{ {
log_error("Reported return size (%zu) does not match expected size " log_error(
"Reported return size (%zu) does not match expected size "
"(%zu).\n", "(%zu).\n",
returned_size, sizeof(cl_platform_id)); returned_size, sizeof(cl_platform_id));
total_errors++; total_errors++;
} }
memset(string_returned, 0, 8192); memset(string_returned, 0, 8192);
err = clGetDeviceInfo(devices[d], CL_DEVICE_NAME, 8192, string_returned, err = clGetDeviceInfo(devices[d], CL_DEVICE_NAME, 8192,
NULL); string_returned, NULL);
test_error(err, "clGetDeviceInfo failed for CL_DEVICE_NAME\n"); test_error(err, "clGetDeviceInfo failed for CL_DEVICE_NAME\n");
log_info("\t\tPlatform for device %d (%s) is %p.\n", d, string_returned, log_info("\t\tPlatform for device %d (%s) is %p.\n", d,
returned_platform); string_returned, returned_platform);
log_info("\t\t\tTesting clCreateContext for the platform/device...\n"); log_info(
"\t\t\tTesting clCreateContext for the platform/device...\n");
// Try creating a context for the platform // Try creating a context for the platform
context = clCreateContext(properties, 1, &devices[d], NULL, NULL, &err); context =
test_error( clCreateContext(properties, 1, &devices[d], NULL, NULL, &err);
err, test_error(err,
"\t\tclCreateContext failed for device with platform properties\n"); "\t\tclCreateContext failed for device with platform "
"properties\n");
memset(properties, 0, sizeof(cl_context_properties) * 3); memset(properties, 0, sizeof(cl_context_properties) * 3);
err = clGetContextInfo(context, CL_CONTEXT_PROPERTIES, err = clGetContextInfo(context, CL_CONTEXT_PROPERTIES,
sizeof(cl_context_properties) * 3, properties, sizeof(cl_context_properties) * 3,
&returned_size); properties, &returned_size);
test_error(err, "clGetContextInfo for CL_CONTEXT_PROPERTIES failed"); test_error(err,
"clGetContextInfo for CL_CONTEXT_PROPERTIES failed");
if (returned_size != sizeof(cl_context_properties) * 3) if (returned_size != sizeof(cl_context_properties) * 3)
{ {
log_error("Invalid size returned from clGetContextInfo for " log_error("Invalid size returned from clGetContextInfo for "
@@ -306,8 +320,8 @@ int test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_
if (properties[0] != (cl_context_properties)CL_CONTEXT_PLATFORM if (properties[0] != (cl_context_properties)CL_CONTEXT_PLATFORM
|| properties[1] != (cl_context_properties)platforms[p]) || properties[1] != (cl_context_properties)platforms[p])
{ {
log_error( log_error("Wrong properties returned. Expected: [%p %p], got "
"Wrong properties returned. Expected: [%p %p], got [%p %p]\n", "[%p %p]\n",
(void *)CL_CONTEXT_PLATFORM, platforms[p], (void *)CL_CONTEXT_PLATFORM, platforms[p],
(void *)properties[0], (void *)properties[1]); (void *)properties[0], (void *)properties[1]);
total_errors++; total_errors++;

View File

@@ -22,7 +22,7 @@
#include <cinttypes> #include <cinttypes>
#include <vector> #include <vector>
int test_get_platform_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(get_platform_info)
{ {
cl_platform_id platform; cl_platform_id platform;
cl_int error; cl_int error;
@@ -162,7 +162,7 @@ static cl_addressing_mode addressing_mode_values[] = {
static cl_filter_mode filter_mode_values[] = { CL_FILTER_NEAREST, static cl_filter_mode filter_mode_values[] = { CL_FILTER_NEAREST,
CL_FILTER_LINEAR }; CL_FILTER_LINEAR };
int test_sampler_params(cl_device_id deviceID, cl_context context, int test_sampler_params(cl_device_id device, cl_context context,
bool is_compatibility, size_t norm_coord_num, bool is_compatibility, size_t norm_coord_num,
size_t addr_mod_num, size_t filt_mod_num) size_t addr_mod_num, size_t filt_mod_num)
{ {
@@ -218,7 +218,7 @@ int test_sampler_params(cl_device_id deviceID, cl_context context,
"normalized coords"); "normalized coords");
test_error(error, "param checking failed"); test_error(error, "param checking failed");
Version version = get_device_cl_version(deviceID); Version version = get_device_cl_version(device);
if (version >= Version(3, 0)) if (version >= Version(3, 0))
{ {
std::vector<cl_sampler_properties> test_properties( std::vector<cl_sampler_properties> test_properties(
@@ -270,7 +270,7 @@ int test_sampler_params(cl_device_id deviceID, cl_context context,
return 0; return 0;
} }
int get_sampler_info_params(cl_device_id deviceID, cl_context context, int get_sampler_info_params(cl_device_id device, cl_context context,
bool is_compatibility) bool is_compatibility)
{ {
for (size_t norm_coord_num = 0; for (size_t norm_coord_num = 0;
@@ -289,36 +289,32 @@ int get_sampler_info_params(cl_device_id deviceID, cl_context context,
for (size_t filt_mod_num = 0; for (size_t filt_mod_num = 0;
filt_mod_num < ARRAY_SIZE(filter_mode_values); filt_mod_num++) filt_mod_num < ARRAY_SIZE(filter_mode_values); filt_mod_num++)
{ {
int err = test_sampler_params(deviceID, context, int err = test_sampler_params(device, context, is_compatibility,
is_compatibility, norm_coord_num, norm_coord_num, addr_mod_num,
addr_mod_num, filt_mod_num); filt_mod_num);
test_error(err, "testing clGetSamplerInfo params failed"); test_error(err, "testing clGetSamplerInfo params failed");
} }
} }
} }
return 0; return 0;
} }
int test_get_sampler_info(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(get_sampler_info, Version(2, 0))
cl_command_queue queue, int num_elements)
{ {
int error; int error;
PASSIVE_REQUIRE_IMAGE_SUPPORT(deviceID) PASSIVE_REQUIRE_IMAGE_SUPPORT(device)
error = get_sampler_info_params(deviceID, context, false); error = get_sampler_info_params(device, context, false);
test_error(error, "Test Failed"); test_error(error, "Test Failed");
return 0; return 0;
} }
int test_get_sampler_info_compatibility(cl_device_id deviceID, REGISTER_TEST(get_sampler_info_compatibility)
cl_context context,
cl_command_queue queue,
int num_elements)
{ {
int error; int error;
PASSIVE_REQUIRE_IMAGE_SUPPORT(deviceID) PASSIVE_REQUIRE_IMAGE_SUPPORT(device)
error = get_sampler_info_params(deviceID, context, true); error = get_sampler_info_params(device, context, true);
test_error(error, "Test Failed"); test_error(error, "Test Failed");
return 0; return 0;
@@ -347,8 +343,7 @@ int command_queue_param_test(cl_command_queue queue,
return 0; return 0;
} }
int check_get_command_queue_info_params(cl_device_id deviceID, int check_get_command_queue_info_params(cl_device_id device, cl_context context,
cl_context context,
bool is_compatibility) bool is_compatibility)
{ {
const cl_command_queue_properties host_optional[] = { const cl_command_queue_properties host_optional[] = {
@@ -370,7 +365,7 @@ int check_get_command_queue_info_params(cl_device_id deviceID,
const size_t host_optional_size = ARRAY_SIZE(host_optional); const size_t host_optional_size = ARRAY_SIZE(host_optional);
const size_t device_required_size = ARRAY_SIZE(device_required); const size_t device_required_size = ARRAY_SIZE(device_required);
Version version = get_device_cl_version(deviceID); Version version = get_device_cl_version(device);
const cl_device_info host_queue_query = version >= Version(2, 0) const cl_device_info host_queue_query = version >= Version(2, 0)
? CL_DEVICE_QUEUE_ON_HOST_PROPERTIES ? CL_DEVICE_QUEUE_ON_HOST_PROPERTIES
@@ -378,7 +373,7 @@ int check_get_command_queue_info_params(cl_device_id deviceID,
cl_queue_properties host_queue_props = 0; cl_queue_properties host_queue_props = 0;
int error = int error =
clGetDeviceInfo(deviceID, host_queue_query, sizeof(host_queue_props), clGetDeviceInfo(device, host_queue_query, sizeof(host_queue_props),
&host_queue_props, NULL); &host_queue_props, NULL);
test_error(error, "clGetDeviceInfo failed"); test_error(error, "clGetDeviceInfo failed");
log_info("CL_DEVICE_QUEUE_ON_HOST_PROPERTIES is %" PRIu64 "\n", log_info("CL_DEVICE_QUEUE_ON_HOST_PROPERTIES is %" PRIu64 "\n",
@@ -387,7 +382,7 @@ int check_get_command_queue_info_params(cl_device_id deviceID,
cl_queue_properties device_queue_props = 0; cl_queue_properties device_queue_props = 0;
if (version >= Version(2, 0)) if (version >= Version(2, 0))
{ {
error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES, error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES,
sizeof(device_queue_props), &device_queue_props, sizeof(device_queue_props), &device_queue_props,
NULL); NULL);
test_error(error, "clGetDeviceInfo failed"); test_error(error, "clGetDeviceInfo failed");
@@ -430,12 +425,12 @@ int check_get_command_queue_info_params(cl_device_id deviceID,
clCommandQueueWrapper queue; clCommandQueueWrapper queue;
if (is_compatibility) if (is_compatibility)
{ {
queue = clCreateCommandQueue(context, deviceID, props, &error); queue = clCreateCommandQueue(context, device, props, &error);
test_error(error, "Unable to create command queue to test with"); test_error(error, "Unable to create command queue to test with");
} }
else else
{ {
queue = clCreateCommandQueueWithProperties(context, deviceID, queue = clCreateCommandQueueWithProperties(context, device,
queue_props_arg, &error); queue_props_arg, &error);
test_error(error, "Unable to create command queue to test with"); test_error(error, "Unable to create command queue to test with");
} }
@@ -453,8 +448,8 @@ int check_get_command_queue_info_params(cl_device_id deviceID,
"context"); "context");
test_error(error, "param checking failed"); test_error(error, "param checking failed");
error = command_queue_param_test(queue, CL_QUEUE_DEVICE, deviceID, error =
"deviceID"); command_queue_param_test(queue, CL_QUEUE_DEVICE, device, "device");
test_error(error, "param checking failed"); test_error(error, "param checking failed");
error = command_queue_param_test(queue, CL_QUEUE_PROPERTIES, error = command_queue_param_test(queue, CL_QUEUE_PROPERTIES,
@@ -464,25 +459,21 @@ int check_get_command_queue_info_params(cl_device_id deviceID,
return 0; return 0;
} }
int test_get_command_queue_info(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(get_command_queue_info, Version(2, 0))
cl_command_queue ignoreQueue, int num_elements)
{ {
int error = check_get_command_queue_info_params(deviceID, context, false); int error = check_get_command_queue_info_params(device, context, false);
test_error(error, "Test Failed"); test_error(error, "Test Failed");
return 0; return 0;
} }
int test_get_command_queue_info_compatibility(cl_device_id deviceID, REGISTER_TEST(get_command_queue_info_compatibility)
cl_context context,
cl_command_queue ignoreQueue,
int num_elements)
{ {
int error = check_get_command_queue_info_params(deviceID, context, true); int error = check_get_command_queue_info_params(device, context, true);
test_error(error, "Test Failed"); test_error(error, "Test Failed");
return 0; return 0;
} }
int test_get_context_info(cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements) REGISTER_TEST(get_context_info)
{ {
int error; int error;
size_t size; size_t size;
@@ -534,16 +525,18 @@ return -1; \
} \ } \
log_info( "\tReported device " name " : " type "\n", (int)( val / div ) ); log_info( "\tReported device " name " : " type "\n", (int)( val / div ) );
int test_get_device_info(cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements) REGISTER_TEST(get_device_info)
{ {
int error; int error;
size_t size; size_t size;
cl_uint vendorID; cl_uint vendorID;
TEST_DEVICE_PARAM( deviceID, CL_DEVICE_VENDOR_ID, vendorID, "vendor ID", "0x%08x", int ) TEST_DEVICE_PARAM(device, CL_DEVICE_VENDOR_ID, vendorID, "vendor ID",
"0x%08x", int)
char extensions[ 10240 ]; char extensions[ 10240 ];
error = clGetDeviceInfo( deviceID, CL_DEVICE_EXTENSIONS, sizeof( extensions ), &extensions, &size ); error = clGetDeviceInfo(device, CL_DEVICE_EXTENSIONS, sizeof(extensions),
&extensions, &size);
test_error( error, "Unable to get device extensions" ); test_error( error, "Unable to get device extensions" );
if( size != strlen( extensions ) + 1 ) if( size != strlen( extensions ) + 1 )
{ {
@@ -553,25 +546,33 @@ int test_get_device_info(cl_device_id deviceID, cl_context context, cl_command_q
log_info( "\tReported device extensions: %s \n", extensions ); log_info( "\tReported device extensions: %s \n", extensions );
cl_uint preferred; cl_uint preferred;
TEST_DEVICE_PARAM( deviceID, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, preferred, "preferred vector char width", "%d", int ) TEST_DEVICE_PARAM(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, preferred,
TEST_DEVICE_PARAM( deviceID, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, preferred, "preferred vector short width", "%d", int ) "preferred vector char width", "%d", int)
TEST_DEVICE_PARAM( deviceID, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, preferred, "preferred vector int width", "%d", int ) TEST_DEVICE_PARAM(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, preferred,
TEST_DEVICE_PARAM( deviceID, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, preferred, "preferred vector long width", "%d", int ) "preferred vector short width", "%d", int)
TEST_DEVICE_PARAM( deviceID, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, preferred, "preferred vector float width", "%d", int ) TEST_DEVICE_PARAM(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, preferred,
TEST_DEVICE_PARAM( deviceID, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, preferred, "preferred vector double width", "%d", int ) "preferred vector int width", "%d", int)
TEST_DEVICE_PARAM(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, preferred,
"preferred vector long width", "%d", int)
TEST_DEVICE_PARAM(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, preferred,
"preferred vector float width", "%d", int)
TEST_DEVICE_PARAM(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE,
preferred, "preferred vector double width", "%d", int)
// Note that even if cl_khr_fp64, the preferred width for double can be non-zero. For example, vendors // Note that even if cl_khr_fp64, the preferred width for double can be non-zero. For example, vendors
// extensions can support double but may not support cl_khr_fp64, which implies math library support. // extensions can support double but may not support cl_khr_fp64, which implies math library support.
cl_uint baseAddrAlign; cl_uint baseAddrAlign;
TEST_DEVICE_PARAM(deviceID, CL_DEVICE_MEM_BASE_ADDR_ALIGN, baseAddrAlign, TEST_DEVICE_PARAM(device, CL_DEVICE_MEM_BASE_ADDR_ALIGN, baseAddrAlign,
"base address alignment", "%d bits", int) "base address alignment", "%d bits", int)
cl_uint maxDataAlign; cl_uint maxDataAlign;
TEST_DEVICE_PARAM( deviceID, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, maxDataAlign, "min data type alignment", "%d bytes", int ) TEST_DEVICE_PARAM(device, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, maxDataAlign,
"min data type alignment", "%d bytes", int)
cl_device_mem_cache_type cacheType; cl_device_mem_cache_type cacheType;
error = clGetDeviceInfo( deviceID, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, sizeof( cacheType ), &cacheType, &size ); error = clGetDeviceInfo(device, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE,
sizeof(cacheType), &cacheType, &size);
test_error( error, "Unable to get device global mem cache type" ); test_error( error, "Unable to get device global mem cache type" );
if( size != sizeof( cacheType ) ) if( size != sizeof( cacheType ) )
{ {
@@ -582,16 +583,21 @@ int test_get_device_info(cl_device_id deviceID, cl_context context, cl_command_q
log_info( "\tReported device global mem cache type: %s \n", cacheTypeName ); log_info( "\tReported device global mem cache type: %s \n", cacheTypeName );
cl_uint cachelineSize; cl_uint cachelineSize;
TEST_DEVICE_PARAM( deviceID, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, cachelineSize, "global mem cacheline size", "%d bytes", int ) TEST_DEVICE_PARAM(device, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE,
cachelineSize, "global mem cacheline size", "%d bytes",
int)
cl_ulong cacheSize; cl_ulong cacheSize;
TEST_DEVICE_PARAM_MEM( deviceID, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, cacheSize, "global mem cache size", "%d KB", 1024 ) TEST_DEVICE_PARAM_MEM(device, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, cacheSize,
"global mem cache size", "%d KB", 1024)
cl_ulong memSize; cl_ulong memSize;
TEST_DEVICE_PARAM_MEM( deviceID, CL_DEVICE_GLOBAL_MEM_SIZE, memSize, "global mem size", "%d MB", ( 1024 * 1024 ) ) TEST_DEVICE_PARAM_MEM(device, CL_DEVICE_GLOBAL_MEM_SIZE, memSize,
"global mem size", "%d MB", (1024 * 1024))
cl_device_local_mem_type localMemType; cl_device_local_mem_type localMemType;
error = clGetDeviceInfo( deviceID, CL_DEVICE_LOCAL_MEM_TYPE, sizeof( localMemType ), &localMemType, &size ); error = clGetDeviceInfo(device, CL_DEVICE_LOCAL_MEM_TYPE,
sizeof(localMemType), &localMemType, &size);
test_error( error, "Unable to get device local mem type" ); test_error( error, "Unable to get device local mem type" );
if( size != sizeof( cacheType ) ) if( size != sizeof( cacheType ) )
{ {
@@ -603,22 +609,29 @@ int test_get_device_info(cl_device_id deviceID, cl_context context, cl_command_q
cl_bool errSupport; cl_bool errSupport;
TEST_DEVICE_PARAM( deviceID, CL_DEVICE_ERROR_CORRECTION_SUPPORT, errSupport, "error correction support", "%d", int ) TEST_DEVICE_PARAM(device, CL_DEVICE_ERROR_CORRECTION_SUPPORT, errSupport,
"error correction support", "%d", int)
size_t timerResolution; size_t timerResolution;
TEST_DEVICE_PARAM( deviceID, CL_DEVICE_PROFILING_TIMER_RESOLUTION, timerResolution, "profiling timer resolution", "%ld nanoseconds", long ) TEST_DEVICE_PARAM(device, CL_DEVICE_PROFILING_TIMER_RESOLUTION,
timerResolution, "profiling timer resolution",
"%ld nanoseconds", long)
cl_bool endian; cl_bool endian;
TEST_DEVICE_PARAM( deviceID, CL_DEVICE_ENDIAN_LITTLE, endian, "little endian flag", "%d", int ) TEST_DEVICE_PARAM(device, CL_DEVICE_ENDIAN_LITTLE, endian,
"little endian flag", "%d", int)
cl_bool avail; cl_bool avail;
TEST_DEVICE_PARAM( deviceID, CL_DEVICE_AVAILABLE, avail, "available flag", "%d", int ) TEST_DEVICE_PARAM(device, CL_DEVICE_AVAILABLE, avail, "available flag",
"%d", int)
cl_bool compilerAvail; cl_bool compilerAvail;
TEST_DEVICE_PARAM( deviceID, CL_DEVICE_COMPILER_AVAILABLE, compilerAvail, "compiler available flag", "%d", int ) TEST_DEVICE_PARAM(device, CL_DEVICE_COMPILER_AVAILABLE, compilerAvail,
"compiler available flag", "%d", int)
char profile[ 1024 ]; char profile[ 1024 ];
error = clGetDeviceInfo( deviceID, CL_DEVICE_PROFILE, sizeof( profile ), &profile, &size ); error = clGetDeviceInfo(device, CL_DEVICE_PROFILE, sizeof(profile),
&profile, &size);
test_error( error, "Unable to get device profile" ); test_error( error, "Unable to get device profile" );
if( size != strlen( profile ) + 1 ) if( size != strlen( profile ) + 1 )
{ {
@@ -644,8 +657,6 @@ int test_get_device_info(cl_device_id deviceID, cl_context context, cl_command_q
} }
static const char *sample_compile_size[2] = { static const char *sample_compile_size[2] = {
"__kernel void sample_test(__global int *src, __global int *dst)\n" "__kernel void sample_test(__global int *src, __global int *dst)\n"
"{\n" "{\n"
@@ -660,7 +671,7 @@ static const char *sample_compile_size[2] = {
"\n" "\n"
"}\n" }; "}\n" };
int test_kernel_required_group_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(kernel_required_group_size)
{ {
int error; int error;
size_t realSize; size_t realSize;
@@ -670,7 +681,8 @@ int test_kernel_required_group_size(cl_device_id deviceID, cl_context context, c
cl_uint max_dimensions; cl_uint max_dimensions;
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, sizeof(max_dimensions), &max_dimensions, NULL); error = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS,
sizeof(max_dimensions), &max_dimensions, NULL);
test_error(error, "clGetDeviceInfo failed for CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS"); test_error(error, "clGetDeviceInfo failed for CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS");
log_info("Device reported CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = %d.\n", (int)max_dimensions); log_info("Device reported CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = %d.\n", (int)max_dimensions);
@@ -682,12 +694,17 @@ int test_kernel_required_group_size(cl_device_id deviceID, cl_context context, c
if( error != 0 ) if( error != 0 )
return error; return error;
error = clGetKernelWorkGroupInfo(kernel, deviceID, CL_KERNEL_WORK_GROUP_SIZE, sizeof(kernel_max_workgroup_size), &kernel_max_workgroup_size, NULL); error =
clGetKernelWorkGroupInfo(kernel, device, CL_KERNEL_WORK_GROUP_SIZE,
sizeof(kernel_max_workgroup_size),
&kernel_max_workgroup_size, NULL);
test_error( error, "clGetKernelWorkGroupInfo failed for CL_KERNEL_WORK_GROUP_SIZE"); test_error( error, "clGetKernelWorkGroupInfo failed for CL_KERNEL_WORK_GROUP_SIZE");
log_info("The CL_KERNEL_WORK_GROUP_SIZE for the kernel is %d.\n", (int)kernel_max_workgroup_size); log_info("The CL_KERNEL_WORK_GROUP_SIZE for the kernel is %d.\n", (int)kernel_max_workgroup_size);
size_t size[ 3 ]; size_t size[ 3 ];
error = clGetKernelWorkGroupInfo( kernel, deviceID, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, sizeof( size ), size, &realSize ); error = clGetKernelWorkGroupInfo(kernel, device,
CL_KERNEL_COMPILE_WORK_GROUP_SIZE,
sizeof(size), size, &realSize);
test_error( error, "Unable to get work group info" ); test_error( error, "Unable to get work group info" );
if( size[ 0 ] != 0 || size[ 1 ] != 0 || size[ 2 ] != 0 ) if( size[ 0 ] != 0 || size[ 1 ] != 0 || size[ 2 ] != 0 )
@@ -735,7 +752,9 @@ int test_kernel_required_group_size(cl_device_id deviceID, cl_context context, c
return error; return error;
size_t size[ 3 ]; size_t size[ 3 ];
error = clGetKernelWorkGroupInfo( kernel, deviceID, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, sizeof( size ), size, &realSize ); error = clGetKernelWorkGroupInfo(kernel, device,
CL_KERNEL_COMPILE_WORK_GROUP_SIZE,
sizeof(size), size, &realSize);
test_error( error, "Unable to get work group info" ); test_error( error, "Unable to get work group info" );
if( size[ 0 ] != local[0] || size[ 1 ] != local[1] || size[ 2 ] != local[2] ) if( size[ 0 ] != local[0] || size[ 1 ] != local[1] || size[ 2 ] != local[2] )

View File

@@ -18,13 +18,12 @@
#include "testBase.h" #include "testBase.h"
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
int test_queue_flush_on_release(cl_device_id deviceID, cl_context context, REGISTER_TEST(queue_flush_on_release)
cl_command_queue defaultQueue, int num_elements)
{ {
cl_int err; cl_int err;
// Create a command queue // Create a command queue
cl_command_queue queue = clCreateCommandQueue(context, deviceID, 0, &err); cl_command_queue cmd_queue = clCreateCommandQueue(context, device, 0, &err);
test_error(err, "Could not create command queue"); test_error(err, "Could not create command queue");
// Create a kernel // Create a kernel
@@ -38,12 +37,12 @@ int test_queue_flush_on_release(cl_device_id deviceID, cl_context context,
// Enqueue the kernel // Enqueue the kernel
size_t gws = 1; size_t gws = 1;
clEventWrapper event; clEventWrapper event;
err = clEnqueueNDRangeKernel(queue, kernel, 1, nullptr, &gws, nullptr, 0, err = clEnqueueNDRangeKernel(cmd_queue, kernel, 1, nullptr, &gws, nullptr,
nullptr, &event); 0, nullptr, &event);
test_error(err, "Could not enqueue kernel"); test_error(err, "Could not enqueue kernel");
// Release the queue // Release the queue
err = clReleaseCommandQueue(queue); err = clReleaseCommandQueue(cmd_queue);
// Wait for kernel to execute since the queue must flush on release // Wait for kernel to execute since the queue must flush on release
bool success = poll_until(2000, 50, [&event]() { bool success = poll_until(2000, 50, [&event]() {

View File

@@ -73,9 +73,7 @@ int test_enqueue(cl_context context, clCommandQueueWrapper& queue, clKernelWrapp
} }
REGISTER_TEST(queue_hint)
int test_queue_hint(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
{ {
if (num_elements <= 0) if (num_elements <= 0)
{ {
@@ -94,7 +92,7 @@ int test_queue_hint(cl_device_id deviceID, cl_context context, cl_command_queue
return err; return err;
} }
if (is_extension_available(deviceID, "cl_khr_priority_hints")) if (is_extension_available(device, "cl_khr_priority_hints"))
{ {
log_info("Testing cl_khr_priority_hints...\n"); log_info("Testing cl_khr_priority_hints...\n");
@@ -116,7 +114,8 @@ int test_queue_hint(cl_device_id deviceID, cl_context context, cl_command_queue
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
{ {
clCommandQueueWrapper q = clCreateCommandQueueWithProperties(context, deviceID, queue_prop[i], &err); clCommandQueueWrapper q = clCreateCommandQueueWithProperties(
context, device, queue_prop[i], &err);
test_error(err, "clCreateCommandQueueWithProperties failed"); test_error(err, "clCreateCommandQueueWithProperties failed");
err = test_enqueue(context, q, kernel, (size_t)num_elements); err = test_enqueue(context, q, kernel, (size_t)num_elements);
@@ -131,7 +130,7 @@ int test_queue_hint(cl_device_id deviceID, cl_context context, cl_command_queue
log_info("cl_khr_priority_hints is not supported.\n"); log_info("cl_khr_priority_hints is not supported.\n");
} }
if (is_extension_available(deviceID, "cl_khr_throttle_hints")) if (is_extension_available(device, "cl_khr_throttle_hints"))
{ {
log_info("Testing cl_khr_throttle_hints...\n"); log_info("Testing cl_khr_throttle_hints...\n");
cl_queue_properties queue_prop[][3] = cl_queue_properties queue_prop[][3] =
@@ -152,7 +151,8 @@ int test_queue_hint(cl_device_id deviceID, cl_context context, cl_command_queue
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
{ {
clCommandQueueWrapper q = clCreateCommandQueueWithProperties(context, deviceID, queue_prop[i], &err); clCommandQueueWrapper q = clCreateCommandQueueWithProperties(
context, device, queue_prop[i], &err);
test_error(err, "clCreateCommandQueueWithProperties failed"); test_error(err, "clCreateCommandQueueWithProperties failed");
err = test_enqueue(context, q, kernel, (size_t)num_elements); err = test_enqueue(context, q, kernel, (size_t)num_elements);
@@ -170,4 +170,3 @@ int test_queue_hint(cl_device_id deviceID, cl_context context, cl_command_queue
return 0; return 0;
} }

View File

@@ -37,7 +37,10 @@ const char *queue_test_kernel[] = {
"\n" "\n"
"}\n" }; "}\n" };
int enqueue_kernel(cl_context context, const cl_queue_properties_khr *queue_prop_def, cl_device_id deviceID, clKernelWrapper& kernel, size_t num_elements) int enqueue_kernel(cl_context context,
const cl_queue_properties_khr *queue_prop_def,
cl_device_id device, clKernelWrapper &kernel,
size_t num_elements)
{ {
clMemWrapper streams[2]; clMemWrapper streams[2];
int error; int error;
@@ -46,7 +49,8 @@ int enqueue_kernel(cl_context context, const cl_queue_properties_khr *queue_prop
cl_platform_id platform; cl_platform_id platform;
clEventWrapper event; clEventWrapper event;
error = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM, sizeof(cl_platform_id), &platform, NULL); error = clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(cl_platform_id),
&platform, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed"); test_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed");
clCreateCommandQueueWithPropertiesKHR = (clCreateCommandQueueWithPropertiesKHR_fn) clGetExtensionFunctionAddressForPlatform(platform, "clCreateCommandQueueWithPropertiesKHR"); clCreateCommandQueueWithPropertiesKHR = (clCreateCommandQueueWithPropertiesKHR_fn) clGetExtensionFunctionAddressForPlatform(platform, "clCreateCommandQueueWithPropertiesKHR");
@@ -56,7 +60,8 @@ int enqueue_kernel(cl_context context, const cl_queue_properties_khr *queue_prop
return -1; return -1;
} }
clCommandQueueWrapper queue = clCreateCommandQueueWithPropertiesKHR(context, deviceID, queue_prop_def, &error); clCommandQueueWrapper queue = clCreateCommandQueueWithPropertiesKHR(
context, device, queue_prop_def, &error);
test_error(error, "clCreateCommandQueueWithPropertiesKHR failed"); test_error(error, "clCreateCommandQueueWithPropertiesKHR failed");
for (size_t i = 0; i < num_elements; ++i) for (size_t i = 0; i < num_elements; ++i)
@@ -96,7 +101,7 @@ int enqueue_kernel(cl_context context, const cl_queue_properties_khr *queue_prop
return 0; return 0;
} }
int test_queue_properties(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(queue_properties)
{ {
if (num_elements <= 0) if (num_elements <= 0)
{ {
@@ -111,7 +116,7 @@ int test_queue_properties(cl_device_id deviceID, cl_context context, cl_command_
0 }; 0 };
// Query extension // Query extension
if (!is_extension_available(deviceID, "cl_khr_create_command_queue")) if (!is_extension_available(device, "cl_khr_create_command_queue"))
{ {
log_info("extension cl_khr_create_command_queue is not supported.\n"); log_info("extension cl_khr_create_command_queue is not supported.\n");
return 0; return 0;
@@ -121,17 +126,19 @@ int test_queue_properties(cl_device_id deviceID, cl_context context, cl_command_
test_error(error, "create_single_kernel_helper failed"); test_error(error, "create_single_kernel_helper failed");
log_info("Queue property NULL. Testing ... \n"); log_info("Queue property NULL. Testing ... \n");
error = enqueue_kernel(context, NULL,deviceID, kernel, (size_t)num_elements); error = enqueue_kernel(context, NULL, device, kernel, (size_t)num_elements);
test_error(error, "enqueue_kernel failed"); test_error(error, "enqueue_kernel failed");
error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_PROPERTIES, sizeof(device_props), &device_props, NULL); error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_PROPERTIES,
sizeof(device_props), &device_props, NULL);
test_error(error, "clGetDeviceInfo for CL_DEVICE_QUEUE_PROPERTIES failed"); test_error(error, "clGetDeviceInfo for CL_DEVICE_QUEUE_PROPERTIES failed");
if (device_props & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) if (device_props & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)
{ {
log_info("Queue property CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE supported. Testing ... \n"); log_info("Queue property CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE supported. Testing ... \n");
queue_prop_def[1] = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE; queue_prop_def[1] = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
error = enqueue_kernel(context, queue_prop_def, deviceID, kernel, (size_t)num_elements); error = enqueue_kernel(context, queue_prop_def, device, kernel,
(size_t)num_elements);
test_error(error, "enqueue_kernel failed"); test_error(error, "enqueue_kernel failed");
} else } else
{ {
@@ -142,7 +149,8 @@ int test_queue_properties(cl_device_id deviceID, cl_context context, cl_command_
{ {
log_info("Queue property CL_QUEUE_PROFILING_ENABLE supported. Testing ... \n"); log_info("Queue property CL_QUEUE_PROFILING_ENABLE supported. Testing ... \n");
queue_prop_def[1] = CL_QUEUE_PROFILING_ENABLE; queue_prop_def[1] = CL_QUEUE_PROFILING_ENABLE;
error = enqueue_kernel(context, queue_prop_def, deviceID, kernel, (size_t)num_elements); error = enqueue_kernel(context, queue_prop_def, device, kernel,
(size_t)num_elements);
test_error(error, "enqueue_kernel failed"); test_error(error, "enqueue_kernel failed");
} else } else
{ {
@@ -153,7 +161,8 @@ int test_queue_properties(cl_device_id deviceID, cl_context context, cl_command_
{ {
log_info("Queue property CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE & CL_QUEUE_PROFILING_ENABLE supported. Testing ... \n"); log_info("Queue property CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE & CL_QUEUE_PROFILING_ENABLE supported. Testing ... \n");
queue_prop_def[1] = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE|CL_QUEUE_PROFILING_ENABLE; queue_prop_def[1] = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE|CL_QUEUE_PROFILING_ENABLE;
error = enqueue_kernel(context, queue_prop_def, deviceID, kernel, (size_t)num_elements); error = enqueue_kernel(context, queue_prop_def, device, kernel,
(size_t)num_elements);
test_error(error, "enqueue_kernel failed"); test_error(error, "enqueue_kernel failed");
} }
else else

View File

@@ -26,7 +26,7 @@ struct test_queue_array_properties_data
}; };
int verify_if_properties_supported( int verify_if_properties_supported(
cl_device_id deviceID, cl_command_queue_properties requested_bitfield, cl_device_id device, cl_command_queue_properties requested_bitfield,
cl_uint requested_size) cl_uint requested_size)
{ {
int error = CL_SUCCESS; int error = CL_SUCCESS;
@@ -40,7 +40,7 @@ int verify_if_properties_supported(
{ {
cl_uint max_queue_size = 0; cl_uint max_queue_size = 0;
error = error =
clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE, clGetDeviceInfo(device, CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE,
sizeof(max_queue_size), &max_queue_size, NULL); sizeof(max_queue_size), &max_queue_size, NULL);
test_error(error, test_error(error,
"clGetDeviceInfo for " "clGetDeviceInfo for "
@@ -71,7 +71,7 @@ int verify_if_properties_supported(
if (on_host_queue) if (on_host_queue)
{ {
error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES, error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES,
sizeof(supported_properties), sizeof(supported_properties),
&supported_properties, NULL); &supported_properties, NULL);
test_error(error, test_error(error,
@@ -80,7 +80,7 @@ int verify_if_properties_supported(
} }
else else
{ {
error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES, error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES,
sizeof(supported_properties), sizeof(supported_properties),
&supported_properties, NULL); &supported_properties, NULL);
test_error(error, test_error(error,
@@ -107,7 +107,7 @@ int verify_if_properties_supported(
} }
static int create_queue_and_check_array_properties( static int create_queue_and_check_array_properties(
cl_context context, cl_device_id deviceID, cl_context context, cl_device_id device,
test_queue_array_properties_data test_case) test_queue_array_properties_data test_case)
{ {
cl_int error = CL_SUCCESS; cl_int error = CL_SUCCESS;
@@ -117,13 +117,13 @@ static int create_queue_and_check_array_properties(
if (test_case.properties.size() > 0) if (test_case.properties.size() > 0)
{ {
test_queue = clCreateCommandQueueWithProperties( test_queue = clCreateCommandQueueWithProperties(
context, deviceID, test_case.properties.data(), &error); context, device, test_case.properties.data(), &error);
test_error(error, "clCreateCommandQueueWithProperties failed"); test_error(error, "clCreateCommandQueueWithProperties failed");
} }
else else
{ {
test_queue = test_queue =
clCreateCommandQueueWithProperties(context, deviceID, NULL, &error); clCreateCommandQueueWithProperties(context, device, NULL, &error);
test_error(error, "clCreateCommandQueueWithProperties failed"); test_error(error, "clCreateCommandQueueWithProperties failed");
} }
@@ -162,7 +162,7 @@ static int create_queue_and_check_array_properties(
} }
static int static int
run_test_queue_array_properties(cl_context context, cl_device_id deviceID, run_test_queue_array_properties(cl_context context, cl_device_id device,
test_queue_array_properties_data test_case) test_queue_array_properties_data test_case)
{ {
int error = TEST_PASS; int error = TEST_PASS;
@@ -189,7 +189,7 @@ run_test_queue_array_properties(cl_context context, cl_device_id deviceID,
} }
} }
error = verify_if_properties_supported(deviceID, requested_bitfield, error = verify_if_properties_supported(device, requested_bitfield,
requested_size); requested_size);
if (error == TEST_SKIPPED_ITSELF) if (error == TEST_SKIPPED_ITSELF)
{ {
@@ -201,16 +201,14 @@ run_test_queue_array_properties(cl_context context, cl_device_id deviceID,
} }
// continue testing if supported user properties // continue testing if supported user properties
error = error = create_queue_and_check_array_properties(context, device, test_case);
create_queue_and_check_array_properties(context, deviceID, test_case);
test_error(error, "create_queue_and_check_array_properties failed.\n"); test_error(error, "create_queue_and_check_array_properties failed.\n");
log_info("TC result: passed\n"); log_info("TC result: passed\n");
return TEST_PASS; return TEST_PASS;
} }
int test_queue_properties_queries(cl_device_id deviceID, cl_context context, REGISTER_TEST_VERSION(queue_properties_queries, Version(3, 0))
cl_command_queue queue, int num_elements)
{ {
int error = TEST_PASS; int error = TEST_PASS;
std::vector<test_queue_array_properties_data> test_cases; std::vector<test_queue_array_properties_data> test_cases;
@@ -264,13 +262,12 @@ int test_queue_properties_queries(cl_device_id deviceID, cl_context context,
for (auto test_case : test_cases) for (auto test_case : test_cases)
{ {
error |= run_test_queue_array_properties(context, deviceID, test_case); error |= run_test_queue_array_properties(context, device, test_case);
} }
return error; return error;
} }
int test_set_command_queue_property(cl_device_id deviceID, cl_context context, REGISTER_TEST(set_command_queue_property)
cl_command_queue queue, int num_elements)
{ {
int err; int err;
@@ -281,7 +278,7 @@ int test_set_command_queue_property(cl_device_id deviceID, cl_context context,
// Add other supported properties combinations // Add other supported properties combinations
cl_command_queue_properties supported_queue_props; cl_command_queue_properties supported_queue_props;
clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_PROPERTIES, clGetDeviceInfo(device, CL_DEVICE_QUEUE_PROPERTIES,
sizeof(supported_queue_props), &supported_queue_props, sizeof(supported_queue_props), &supported_queue_props,
NULL); NULL);
if (supported_queue_props & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) if (supported_queue_props & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)
@@ -297,7 +294,7 @@ int test_set_command_queue_property(cl_device_id deviceID, cl_context context,
queue_property_options) queue_property_options)
{ {
clCommandQueueWrapper test_queue = clCommandQueueWrapper test_queue =
clCreateCommandQueue(context, deviceID, initial_properties, &err); clCreateCommandQueue(context, device, initial_properties, &err);
test_error(err, "clCreateCommandQueue failed"); test_error(err, "clCreateCommandQueue failed");
cl_command_queue_properties old_properties, set_properties, cl_command_queue_properties old_properties, set_properties,

View File

@@ -30,28 +30,28 @@
log_error( "ERROR: Instance count for test object is not valid! (should be %d, really is %d)\n", rightValue, c ); \ log_error( "ERROR: Instance count for test object is not valid! (should be %d, really is %d)\n", rightValue, c ); \
return -1; } return -1; }
int test_retain_queue_single(cl_device_id deviceID, cl_context context, cl_command_queue queueNotUsed, int num_elements) REGISTER_TEST(retain_queue_single)
{ {
cl_command_queue queue; cl_command_queue cmd_queue;
cl_uint numInstances; cl_uint numInstances;
int err; int err;
/* Create a test queue */ /* Create a test queue */
queue = clCreateCommandQueue( context, deviceID, 0, &err ); cmd_queue = clCreateCommandQueue(context, device, 0, &err);
test_error( err, "Unable to create command queue to test with" ); test_error( err, "Unable to create command queue to test with" );
/* Test the instance count */ /* Test the instance count */
GET_QUEUE_INSTANCE_COUNT( queue ); GET_QUEUE_INSTANCE_COUNT(cmd_queue);
test_error( err, "Unable to get queue instance count" ); test_error( err, "Unable to get queue instance count" );
VERIFY_INSTANCE_COUNT( numInstances, 1 ); VERIFY_INSTANCE_COUNT( numInstances, 1 );
/* Now release the program */ /* Now release the program */
clReleaseCommandQueue( queue ); clReleaseCommandQueue(cmd_queue);
#ifdef VERIFY_AFTER_RELEASE #ifdef VERIFY_AFTER_RELEASE
/* We're not allowed to get the instance count after the object has been completely released. But that's /* We're not allowed to get the instance count after the object has been completely released. But that's
exactly how we can tell the release worked--by making sure getting the instance count fails! */ exactly how we can tell the release worked--by making sure getting the instance count fails! */
GET_QUEUE_INSTANCE_COUNT( queue ); GET_QUEUE_INSTANCE_COUNT(cmd_queue);
if( err != CL_INVALID_COMMAND_QUEUE ) if( err != CL_INVALID_COMMAND_QUEUE )
{ {
print_error( err, "Command queue was not properly released" ); print_error( err, "Command queue was not properly released" );
@@ -62,65 +62,65 @@ int test_retain_queue_single(cl_device_id deviceID, cl_context context, cl_comma
return 0; return 0;
} }
int test_retain_queue_multiple(cl_device_id deviceID, cl_context context, cl_command_queue queueNotUsed, int num_elements) REGISTER_TEST(retain_queue_multiple)
{ {
cl_command_queue queue; cl_command_queue cmd_queue;
unsigned int numInstances, i; unsigned int numInstances, i;
int err; int err;
/* Create a test program */ /* Create a test program */
queue = clCreateCommandQueue( context, deviceID, 0, &err ); cmd_queue = clCreateCommandQueue(context, device, 0, &err);
test_error( err, "Unable to create command queue to test with" ); test_error( err, "Unable to create command queue to test with" );
/* Increment 9 times, which should bring the count to 10 */ /* Increment 9 times, which should bring the count to 10 */
for( i = 0; i < 9; i++ ) for( i = 0; i < 9; i++ )
{ {
clRetainCommandQueue( queue ); clRetainCommandQueue(cmd_queue);
} }
/* Test the instance count */ /* Test the instance count */
GET_QUEUE_INSTANCE_COUNT( queue ); GET_QUEUE_INSTANCE_COUNT(cmd_queue);
test_error( err, "Unable to get queue instance count" ); test_error( err, "Unable to get queue instance count" );
VERIFY_INSTANCE_COUNT( numInstances, 10 ); VERIFY_INSTANCE_COUNT( numInstances, 10 );
/* Now release 5 times, which should take us to 5 */ /* Now release 5 times, which should take us to 5 */
for( i = 0; i < 5; i++ ) for( i = 0; i < 5; i++ )
{ {
clReleaseCommandQueue( queue ); clReleaseCommandQueue(cmd_queue);
} }
GET_QUEUE_INSTANCE_COUNT( queue ); GET_QUEUE_INSTANCE_COUNT(cmd_queue);
test_error( err, "Unable to get queue instance count" ); test_error( err, "Unable to get queue instance count" );
VERIFY_INSTANCE_COUNT( numInstances, 5 ); VERIFY_INSTANCE_COUNT( numInstances, 5 );
/* Retain again three times, which should take us to 8 */ /* Retain again three times, which should take us to 8 */
for( i = 0; i < 3; i++ ) for( i = 0; i < 3; i++ )
{ {
clRetainCommandQueue( queue ); clRetainCommandQueue(cmd_queue);
} }
GET_QUEUE_INSTANCE_COUNT( queue ); GET_QUEUE_INSTANCE_COUNT(cmd_queue);
test_error( err, "Unable to get queue instance count" ); test_error( err, "Unable to get queue instance count" );
VERIFY_INSTANCE_COUNT( numInstances, 8 ); VERIFY_INSTANCE_COUNT( numInstances, 8 );
/* Release 7 times, which should take it to 1 */ /* Release 7 times, which should take it to 1 */
for( i = 0; i < 7; i++ ) for( i = 0; i < 7; i++ )
{ {
clReleaseCommandQueue( queue ); clReleaseCommandQueue(cmd_queue);
} }
GET_QUEUE_INSTANCE_COUNT( queue ); GET_QUEUE_INSTANCE_COUNT(cmd_queue);
test_error( err, "Unable to get queue instance count" ); test_error( err, "Unable to get queue instance count" );
VERIFY_INSTANCE_COUNT( numInstances, 1 ); VERIFY_INSTANCE_COUNT( numInstances, 1 );
/* And one last one */ /* And one last one */
clReleaseCommandQueue( queue ); clReleaseCommandQueue(cmd_queue);
#ifdef VERIFY_AFTER_RELEASE #ifdef VERIFY_AFTER_RELEASE
/* We're not allowed to get the instance count after the object has been completely released. But that's /* We're not allowed to get the instance count after the object has been completely released. But that's
exactly how we can tell the release worked--by making sure getting the instance count fails! */ exactly how we can tell the release worked--by making sure getting the instance count fails! */
GET_QUEUE_INSTANCE_COUNT( queue ); GET_QUEUE_INSTANCE_COUNT(cmd_queue);
if( err != CL_INVALID_COMMAND_QUEUE ) if( err != CL_INVALID_COMMAND_QUEUE )
{ {
print_error( err, "Command queue was not properly released" ); print_error( err, "Command queue was not properly released" );
@@ -131,7 +131,7 @@ int test_retain_queue_multiple(cl_device_id deviceID, cl_context context, cl_com
return 0; return 0;
} }
int test_retain_mem_object_single(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(retain_mem_object_single)
{ {
cl_mem object; cl_mem object;
cl_uint numInstances; cl_uint numInstances;
@@ -163,7 +163,7 @@ int test_retain_mem_object_single(cl_device_id deviceID, cl_context context, cl_
return 0; return 0;
} }
int test_retain_mem_object_multiple(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(retain_mem_object_multiple)
{ {
cl_mem object; cl_mem object;
unsigned int numInstances, i; unsigned int numInstances, i;
@@ -232,7 +232,7 @@ int test_retain_mem_object_multiple(cl_device_id deviceID, cl_context context, c
return 0; return 0;
} }
int test_retain_mem_object_set_kernel_arg(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(retain_mem_object_set_kernel_arg)
{ {
int err; int err;
cl_mem buffer = nullptr; cl_mem buffer = nullptr;

View File

@@ -21,7 +21,7 @@
#include "harness/compat.h" #include "harness/compat.h"
int test_release_kernel_order(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(release_kernel_order)
{ {
cl_program program; cl_program program;
cl_kernel kernel; cl_kernel kernel;
@@ -50,7 +50,7 @@ const char *sample_delay_kernel[] = {
"\n" "\n"
"}\n" }; "}\n" };
int test_release_during_execute( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST(release_during_execute)
{ {
int error; int error;
cl_program program; cl_program program;
@@ -100,5 +100,3 @@ int test_release_during_execute( cl_device_id deviceID, cl_context context, cl_c
return 0; return 0;
} }

View File

@@ -54,7 +54,7 @@ cl_int get_sub_group_num(cl_command_queue queue, cl_kernel kernel, clMemWrapper&
return error; return error;
} }
int test_sub_group_dispatch(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST_VERSION(sub_group_dispatch, Version(2, 1))
{ {
int error; int error;
size_t realSize; size_t realSize;
@@ -73,12 +73,12 @@ int test_sub_group_dispatch(cl_device_id deviceID, cl_context context, cl_comman
size_t ret_ndrange2d_flattened; size_t ret_ndrange2d_flattened;
size_t ret_ndrange3d_flattened; size_t ret_ndrange3d_flattened;
if (get_device_cl_version(deviceID) >= Version(3, 0)) if (get_device_cl_version(device) >= Version(3, 0))
{ {
int error; int error;
cl_uint max_num_sub_groups; cl_uint max_num_sub_groups;
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_NUM_SUB_GROUPS, error = clGetDeviceInfo(device, CL_DEVICE_MAX_NUM_SUB_GROUPS,
sizeof(max_num_sub_groups), &max_num_sub_groups, sizeof(max_num_sub_groups), &max_num_sub_groups,
NULL); NULL);
if (error != CL_SUCCESS) if (error != CL_SUCCESS)
@@ -102,16 +102,20 @@ int test_sub_group_dispatch(cl_device_id deviceID, cl_context context, cl_comman
out = clCreateBuffer(context, CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR, sizeof(size_t), NULL, &error); out = clCreateBuffer(context, CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR, sizeof(size_t), NULL, &error);
test_error(error, "clCreateBuffer failed"); test_error(error, "clCreateBuffer failed");
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(size_t), &max_local, NULL); error = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_GROUP_SIZE,
sizeof(size_t), &max_local, NULL);
test_error(error, "clGetDeviceInfo failed"); test_error(error, "clGetDeviceInfo failed");
error = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM, sizeof(platform), (void *)&platform, NULL); error = clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(platform),
(void *)&platform, NULL);
test_error(error, "clDeviceInfo failed for CL_DEVICE_PLATFORM"); test_error(error, "clDeviceInfo failed for CL_DEVICE_PLATFORM");
// Get the max subgroup size // Get the max subgroup size
error = clGetKernelSubGroupInfo(kernel, deviceID, CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE, error = clGetKernelSubGroupInfo(
sizeof(max_local), &max_local, sizeof(kernel_max_subgroup_size), (void *)&kernel_max_subgroup_size, &realSize); kernel, device, CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE,
sizeof(max_local), &max_local, sizeof(kernel_max_subgroup_size),
(void *)&kernel_max_subgroup_size, &realSize);
test_error(error, "clGetKernelSubGroupInfo failed for CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE"); test_error(error, "clGetKernelSubGroupInfo failed for CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE");
log_info("The CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE for the kernel is %d.\n", (int)kernel_max_subgroup_size); log_info("The CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE for the kernel is %d.\n", (int)kernel_max_subgroup_size);
@@ -121,8 +125,10 @@ int test_sub_group_dispatch(cl_device_id deviceID, cl_context context, cl_comman
} }
// Get the number of subgroup for max local size // Get the number of subgroup for max local size
error = clGetKernelSubGroupInfo(kernel, deviceID, CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE, error = clGetKernelSubGroupInfo(
sizeof(max_local), &max_local, sizeof(kernel_subgroup_count), (void *)&kernel_subgroup_count, &realSize); kernel, device, CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE,
sizeof(max_local), &max_local, sizeof(kernel_subgroup_count),
(void *)&kernel_subgroup_count, &realSize);
test_error(error, "clGetKernelSubGroupInfo failed for CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE"); test_error(error, "clGetKernelSubGroupInfo failed for CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE");
log_info("The CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE for the kernel is %d.\n", (int)kernel_subgroup_count); log_info("The CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE for the kernel is %d.\n", (int)kernel_subgroup_count);
@@ -138,7 +144,9 @@ int test_sub_group_dispatch(cl_device_id deviceID, cl_context context, cl_comman
{ {
// test all 3 different dimention of requested local size // test all 3 different dimention of requested local size
size_t kernel_ret_size = 0; size_t kernel_ret_size = 0;
error = clGetKernelSubGroupInfo(kernel, deviceID, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT, sizeof(i), &i, sizeof(ret_ndrange1d), &ret_ndrange1d, &realSize); error = clGetKernelSubGroupInfo(
kernel, device, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT, sizeof(i),
&i, sizeof(ret_ndrange1d), &ret_ndrange1d, &realSize);
test_error(error, "clGetKernelSubGroupInfo failed for CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT"); test_error(error, "clGetKernelSubGroupInfo failed for CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT");
if (realSize != sizeof(ret_ndrange1d)) { if (realSize != sizeof(ret_ndrange1d)) {
log_error( "ERROR: Returned size of sub group count not valid! (Expected %d, got %d)\n", (int)sizeof(kernel_subgroup_count), (int)realSize ); log_error( "ERROR: Returned size of sub group count not valid! (Expected %d, got %d)\n", (int)sizeof(kernel_subgroup_count), (int)realSize );
@@ -153,7 +161,9 @@ int test_sub_group_dispatch(cl_device_id deviceID, cl_context context, cl_comman
return -1; return -1;
} }
error = clGetKernelSubGroupInfo(kernel, deviceID, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT, sizeof(i), &i, sizeof(ret_ndrange2d), ret_ndrange2d, &realSize); error = clGetKernelSubGroupInfo(
kernel, device, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT, sizeof(i),
&i, sizeof(ret_ndrange2d), ret_ndrange2d, &realSize);
test_error(error, "clGetKernelSubGroupInfo failed for CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT"); test_error(error, "clGetKernelSubGroupInfo failed for CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT");
if (realSize != sizeof(ret_ndrange2d)) { if (realSize != sizeof(ret_ndrange2d)) {
log_error( "ERROR: Returned size of sub group count not valid! (Expected %d, got %d)\n", (int)sizeof(kernel_subgroup_count), (int)realSize ); log_error( "ERROR: Returned size of sub group count not valid! (Expected %d, got %d)\n", (int)sizeof(kernel_subgroup_count), (int)realSize );
@@ -170,7 +180,9 @@ int test_sub_group_dispatch(cl_device_id deviceID, cl_context context, cl_comman
return -1; return -1;
} }
error = clGetKernelSubGroupInfo(kernel, deviceID, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT, sizeof(i), &i, sizeof(ret_ndrange3d), ret_ndrange3d, &realSize); error = clGetKernelSubGroupInfo(
kernel, device, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT, sizeof(i),
&i, sizeof(ret_ndrange3d), ret_ndrange3d, &realSize);
test_error(error, "clGetKernelSubGroupInfo failed for CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT"); test_error(error, "clGetKernelSubGroupInfo failed for CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT");
if (realSize != sizeof(ret_ndrange3d)) { if (realSize != sizeof(ret_ndrange3d)) {
log_error( "ERROR: Returned size of sub group count not valid! (Expected %d, got %d)\n", (int)sizeof(kernel_subgroup_count), (int)realSize ); log_error( "ERROR: Returned size of sub group count not valid! (Expected %d, got %d)\n", (int)sizeof(kernel_subgroup_count), (int)realSize );
@@ -191,16 +203,26 @@ int test_sub_group_dispatch(cl_device_id deviceID, cl_context context, cl_comman
// test when input subgroup count exceeds max wg size: // test when input subgroup count exceeds max wg size:
// there can be at most the local size of (1 WI) subgroups // there can be at most the local size of (1 WI) subgroups
size_t large_sg_size = max_local + 1; size_t large_sg_size = max_local + 1;
error = clGetKernelSubGroupInfo(kernel, deviceID, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT, sizeof(size_t), &large_sg_size, sizeof(ret_ndrange1d), &ret_ndrange1d, &realSize); error = clGetKernelSubGroupInfo(
test_error(error, "clGetKernelSubGroupInfo failed for CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT"); kernel, device, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT,
sizeof(size_t), &large_sg_size, sizeof(ret_ndrange1d), &ret_ndrange1d,
&realSize);
test_error(error,
"clGetKernelSubGroupInfo failed for "
"CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT");
if (ret_ndrange1d != 0) if (ret_ndrange1d != 0)
{ {
log_error( "ERROR: Incorrect value returned for CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT! (Expected %d, got %d)\n", 0, (int)ret_ndrange1d ); log_error( "ERROR: Incorrect value returned for CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT! (Expected %d, got %d)\n", 0, (int)ret_ndrange1d );
return -1; return -1;
} }
error = clGetKernelSubGroupInfo(kernel, deviceID, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT, sizeof(size_t), &large_sg_size, sizeof(ret_ndrange2d), ret_ndrange2d, &realSize); error = clGetKernelSubGroupInfo(
test_error(error, "clGetKernelSubGroupInfo failed for CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT"); kernel, device, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT,
sizeof(size_t), &large_sg_size, sizeof(ret_ndrange2d), ret_ndrange2d,
&realSize);
test_error(error,
"clGetKernelSubGroupInfo failed for "
"CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT");
if (ret_ndrange2d[0] != 0 || if (ret_ndrange2d[0] != 0 ||
ret_ndrange2d[1] != 0) ret_ndrange2d[1] != 0)
{ {
@@ -208,8 +230,13 @@ int test_sub_group_dispatch(cl_device_id deviceID, cl_context context, cl_comman
return -1; return -1;
} }
error = clGetKernelSubGroupInfo(kernel, deviceID, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT, sizeof(size_t), &large_sg_size, sizeof(ret_ndrange3d), ret_ndrange3d, &realSize); error = clGetKernelSubGroupInfo(
test_error(error, "clGetKernelSubGroupInfo failed for CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT"); kernel, device, CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT,
sizeof(size_t), &large_sg_size, sizeof(ret_ndrange3d), ret_ndrange3d,
&realSize);
test_error(error,
"clGetKernelSubGroupInfo failed for "
"CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT");
if (ret_ndrange3d[0] != 0 || if (ret_ndrange3d[0] != 0 ||
ret_ndrange3d[1] != 0 || ret_ndrange3d[1] != 0 ||
ret_ndrange3d[2] != 0) ret_ndrange3d[2] != 0)

View File

@@ -14,6 +14,7 @@
// limitations under the License. // limitations under the License.
// //
#include "harness/compat.h" #include "harness/compat.h"
#include "harness/typeWrappers.h"
#include <stdio.h> #include <stdio.h>
#include <iostream> #include <iostream>
@@ -21,7 +22,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "procs.h"
#include <CL/cl_ext.h> #include <CL/cl_ext.h>
const char* wg_scan_local_work_group_size = R"( const char* wg_scan_local_work_group_size = R"(
@@ -276,9 +277,7 @@ int do_test_work_group_suggested_local_size(
return err; return err;
} }
int test_work_group_suggested_local_size_1D(cl_device_id device, REGISTER_TEST(work_group_suggested_local_size_1D)
cl_context context,
cl_command_queue queue, int n_elems)
{ {
if (!is_extension_available(device, "cl_khr_suggested_local_work_size")) if (!is_extension_available(device, "cl_khr_suggested_local_work_size"))
{ {
@@ -380,9 +379,7 @@ int test_work_group_suggested_local_size_1D(cl_device_id device,
return err; return err;
} }
int test_work_group_suggested_local_size_2D(cl_device_id device, REGISTER_TEST(work_group_suggested_local_size_2D)
cl_context context,
cl_command_queue queue, int n_elems)
{ {
if (!is_extension_available(device, "cl_khr_suggested_local_work_size")) if (!is_extension_available(device, "cl_khr_suggested_local_work_size"))
{ {
@@ -485,9 +482,7 @@ int test_work_group_suggested_local_size_2D(cl_device_id device,
return err; return err;
} }
int test_work_group_suggested_local_size_3D(cl_device_id device, REGISTER_TEST(work_group_suggested_local_size_3D)
cl_context context,
cl_command_queue queue, int n_elems)
{ {
if (!is_extension_available(device, "cl_khr_suggested_local_work_size")) if (!is_extension_available(device, "cl_khr_suggested_local_work_size"))
{ {

View File

@@ -58,7 +58,8 @@ cl_int test_zero_sized_enqueue_and_test_output_buffer(cl_command_queue queue, cl
return clEnqueueUnmapMemObject(queue, buf, output, 0, NULL, NULL); return clEnqueueUnmapMemObject(queue, buf, output, 0, NULL, NULL);
} }
int test_zero_sized_enqueue_helper(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) int test_zero_sized_enqueue_helper(cl_device_id device, cl_context context,
cl_command_queue queue, int num_elements)
{ {
int error; int error;
clProgramWrapper program; clProgramWrapper program;
@@ -185,9 +186,10 @@ int test_zero_sized_enqueue_helper(cl_device_id deviceID, cl_context context, cl
} }
int test_zero_sized_enqueue(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) REGISTER_TEST_VERSION(zero_sized_enqueue, Version(2, 1))
{ {
int res = test_zero_sized_enqueue_helper(deviceID, context, queue, num_elements); int res =
test_zero_sized_enqueue_helper(device, context, queue, num_elements);
if (res != 0) if (res != 0)
{ {
return res; return res;
@@ -195,7 +197,9 @@ int test_zero_sized_enqueue(cl_device_id deviceID, cl_context context, cl_comman
// now test out of order queue // now test out of order queue
cl_command_queue_properties props; cl_command_queue_properties props;
cl_int error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_PROPERTIES, sizeof(cl_command_queue_properties), &props, NULL); cl_int error =
clGetDeviceInfo(device, CL_DEVICE_QUEUE_PROPERTIES,
sizeof(cl_command_queue_properties), &props, NULL);
test_error( error, "clGetDeviceInfo failed."); test_error( error, "clGetDeviceInfo failed.");
if (props & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) if (props & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)
@@ -207,10 +211,12 @@ int test_zero_sized_enqueue(cl_device_id deviceID, cl_context context, cl_comman
0 0
}; };
clCommandQueueWrapper ooqueue = clCreateCommandQueueWithProperties(context, deviceID, queue_prop_def, &error); clCommandQueueWrapper ooqueue = clCreateCommandQueueWithProperties(
context, device, queue_prop_def, &error);
test_error( error, "clCreateCommandQueueWithProperties failed."); test_error( error, "clCreateCommandQueueWithProperties failed.");
res = test_zero_sized_enqueue_helper(deviceID, context, ooqueue, num_elements); res = test_zero_sized_enqueue_helper(device, context, ooqueue,
num_elements);
} }
return res; return res;