Redesign clGetKernelArgInfo (#522) (#1056)

* 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>
This commit is contained in:
Chetan Mistry
2021-05-13 09:18:12 +01:00
committed by GitHub
parent ad8ab3fe90
commit a43d96de69
10 changed files with 975 additions and 11032 deletions

View File

@@ -86,3 +86,15 @@ 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;
}

View File

@@ -42,4 +42,8 @@ std::string get_device_version_string(cl_device_id device);
/* Returns a string containing the device name. */
std::string get_device_name(cl_device_id device);
// Returns the maximum size in bytes for Kernel Parameters
size_t get_max_param_size(cl_device_id device);
#endif // _deviceInfo_h

View File

@@ -623,7 +623,6 @@ cl_int OutputBuildLogs(cl_program program, cl_uint num_devices,
const char *subtests_to_skip_with_offline_compiler[] = {
"get_kernel_arg_info",
"get_kernel_arg_info_compatibility",
"binary_create",
"load_program_source",
"load_multistring_source",

View File

@@ -1756,3 +1756,26 @@ bool poll_until(unsigned timeout_ms, unsigned interval_ms,
return ret;
}
bool device_supports_double(cl_device_id device)
{
if (is_extension_available(device, "cl_khr_fp64"))
{
return true;
}
else
{
cl_device_fp_config double_fp_config;
cl_int err = clGetDeviceInfo(device, CL_DEVICE_DOUBLE_FP_CONFIG,
sizeof(double_fp_config),
&double_fp_config, nullptr);
test_error(err,
"clGetDeviceInfo for CL_DEVICE_DOUBLE_FP_CONFIG failed");
return double_fp_config != 0;
}
}
bool device_supports_half(cl_device_id device)
{
return is_extension_available(device, "cl_khr_fp16");
}

View File

@@ -178,7 +178,7 @@ cl_device_fp_config get_default_rounding_mode(cl_device_id device);
}
#define PASSIVE_REQUIRE_FP16_SUPPORT(device) \
if (!is_extension_available(device, "cl_khr_fp16")) \
if (!device_supports_half(device)) \
{ \
log_info( \
"\n\tNote: device does not support fp16. Skipping test...\n"); \
@@ -208,4 +208,10 @@ bool device_supports_cl_c_version(cl_device_id device, Version version);
bool poll_until(unsigned timeout_ms, unsigned interval_ms,
std::function<bool()> fn);
// Checks whether the device supports double data types
bool device_supports_double(cl_device_id device);
// Checks whether the device supports half data types
bool device_supports_half(cl_device_id device);
#endif // _kernelHelpers_h