From e0750268193f4d6bd01b77b46693756e3344878b Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Tue, 1 Sep 2020 02:16:18 -0700 Subject: [PATCH] test CL_QUEUE_ARRAY_PROPERTIES query (#925) * OpenCL 3.0 test CL_QUEUE_PROPERTIES_ARRAY * add verification if requested_size <= CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE * remove test_case - set NULL properties, get not empty array with 0 terminator * add printing test_case description * change logic of checking if requested properties are supported by device depending on host/device type queue. * fix a few bugs, rename test for consistency * add utility function for comparing properties Co-authored-by: Grzegorz Wawiorko --- test_common/CMakeLists.txt | 1 + test_common/harness/errorHelpers.cpp | 13 + test_common/harness/errorHelpers.h | 1 + test_common/harness/propertyHelpers.cpp | 126 ++++++++ test_common/harness/propertyHelpers.h | 27 ++ test_conformance/api/CMakeLists.txt | 1 + test_conformance/api/main.cpp | 2 + test_conformance/api/procs.h | 4 + .../test_mem_object_properties_queries.cpp | 102 ++----- test_conformance/api/test_queries.cpp | 75 ++--- .../api/test_queue_properties_queries.cpp | 269 ++++++++++++++++++ 11 files changed, 495 insertions(+), 126 deletions(-) create mode 100644 test_common/harness/propertyHelpers.cpp create mode 100644 test_common/harness/propertyHelpers.h create mode 100644 test_conformance/api/test_queue_properties_queries.cpp diff --git a/test_common/CMakeLists.txt b/test_common/CMakeLists.txt index e890a673..1dffd379 100644 --- a/test_common/CMakeLists.txt +++ b/test_common/CMakeLists.txt @@ -14,6 +14,7 @@ set(HARNESS_SOURCES harness/deviceInfo.cpp harness/os_helpers.cpp harness/parseParameters.cpp + harness/propertyHelpers.cpp harness/testHarness.cpp harness/ThreadPool.cpp miniz/miniz.c diff --git a/test_common/harness/errorHelpers.cpp b/test_common/harness/errorHelpers.cpp index f6177e11..5cd87171 100644 --- a/test_common/harness/errorHelpers.cpp +++ b/test_common/harness/errorHelpers.cpp @@ -278,6 +278,19 @@ const char *GetDataVectorString( void *dataBuffer, size_t typeSize, size_t vecSi return buffer; } +const char *GetQueuePropertyName(cl_command_queue_properties property) +{ + switch (property) + { + case CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE: + return "CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE"; + case CL_QUEUE_PROFILING_ENABLE: return "CL_QUEUE_PROFILING_ENABLE"; + case CL_QUEUE_ON_DEVICE: return "CL_QUEUE_ON_DEVICE"; + case CL_QUEUE_ON_DEVICE_DEFAULT: return "CL_QUEUE_ON_DEVICE_DEFAULT"; + default: return "(unknown)"; + } +} + #ifndef MAX #define MAX( _a, _b ) ((_a) > (_b) ? (_a) : (_b)) #endif diff --git a/test_common/harness/errorHelpers.h b/test_common/harness/errorHelpers.h index c315b391..53b74bf8 100644 --- a/test_common/harness/errorHelpers.h +++ b/test_common/harness/errorHelpers.h @@ -106,6 +106,7 @@ extern int IsChannelTypeSupported( cl_channel_type type ); extern const char *GetChannelOrderName( cl_channel_order order ); extern int IsChannelOrderSupported( cl_channel_order order ); extern const char *GetAddressModeName( cl_addressing_mode mode ); +extern const char *GetQueuePropertyName(cl_command_queue_properties properties); extern const char *GetDeviceTypeName( cl_device_type type ); int check_functions_for_offline_compiler(const char *subtestname, cl_device_id device); diff --git a/test_common/harness/propertyHelpers.cpp b/test_common/harness/propertyHelpers.cpp new file mode 100644 index 00000000..3157ca80 --- /dev/null +++ b/test_common/harness/propertyHelpers.cpp @@ -0,0 +1,126 @@ +// +// Copyright (c) 2020 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 "propertyHelpers.h" +#include "errorHelpers.h" + +#include + +#include +#include + +static bool findProperty(const std::vector& props, + cl_properties prop, cl_properties& value) +{ + // This function assumes properties are valid: + assert(props.size() == 0 || props.back() == 0); + assert(props.size() == 0 || props.size() % 2 == 1); + + for (cl_uint i = 0; i < props.size(); i = i + 2) + { + cl_properties check_prop = props[i]; + + if (check_prop == 0) + { + break; + } + + if (check_prop == prop) + { + value = props[i + 1]; + return true; + } + } + + return false; +} + +int compareProperties(const std::vector& queried, + const std::vector& check) +{ + if (queried.size() != 0) + { + if (queried.back() != 0) + { + log_error("ERROR: queried properties do not end with 0!\n"); + return TEST_FAIL; + } + if (queried.size() % 2 != 1) + { + log_error("ERROR: queried properties does not consist of " + "property-value pairs!\n"); + return TEST_FAIL; + } + } + if (check.size() != 0) + { + if (check.back() != 0) + { + log_error("ERROR: check properties do not end with 0!\n"); + return TEST_FAIL; + } + if (check.size() % 2 != 1) + { + log_error("ERROR: check properties does not consist of " + "property-value pairs!\n"); + return TEST_FAIL; + } + } + + if (queried != check) + { + for (cl_uint i = 0; i < check.size(); i = i + 2) + { + cl_properties check_prop = check[i]; + + if (check_prop == 0) + { + break; + } + + cl_properties check_value = check[i + 1]; + cl_properties queried_value = 0; + + bool found = findProperty(queried, check_prop, queried_value); + + if (!found) + { + log_error("ERROR: expected property 0x%x not found!\n", + check_prop); + return TEST_FAIL; + } + else if (check_value != queried_value) + { + log_error("ERROR: mis-matched value for property 0x%x: wanted " + "0x%x, got 0x%x\n", + check_prop, check_value, queried_value); + return TEST_FAIL; + } + } + + if (queried.size() > check.size()) + { + log_error("ERROR: all properties found but there are extra " + "properties: expected %d, got %d.\n", + check.size(), queried.size()); + return TEST_FAIL; + } + + log_error("ERROR: properties were returned in the wrong order.\n"); + return TEST_FAIL; + } + + return TEST_PASS; +} diff --git a/test_common/harness/propertyHelpers.h b/test_common/harness/propertyHelpers.h new file mode 100644 index 00000000..68d16f6d --- /dev/null +++ b/test_common/harness/propertyHelpers.h @@ -0,0 +1,27 @@ +// +// Copyright (c) 2020 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#ifndef _propertyHelpers_h +#define _propertyHelpers_h + +#include "compat.h" +#include "testHarness.h" + +#include + +int compareProperties(const std::vector& queried, + const std::vector& check); + +#endif // _propertyHelpers_h diff --git a/test_conformance/api/CMakeLists.txt b/test_conformance/api/CMakeLists.txt index b92a3dab..4d44f959 100644 --- a/test_conformance/api/CMakeLists.txt +++ b/test_conformance/api/CMakeLists.txt @@ -30,6 +30,7 @@ set(${MODULE_NAME}_SOURCES test_zero_sized_enqueue.cpp test_context_destructor_callback.cpp test_mem_object_properties_queries.cpp + test_queue_properties_queries.cpp ) include(../CMakeCommon.txt) diff --git a/test_conformance/api/main.cpp b/test_conformance/api/main.cpp index e41f63d9..5fc5db4c 100644 --- a/test_conformance/api/main.cpp +++ b/test_conformance/api/main.cpp @@ -122,8 +122,10 @@ test_definition test_list[] = { 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(consistency_svm, Version(3, 0)), ADD_TEST_VERSION(consistency_memory_model, Version(3, 0)), diff --git a/test_conformance/api/procs.h b/test_conformance/api/procs.h index 3b59dd13..73b96eea 100644 --- a/test_conformance/api/procs.h +++ b/test_conformance/api/procs.h @@ -129,6 +129,10 @@ 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); extern int test_consistency_svm(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); diff --git a/test_conformance/api/test_mem_object_properties_queries.cpp b/test_conformance/api/test_mem_object_properties_queries.cpp index 09ccb475..a6ed7ad1 100644 --- a/test_conformance/api/test_mem_object_properties_queries.cpp +++ b/test_conformance/api/test_mem_object_properties_queries.cpp @@ -13,8 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. // - #include "testBase.h" +#include "harness/propertyHelpers.h" #include "harness/typeWrappers.h" #include #include @@ -34,16 +34,14 @@ struct test_data std::string kernel_name; }; -int create_object_and_check_properties(cl_context context, - clMemWrapper& test_object, - test_data test_case, cl_mem_flags flags, - std::vector local_data, - cl_uint size_x, cl_uint size_y) +static int create_object_and_check_properties(cl_context context, + clMemWrapper& test_object, + test_data test_case, + cl_mem_flags flags, + std::vector local_data, + cl_uint size_x, cl_uint size_y) { - int error = CL_SUCCESS; - size_t set_size; - std::vector object_properties_check; - + cl_int error = CL_SUCCESS; if (test_case.obj_t == image) { @@ -87,80 +85,40 @@ int create_object_and_check_properties(cl_context context, test_error(error, "clCreateBufferWithProperties failed."); } - clGetMemObjectInfo(test_object, CL_MEM_PROPERTIES, 0, NULL, &set_size); + + std::vector check_properties; + size_t set_size = 0; + + error = + clGetMemObjectInfo(test_object, CL_MEM_PROPERTIES, 0, NULL, &set_size); test_error(error, - "clGetMemObjectInfo failed asking for CL_MEM_PROPERTIES."); + "clGetMemObjectInfo failed asking for CL_MEM_PROPERTIES size."); - // verify set_size 0 returned - if (set_size == 0) - { - if (test_case.properties.size() == 0) - { - return TEST_PASS; - } - else - { - log_error("ERROR: Expected non-zero size!\n"); - return TEST_FAIL; - } - } - - cl_uint number_of_props = set_size / sizeof(cl_mem_properties); - object_properties_check.resize(number_of_props); - clGetMemObjectInfo(test_object, CL_MEM_PROPERTIES, set_size, - object_properties_check.data(), NULL); - test_error(error, - "clGetMemObjectInfo failed asking for CL_MEM_PROPERTIES."); - - // check list with 0 terminator is returned - if (object_properties_check.size() == 1 && object_properties_check[0] == 0 - && test_case.properties.size() == 0) + if (set_size == 0 && test_case.properties.size() == 0) { return TEST_PASS; } - if (object_properties_check.back() != 0) + if (set_size != test_case.properties.size() * sizeof(cl_mem_properties)) { - log_error("ERROR: Incorrect last properties value - should be 0!\n"); - return TEST_FAIL; - } - object_properties_check.pop_back(); - test_case.properties.pop_back(); - if (object_properties_check != test_case.properties) - { - for (cl_uint i = 0; i < test_case.properties.size(); i = i + 2) - { - cl_mem_properties set_property = test_case.properties[i]; - cl_mem_properties set_property_value = test_case.properties[i + 1]; - std::vector::iterator it = - std::find(object_properties_check.begin(), - object_properties_check.end(), set_property); - - if (it == object_properties_check.end()) - { - log_error("ERROR: Property not found ... 0x%x\n", set_property); - return TEST_FAIL; - } - else - { - if (set_property_value != *std::next(it)) - { - log_error("ERROR: Incorrect preperty value expected %x, " - "obtained %x\n", - set_property_value, *std::next(it)); - return TEST_FAIL; - } - } - } - log_error( - "ERROR: ALL properties and values matched but order incorrect!\n"); + log_error("ERROR: CL_MEM_PROPERTIES size is %d, expected %d.\n", + set_size, + test_case.properties.size() * sizeof(cl_queue_properties)); return TEST_FAIL; } + cl_uint number_of_props = set_size / sizeof(cl_mem_properties); + check_properties.resize(number_of_props); + error = clGetMemObjectInfo(test_object, CL_MEM_PROPERTIES, set_size, + check_properties.data(), NULL); + test_error(error, + "clGetMemObjectInfo failed asking for CL_MEM_PROPERTIES."); + + error = compareProperties(check_properties, test_case.properties); return error; } -int run_test_query_properties(cl_context context, cl_command_queue queue, - test_data test_case) +static int run_test_query_properties(cl_context context, cl_command_queue queue, + test_data test_case) { int error = CL_SUCCESS; log_info("\nTC description: %s\n", test_case.description.c_str()); diff --git a/test_conformance/api/test_queries.cpp b/test_conformance/api/test_queries.cpp index 3aa0b7ea..ed01e894 100644 --- a/test_conformance/api/test_queries.cpp +++ b/test_conformance/api/test_queries.cpp @@ -15,6 +15,7 @@ // #include "testBase.h" #include "harness/imageHelpers.h" +#include "harness/propertyHelpers.h" #include #include #include @@ -213,70 +214,35 @@ int test_get_sampler_info(cl_device_id deviceID, cl_context context, cl_command_ Version version = get_device_cl_version(deviceID); if (version >= Version(3, 0)) { - std::vector get_properties; - std::vector set_properties( + std::vector test_properties( properties, properties + ARRAY_SIZE(properties)); + + std::vector check_properties; size_t set_size; - cl_uint number_of_props = 0; error = clGetSamplerInfo(sampler, CL_SAMPLER_PROPERTIES, 0, NULL, &set_size); - test_error(error, "clGetSamplerInfo failed."); + test_error( + error, + "clGetSamplerInfo failed asking for CL_SAMPLER_PROPERTIES size."); - if (set_size != set_properties.size() * sizeof(cl_sampler_properties)) + if (set_size != test_properties.size() * sizeof(cl_sampler_properties)) { - test_error(error, - "Incorrect size of CL_SAMPLER_PROPERTIES returned by " - "clGetSamplerInfo"); + log_error("ERROR: CL_SAMPLER_PROPERTIES size is %d, expected %d.\n", + set_size, + test_properties.size() * sizeof(cl_sampler_properties)); + return TEST_FAIL; } - number_of_props = set_size / sizeof(cl_sampler_properties); - get_properties.resize(number_of_props); + cl_uint number_of_props = set_size / sizeof(cl_sampler_properties); + check_properties.resize(number_of_props); error = clGetSamplerInfo(sampler, CL_SAMPLER_PROPERTIES, set_size, - get_properties.data(), 0); - test_error(error, "clGetSamplerInfo failed."); + check_properties.data(), 0); + test_error(error, + "clGetSamplerInfo failed asking for CL_SAMPLER_PROPERTIES."); - if (get_properties.back() != 0) - { - log_error( - "ERROR: Incorrect last properties value - should be 0!\n"); - return TEST_FAIL; - } - get_properties.pop_back(); - set_properties.pop_back(); - if (set_properties != get_properties) - { - for (cl_uint i = 0; i < set_properties.size(); i = i + 2) - { - cl_sampler_properties set_property = set_properties[i]; - cl_sampler_properties set_property_value = - set_properties[i + 1]; - - std::vector::iterator it = std::find( - get_properties.begin(), get_properties.end(), set_property); - - if (it == get_properties.end()) - { - log_error("ERROR: Property name not found ... 0x%x\n", - set_property); - return TEST_FAIL; - } - else - { - if (set_property_value != *std::next(it)) - { - log_error( - "ERROR: Incorrect preperty value expected 0x%x, " - "obtained 0x%x\n", - set_property_value, *std::next(it)); - return TEST_FAIL; - } - } - } - log_error("ERROR: ALL properties and values matched but order " - "incorrect!\n"); - return TEST_FAIL; - } + error = compareProperties(check_properties, test_properties); + test_error(error, "checkProperties mismatch."); } return 0; @@ -470,7 +436,8 @@ int test_get_device_info(cl_device_id deviceID, cl_context context, cl_command_q // extensions can support double but may not support cl_khr_fp64, which implies math library support. cl_uint baseAddrAlign; - TEST_DEVICE_PARAM( deviceID, CL_DEVICE_MEM_BASE_ADDR_ALIGN, baseAddrAlign, "base address alignment", "%d bits", int ) + TEST_DEVICE_PARAM(deviceID, CL_DEVICE_MEM_BASE_ADDR_ALIGN, baseAddrAlign, + "base address alignment", "%d bits", int) cl_uint maxDataAlign; TEST_DEVICE_PARAM( deviceID, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, maxDataAlign, "min data type alignment", "%d bytes", int ) diff --git a/test_conformance/api/test_queue_properties_queries.cpp b/test_conformance/api/test_queue_properties_queries.cpp new file mode 100644 index 00000000..843fa845 --- /dev/null +++ b/test_conformance/api/test_queue_properties_queries.cpp @@ -0,0 +1,269 @@ +// +// Copyright (c) 2020 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 "testBase.h" +#include "harness/propertyHelpers.h" +#include "harness/typeWrappers.h" +#include +#include + +struct test_queue_array_properties_data +{ + std::vector properties; + std::string description; +}; + +int verify_if_properties_supported( + cl_device_id deviceID, cl_command_queue_properties requested_bitfield, + cl_uint requested_size) +{ + int error = CL_SUCCESS; + bool on_host_queue = true; + + if (requested_bitfield & CL_QUEUE_ON_DEVICE) + { + on_host_queue = false; + + if (requested_size > 0) + { + cl_uint max_queue_size = 0; + error = + clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE, + sizeof(max_queue_size), &max_queue_size, NULL); + test_error(error, + "clGetDeviceInfo for " + "CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE failed"); + if (requested_size > max_queue_size) + { + log_info( + "The value of CL_QUEUE_SIZE = %d cannot be bigger than " + "CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE = %d, skipped\n", + requested_size, max_queue_size); + return TEST_SKIPPED_ITSELF; + } + } + } + + cl_command_queue_properties supported_properties = 0; + cl_command_queue_properties all_properties = 0; + + std::vector all_properties_vector{ + CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, CL_QUEUE_PROFILING_ENABLE + }; + for (auto each_property : all_properties_vector) + { + all_properties |= each_property; + } + cl_command_queue_properties requested_properties = + all_properties & requested_bitfield; + + if (on_host_queue) + { + error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES, + sizeof(supported_properties), + &supported_properties, NULL); + test_error(error, + "clGetDeviceInfo asking for " + "CL_DEVICE_QUEUE_ON_HOST_PROPERTIES failed"); + } + else + { + error = clGetDeviceInfo(deviceID, CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES, + sizeof(supported_properties), + &supported_properties, NULL); + test_error(error, + "clGetDeviceInfo asking for " + "CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES failed"); + } + + for (auto each_property : all_properties_vector) + { + if ((each_property & requested_properties) + && !(each_property & supported_properties)) + { + log_info("\t%s not supported, skipped\n", + GetQueuePropertyName(each_property)); + return TEST_SKIPPED_ITSELF; + } + else if ((each_property & requested_properties) + && each_property & supported_properties) + { + log_info("\t%s supported\n", GetQueuePropertyName(each_property)); + } + } + return error; +} + +static int create_queue_and_check_array_properties( + cl_context context, cl_device_id deviceID, + test_queue_array_properties_data test_case) +{ + cl_int error = CL_SUCCESS; + + clCommandQueueWrapper test_queue; + + if (test_case.properties.size() > 0) + { + test_queue = clCreateCommandQueueWithProperties( + context, deviceID, test_case.properties.data(), &error); + test_error(error, "clCreateCommandQueueWithProperties failed"); + } + else + { + test_queue = + clCreateCommandQueueWithProperties(context, deviceID, NULL, &error); + test_error(error, "clCreateCommandQueueWithProperties failed"); + } + + std::vector check_properties; + size_t set_size = 0; + + error = clGetCommandQueueInfo(test_queue, CL_QUEUE_PROPERTIES_ARRAY, 0, + NULL, &set_size); + test_error(error, + "clGetCommandQueueInfo failed asking for " + "CL_QUEUE_PROPERTIES_ARRAY size."); + + if (set_size == 0 && test_case.properties.size() == 0) + { + return TEST_PASS; + } + if (set_size != test_case.properties.size() * sizeof(cl_queue_properties)) + { + log_error("ERROR: CL_QUEUE_PROPERTIES_ARRAY size is %d, expected %d.\n", + set_size, + test_case.properties.size() * sizeof(cl_queue_properties)); + return TEST_FAIL; + } + + cl_uint number_of_props = set_size / sizeof(cl_queue_properties); + check_properties.resize(number_of_props); + error = clGetCommandQueueInfo(test_queue, CL_QUEUE_PROPERTIES_ARRAY, + set_size, check_properties.data(), NULL); + test_error( + error, + "clGetCommandQueueInfo failed asking for CL_QUEUE_PROPERTIES_ARRAY."); + + error = compareProperties(check_properties, test_case.properties); + return error; +} + +static int +run_test_queue_array_properties(cl_context context, cl_device_id deviceID, + test_queue_array_properties_data test_case) +{ + int error = TEST_PASS; + + std::vector requested_properties = + test_case.properties; + log_info("\nTC description: %s\n", test_case.description.c_str()); + + // first verify if user properties are supported + if (requested_properties.size() != 0) + { + requested_properties.pop_back(); + cl_command_queue_properties requested_bitfield = 0; + cl_uint requested_size = 0; + for (cl_uint i = 0; i < requested_properties.size(); i = i + 2) + { + if (requested_properties[i] == CL_QUEUE_PROPERTIES) + { + requested_bitfield = requested_properties[i + 1]; + } + if (requested_properties[i] == CL_QUEUE_SIZE) + { + requested_size = requested_properties[i + 1]; + } + } + + error = verify_if_properties_supported(deviceID, requested_bitfield, + requested_size); + if (error == TEST_SKIPPED_ITSELF) + { + log_info("TC result: skipped\n"); + return TEST_PASS; + } + test_error(error, + "Checking which queue properties supported failed.\n"); + } + + // continue testing if supported user properties + error = + create_queue_and_check_array_properties(context, deviceID, test_case); + test_error(error, "create_queue_and_check_array_properties failed.\n"); + + log_info("TC result: passed\n"); + return TEST_PASS; +} + +int test_queue_properties_queries(cl_device_id deviceID, cl_context context, + cl_command_queue queue, int num_elements) +{ + int error = TEST_PASS; + std::vector test_cases; + + test_cases.push_back({ {}, "host queue, NULL properties" }); + + test_cases.push_back( + { { CL_QUEUE_PROPERTIES, 0, 0 }, "host queue, zero properties" }); + + test_cases.push_back( + { { CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE, 0 }, + "host queue, CL_QUEUE_PROFILING_ENABLE" }); + + test_cases.push_back( + { { CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0 }, + "host queue, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE" }); + + test_cases.push_back( + { { CL_QUEUE_PROPERTIES, + CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLE, + 0 }, + "host queue, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | " + "CL_QUEUE_PROFILING_ENABLE" }); + + test_cases.push_back( + { { CL_QUEUE_PROPERTIES, + CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE, 0 }, + "device queue, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | " + "CL_QUEUE_ON_DEVICE" }); + + test_cases.push_back( + { { CL_QUEUE_PROPERTIES, + CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE + | CL_QUEUE_ON_DEVICE_DEFAULT | CL_QUEUE_PROFILING_ENABLE, + CL_QUEUE_SIZE, 124, 0 }, + "device queue, all possible properties" }); + + test_cases.push_back( + { { CL_QUEUE_PROPERTIES, + CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE + | CL_QUEUE_PROFILING_ENABLE, + CL_QUEUE_SIZE, 124, 0 }, + "device queue, all without CL_QUEUE_ON_DEVICE_DEFAULT" }); + + test_cases.push_back( + { { CL_QUEUE_PROPERTIES, + CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE + | CL_QUEUE_ON_DEVICE_DEFAULT | CL_QUEUE_PROFILING_ENABLE, + 0 }, + "device queue, all without CL_QUEUE_SIZE" }); + + for (auto test_case : test_cases) + { + error |= run_test_queue_array_properties(context, deviceID, test_case); + } + return error; +}