mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
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 <grzegorz.wawiorko@intel.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
126
test_common/harness/propertyHelpers.cpp
Normal file
126
test_common/harness/propertyHelpers.cpp
Normal file
@@ -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 <assert.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
static bool findProperty(const std::vector<cl_properties>& 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<cl_properties>& queried,
|
||||
const std::vector<cl_properties>& 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;
|
||||
}
|
||||
27
test_common/harness/propertyHelpers.h
Normal file
27
test_common/harness/propertyHelpers.h
Normal file
@@ -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 <vector>
|
||||
|
||||
int compareProperties(const std::vector<cl_properties>& queried,
|
||||
const std::vector<cl_properties>& check);
|
||||
|
||||
#endif // _propertyHelpers_h
|
||||
@@ -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)
|
||||
|
||||
@@ -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)),
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 <vector>
|
||||
#include <algorithm>
|
||||
@@ -34,16 +34,14 @@ struct test_data
|
||||
std::string kernel_name;
|
||||
};
|
||||
|
||||
int create_object_and_check_properties(cl_context context,
|
||||
static int create_object_and_check_properties(cl_context context,
|
||||
clMemWrapper& test_object,
|
||||
test_data test_case, cl_mem_flags flags,
|
||||
test_data test_case,
|
||||
cl_mem_flags flags,
|
||||
std::vector<cl_uint> local_data,
|
||||
cl_uint size_x, cl_uint size_y)
|
||||
{
|
||||
int error = CL_SUCCESS;
|
||||
size_t set_size;
|
||||
std::vector<cl_mem_properties> object_properties_check;
|
||||
|
||||
cl_int error = CL_SUCCESS;
|
||||
|
||||
if (test_case.obj_t == image)
|
||||
{
|
||||
@@ -87,79 +85,39 @@ int create_object_and_check_properties(cl_context context,
|
||||
|
||||
test_error(error, "clCreateBufferWithProperties failed.");
|
||||
}
|
||||
|
||||
std::vector<cl_mem_properties> 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)
|
||||
if (set_size == 0 && test_case.properties.size() == 0)
|
||||
{
|
||||
return TEST_PASS;
|
||||
}
|
||||
else
|
||||
if (set_size != test_case.properties.size() * sizeof(cl_mem_properties))
|
||||
{
|
||||
log_error("ERROR: Expected non-zero size!\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);
|
||||
object_properties_check.resize(number_of_props);
|
||||
clGetMemObjectInfo(test_object, CL_MEM_PROPERTIES, set_size,
|
||||
object_properties_check.data(), NULL);
|
||||
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.");
|
||||
|
||||
// check list with 0 terminator is returned
|
||||
if (object_properties_check.size() == 1 && object_properties_check[0] == 0
|
||||
&& test_case.properties.size() == 0)
|
||||
{
|
||||
return TEST_PASS;
|
||||
}
|
||||
if (object_properties_check.back() != 0)
|
||||
{
|
||||
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<cl_mem_properties>::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");
|
||||
return TEST_FAIL;
|
||||
}
|
||||
|
||||
error = compareProperties(check_properties, test_case.properties);
|
||||
return error;
|
||||
}
|
||||
|
||||
int run_test_query_properties(cl_context context, cl_command_queue queue,
|
||||
static int run_test_query_properties(cl_context context, cl_command_queue queue,
|
||||
test_data test_case)
|
||||
{
|
||||
int error = CL_SUCCESS;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
//
|
||||
#include "testBase.h"
|
||||
#include "harness/imageHelpers.h"
|
||||
#include "harness/propertyHelpers.h"
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <algorithm>
|
||||
@@ -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<cl_sampler_properties> get_properties;
|
||||
std::vector<cl_sampler_properties> set_properties(
|
||||
std::vector<cl_sampler_properties> test_properties(
|
||||
properties, properties + ARRAY_SIZE(properties));
|
||||
|
||||
std::vector<cl_sampler_properties> 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<cl_sampler_properties>::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 )
|
||||
|
||||
269
test_conformance/api/test_queue_properties_queries.cpp
Normal file
269
test_conformance/api/test_queue_properties_queries.cpp
Normal file
@@ -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 <vector>
|
||||
#include <algorithm>
|
||||
|
||||
struct test_queue_array_properties_data
|
||||
{
|
||||
std::vector<cl_queue_properties> 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<cl_command_queue_properties> 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<cl_queue_properties> 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<cl_queue_properties> 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_queue_array_properties_data> 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;
|
||||
}
|
||||
Reference in New Issue
Block a user