* Remove unnecessary code
These custom equality operators are not necessary because of the
conversion operators which already allow using the standard equality
operators between two pointers.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
* Fix copy and move semantics of wrapper classes
Related to #465.
The Wrapper classes are rewritten to properly handle copy and move
semantics, while preserving the existing API and removing code
duplication.
Add error handling around clRelase* and clRetain*.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
* Address build issue on 32-bit Windows
Include linkage in RetainReleaseType function type.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
The context and queue were not released when the test is not supported
in offline mode or the queue couldn't be created.
Inline test_missing_support_offline_cmpiler_ret macro, remove dead
parameter of check_functions_for_offline_compiler and slightly refactor
callSingleTestFunction to address leaks.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
ThreadSanitizer detects some data race in ThreadPool. They stem from
inappropriate usage of volatile which are replaced with std::atomic
variables in this patch.
This patch focuses on data races identified while running the
math_brute_force component. For example, it doesn't fully remove usage
of ThreadPool_AtomicAdd from other components of the CTS. Furthermore,
thread leaks, most likely because threads are not joined, are not
addressed.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
The CL_UNORM_SHORT_555 and CL_UNORM_INT_101010 formats contain padding
bits which need to be ignored in clCopyImage and clFillImage testing.
For clFillImage tests, padding was not ignored for the CL_UNORM_SHORT_555
format, and was ignored for CL_UNORM_INT_101010 by modifying actual and
reference data. For clCopyImage tests, padding was not ignored, both for
CL_UNORM_SHORT_555 and for CL_UNORM_INT_101010.
Fix this by adding a new compare_scanlines() function, which is used for
both of these formats, and does not modify the actual or reference data.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* gles: Fix compile warnings.
For 32 and 64-bit Visual Studio and the Android Q NDK.
* Fix formatting violations
Co-authored-by: spauls <spauls@qti.qualcomm.com>
* Cleanup usage of static, extern and typedef
Remove static on functions defined headers, as it can result in
duplication in binaries.
Remove unnecessary extern keyword on a function declaration, as it is
the default behavior and can be puzzling when reading the code.
Remove the unused declaration of my_ilogb, which is never defined.
Remove unnecessary usage of typedef, as they are only increasing the
cognitive load of the code for no purpose.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
* Improve usage of inline and static in harness
Functions declared in header as static can trigger unused warnings when
(indirectly) included in translation units that do not use such
functions. Use inline instead, which also avoids duplicating symbols in
binaries.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
As per 6.15.15.7, the first three components have to be set to the luminance
value and all components to the intensity value.
Signed-off-by: Kévin Petit <kpet@free.fr>
* 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>
When invoking for example
test_c11_atomics test-that-does-not-exist
parseAndCallCommandLineTests() would attempt to dereference
`resultTestList` which is still a null pointer.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
clCopyImage and clFillImage contain near-duplicate code for logging of
pixel difference errors. Move this into imageHelpers.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* Implement Negative Tests for clPlatform Functions
This change introduces negative tests for clPlatform
functions as well as changes to the Harness to help with
other negative tests.
Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com>
* [SQUASH] Remove magic macro from Negative Platform Tests
This change removes the negative-testing macro and all
other changes related to its usage.
Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com>
* Fix enqueue_flags test to use correct barrier type.
Currently, enqueue_flags test uses CLK_LOCAL_MEM_FENCE.
Use CLK_GLOBAL_MEM_FENCE instead as all threads across work-groups
need to wait here.
* Add check for support for Read-Wrie images
Read-Write images have required OpenCL 2.x.
Read-Write image tests are already being skipped
for 1.x devices.
With OpenCL 3.0, read-write images being optional,
the tests should be run or skipped
depending on the implementation support.
Add a check to decide if Read-Write images are
supported or required to be supported depending
on OpenCL version and decide if the tests should
be run on skipped.
Fixes issue #894
* Fix formatting in case of Read-Write image checks.
Fix formatting in case of Read-write image checks.
Also, combine two ifs into one in case of
kerne_read_write tests
* Fix some more formatting for RW-image checks
Remove unnecessary spaces at various places.
Also, fix lengthy lines.
* Handle NULL hostptr in conformance image tests
As per the spec, clCreateBuffer and clCreateImage return
CL_INVALID_HOST_PTR if host_ptr is NULL
and CL_MEM_USE_HOST_PTR or CL_MEM_COPY_HOST_PTR are set in flags
or if host_ptr is not NULL
but CL_MEM_USE_HOST_PTR or CL_MEM_COPY_HOST_PTR are not set in flags."
Host pointer should be NULL when USE/COPY_HOST_PTR is not set in flags.
* Revert "Handle NULL hostptr in conformance image tests"
This reverts commit 49fa049f9b.
* Move cl_mem_flag and host_ptr check to ImageHelper
Add a check to see if cl_mem_flag has
USE_HOST_PTR or COPY_HOST_PTR.
Override host_ptr with NULL if none of them
are specified.
* Use std::vector for format lists in images suite
Avoids memory deallocation issues and generally simplifies the code.
* Fixup formatting with git-clang-format
* Using helper functions for clCreateKernel
Uses of clCreateKernel following create program helper
functions, have been incorporated into
create_single_kernel_helper when suitable.
Contributes #31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Skip tests using clCompileProgram in offline mode
Contributes #31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Using type wrappers when using kernel helper functions
Also includes fix for windows build
Fixes#31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Remove clReleaseKernel for wrapped kernel
Fixes#31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
TEST_SKIPPED_ITSELF was originally located in
threadTesting.h but this no longer makes sense.
This change moves the definition to the test_status
struct in testHarness so that it can be used in the same
way that test_status' can be used.
Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com>
* Tests requiring image support use runTestHarnessWithCheck
Removing special case for images in runTestHarness.
Fixes#710
* Remove imageSupportRequired argument
Tests which require image support now specify this while
calling runTestHarnessWithCheck.
Fixes#710
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Reimplement buffer tests
Reintegrated and fixed test code for buffer tests buffer_read_half and
buffer_write_half tests.
Added mem_alloc_ref_flags test code, as was previously non-existent,
to test CL_MEM_ALLOC_HOST_PTR. This flag was otherwise untested and
as similar tests within the suite are used to test other cl_mem_flags
it has been assumed that this was the purpose of the test.
Fixes#439
Change-Id: I5accf986be7436d09377d0bfd7afd5de2235c329
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* move mem_read_write_flags to a common function
Code under mem_*_flags tests have a lot of duplication, this is
the first step of moving test code to a common function.
Contributes #439
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* move mem_write_only_flags test code to a common function
Code under mem_*_flags tests have a lot of duplication
Contributes #439
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* move mem_read_only_flags test code to a common function
Code under mem_*_flags tests have a lot of duplication
Contributes #439
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* move mem_copy_host_flags test code to a common function
Code under mem_*_flags tests have a lot of duplication, moved
mem_copy_host_flags code and rearranged function where appropriate
mem_ref_alloc_flags test also uses common function.
Contributes #439
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Remove unused NOT_IMPLEMENTED_TEST macro
This define is not in use anymore, since tests have been
reimplemented in #439. Tests should be working and implemented
or not registered.
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
- [x] Skip the `features_macro` test in offline mode since it makes
calls to `create_single_kernel_helper_create_program` and fails when the
call doesn't return `CL_SUCCESS` which will happen when the offline
compiler fails to compile the kernel which is deliberately supposed to
fail compilation in this test.
The following tests make calls to `clCompileProgram` or
`clBuildProgram` and therefore require a compiler in the runtime:
* `unload_repeated`
* `unload_compile_unload_link`
* `unload_build_unload_create_kernel`
* `unload_link_different↩`
* `unload_build_threaded`
* `unload_build_info`
* `unload_program_binaries`
Skip these tests if no compiler is present in the runtime.
* Reformat common help text
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* Reformat test harness code
This goes part of the way to fixing issue #625.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* Permit half overflow within allowable ULP
Modify the algorithm for calculating half precision ULP error so
that it duplicates the behaviour of the single precision ULP algorithm,
in regards to allowing overflow within the defined ULP error.
In the case where the test value is infinity, but the reference is
finite, pretend the test value is 63336.0 and calculate the ULP error
against that.
Encountered this while testing half precision `hypot()` in PR !529,
for inputs `hypot(-48864.0, 43648.0)` which has reference
`65519.755799`. With RTE rounding this only just rounds to `65504` as half,
and returning INF is currently infinite ULP error. Using the leniency
introduced by this change however the error is `~0.5` within the `2` ULP
bounds defined by the spec.
* Run clang-format over changes
Code now conforms to style guidelines and allows `check-format.sh` to pass.
When running sub-tests explicitly on the command line and that sub-test
fails, the test harness returns `0` from `main()`. This is problematic
in automated testing environments as failed tests can be hidden.
This patch iterates over all the test results in the `resultTestList`
after all sub-tests have completed, if any of the tests failed a
non-zero value is returned from `parseAndCallCommandLineTests()` which
is then propagated up the call stack to `main()`.
- Remove the requirement to detail values for device queries and list
extensions in the submission template. They are printed by computeinfo.
- Require that tests skipped in accordance with the conformance
process be listed in the submission template.
- Remove support for OPENCL_1_0_DEVICE. This variable doesn't control
anything anymore and the updated conformance process no longer refers
to it.
- Require that implementations running via a loader document the loader
that was used.
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
* add test_compiler test for OpenCL C versions
* add checks for required OpenCL C versions
* bugfix: only OpenCL C 2.0 is required for OpenCL 2.1 and 2.2
* pass reference to feature struct vs. pointer
* address review comments regarding C++ identifiers and 3d image writes
* Test feature macro OpenCL 3.0
* Test feature macro OpenCL 3.0 - refactor to template function
* Use test_error and format fix issues
* Fix returned value type for CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE
* Code format fix
* Feature macro test - refactor code to have one test case
* add consistency checking comparing supported features to CL_DEVICE_OPENCL_C_FEATURES
* fix minor issues
* Feature macro test - fix test version
* Feature macro test - add -cl-std=CL3.0 build option
* Feature macro test - compilation errors
* Feature macro test - compilation errors OSX
* Feature macro test - fix adding build options
* Feature macro test - share function OutputBuildLogs
* Feature macro test - back removed cases
* Feature macro test - review fixes
* Feature macro test - split check image formats
* Feature macro test - fixed version
* Change setup code in `KernelCode()` to use `_explicit` builtin
variants that are common to both OpenCL-2.X and OpenCL-3.0.
* Only test optional supported builtin variants (`_explicit` signature
memory_order/scope) for OpenCL-3.0.
* Disable program scope global variable and generic address space tests
for a OpenCL-3.0 driver which does not optionally support these
features.
* Fix enqueue_flags test to use correct barrier type.
Currently, enqueue_flags test uses CLK_LOCAL_MEM_FENCE.
Use CLK_GLOBAL_MEM_FENCE instead as all threads across work-groups
need to wait here.
* Add check for support for Read-Wrie images
Read-Write images have required OpenCL 2.x.
Read-Write image tests are already being skipped
for 1.x devices.
With OpenCL 3.0, read-write images being optional,
the tests should be run or skipped
depending on the implementation support.
Add a check to decide if Read-Write images are
supported or required to be supported depending
on OpenCL version and decide if the tests should
be run on skipped.
Fixes issue #894
* Fix formatting in case of Read-Write image checks.
Fix formatting in case of Read-write image checks.
Also, combine two ifs into one in case of
kerne_read_write tests
* Fix some more formatting for RW-image checks
Remove unnecessary spaces at various places.
Also, fix lengthy lines.
The test attempts to build a program from source containing invalid code, to
provoke a build failure. In offline compilation mode, this causes the offline
compiler to give an error, failing the test.
Signed-off-by: Einar Hov <einar.hov@arm.com>
* added pipes test
clang-format fixes
* simplify diffs
* added pipes test
clang-format fixes
* simplify diffs
* add Program Scope Global Variables consistency test
* switched other checks to test_assert_error
* add non-uniform work group consistency test
* added read-write images consistency test
* add Creating 2D Images from Buffers consistency test
* add Device and Host Timer Synchronization consistency test
* add Intermediate Language Programs consistency test
* add Subgroups consistency test
* add Program Initialization and Clean-Up Kernels consistency test
* add 3D Image Writes consistency test
* clang-format fixes
* switch the check for 3D image writes extension for clarity
* add Depth Images consistency test
* update test for CL_QUEUE_SIZE, must return CL_INVALID_COMMAND_QUEUE
* formatting fixes
* fix copy-paste typo
* change expected error codes to CL_INVALID_OPERATION
* address review comments
* fix formatting
* address review feedback
Since pipes are cl_mems, We can spec and test that clGetPipeInfo
returns CL_INVALID_OPERATION when pipes are not supported by
passing a non-pipe memory object to the function.
* use the CTS framework to choose the OpenCL C version
* address review feedback
In two places, a stray semicolon between an if statement and its body
would cause the body to be executed unconditionally. Fix this.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
... as required by the OpenCL specification.
Also introduce a utility function to manage polling for changes
via a user-supplied function. Several tests we introduced lately
could have used this.
Signed-off-by: Kévin Petit <kpet@free.fr>