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
|
||||
Reference in New Issue
Block a user