mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-20 22:39:03 +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:
@@ -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 )
|
||||
|
||||
Reference in New Issue
Block a user