mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
* Improve Functionality of Harness In the harness we previously were able to determine whether or not a device supports the half or double data types, but doing so required unintuitive function calls and would need to be repeated per test. A new pair of functions have been added which clearly state what they do, and makes it easier to determine whether or not a device supports the types. Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com> * Remove Old GetKernelArgInfo Tests (#522) In the API test suite we have 2 versions which test the clGetKernelArgInfo API. As part of this ticket we are redesigning the implementation of this test. This change removes all of the old code and makes it so that the tests simply pass. A later commit will add the redesigned test Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com> * Redesign GetKernelArgInfo (#522) The previous test for this API consisted of 5K+ lines of code which would define the test kernels and the expected outputs from this API. This redesign instead generates the kernels and expected outputs leading to incresased maintanability and a significantly reduce line-of-code count. Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com> * [SQUASH] Address Review Comments This commit does the following: 1) Update the Copyright to 2021 2) Fixes a typo in a comment 3) Explicitly declares a vector variable (previously auto) 4) Output subtest result after completion rather than all of them at the end Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com> * [SQUASH] Ensure Kernel Arguments do not exceed CL_DEVICE_MAX_PARAMETER_SIZE As per upstream comments, this change ensures that the total size of parameters passed into a kernel does not exceed the limit specified by CL_DEVICE_MAX_PARAMETER_SIZE for the device used. Additionally this change replaces ASSERT_SUCCESS() with test_error() as per upstream requests. Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com> * [SQUASH] Address Image and Vector Failures This change aligns vector 3 types to be sized 4. Additionally it ensures that image arguments do not have the address space qualifier specified because they are by default in the __global space. Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com> * [SQUASH] Ensure that the size of pipe arguments are correct As mentioned in PR comments, the test previously assumed that sizeof(char) == sizeof(pipe char). The Clang implementation treats a pipe to take the same size as a pointer, which is now reflected in the code. Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com> * [SQUASH] Ensure that CL_DEVICE_MAX_PIPE_ARGS is not Exceeded This commit refactors the code so that Pipes are handled separately. Additionally, it removes signed char and char signed as scalar types to test and removes some redundent code for modifiying the expected type when processing unsigned scalar types. Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com> * [SQUASH] Remove compatibility test from skip-list There is a list of tests which should be skipped when using an offline compiler. As get_kernel_arg_compatibility has been removed, it should also be removed here. Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com> * [SQUASH] Disable Pipe Tests This change disables the Pipe tests for clGetKernelArgInfo as pipe metadata is not accurately reported on clang which leads to the pipe tests failing. Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com>
101 lines
2.9 KiB
C++
101 lines
2.9 KiB
C++
//
|
|
// Copyright (c) 2017-2019 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 <sstream>
|
|
#include <stdexcept>
|
|
#include <vector>
|
|
|
|
#include "deviceInfo.h"
|
|
#include "errorHelpers.h"
|
|
#include "typeWrappers.h"
|
|
|
|
/* Helper to return a string containing device information for the specified
|
|
* device info parameter. */
|
|
std::string get_device_info_string(cl_device_id device,
|
|
cl_device_info param_name)
|
|
{
|
|
size_t size = 0;
|
|
int err;
|
|
|
|
if ((err = clGetDeviceInfo(device, param_name, 0, NULL, &size))
|
|
!= CL_SUCCESS
|
|
|| size == 0)
|
|
{
|
|
throw std::runtime_error("clGetDeviceInfo failed\n");
|
|
}
|
|
|
|
std::vector<char> info(size);
|
|
|
|
if ((err = clGetDeviceInfo(device, param_name, size, info.data(), NULL))
|
|
!= CL_SUCCESS)
|
|
{
|
|
throw std::runtime_error("clGetDeviceInfo failed\n");
|
|
}
|
|
|
|
/* The returned string does not include the null terminator. */
|
|
return std::string(info.data(), size - 1);
|
|
}
|
|
|
|
/* Determines if an extension is supported by a device. */
|
|
int is_extension_available(cl_device_id device, const char *extensionName)
|
|
{
|
|
std::string extString = get_device_extensions_string(device);
|
|
std::istringstream ss(extString);
|
|
while (ss)
|
|
{
|
|
std::string found;
|
|
ss >> found;
|
|
if (found == extensionName) return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/* Returns a string containing the supported extensions list for a device. */
|
|
std::string get_device_extensions_string(cl_device_id device)
|
|
{
|
|
return get_device_info_string(device, CL_DEVICE_EXTENSIONS);
|
|
}
|
|
|
|
/* Returns a string containing the supported IL version(s) for a device. */
|
|
std::string get_device_il_version_string(cl_device_id device)
|
|
{
|
|
return get_device_info_string(device, CL_DEVICE_IL_VERSION);
|
|
}
|
|
|
|
/* Returns a string containing the supported OpenCL version for a device. */
|
|
std::string get_device_version_string(cl_device_id device)
|
|
{
|
|
return get_device_info_string(device, CL_DEVICE_VERSION);
|
|
}
|
|
|
|
/* Returns a string containing the device name. */
|
|
std::string get_device_name(cl_device_id device)
|
|
{
|
|
return get_device_info_string(device, CL_DEVICE_NAME);
|
|
}
|
|
|
|
size_t get_max_param_size(cl_device_id device)
|
|
{
|
|
size_t ret(0);
|
|
if (clGetDeviceInfo(device, CL_DEVICE_MAX_PARAMETER_SIZE, sizeof(ret), &ret,
|
|
nullptr)
|
|
!= CL_SUCCESS)
|
|
{
|
|
throw std::runtime_error("clGetDeviceInfo failed\n");
|
|
}
|
|
return ret;
|
|
}
|