* Fix memory model issue in atomic_flag.
In atomic_flag sub-tests that modify local memory, compilers may re-order memory accesses between the local and global address spaces which can lead to incorrect test failures.
This commit ensures that both local and global memory operations are fenced to prevent this re-ordering from occurring.
Fixes#134.
* Clang format changes.
* Added missing global acquire which is necessary for the corresponding global release.
Thanks to @jlewis-austin for spotting.
* Clang format changes.
* Match the condition for applying acquire/release fences.
* Temporarily disable the test_kernel_attributes test case
Per OpenCL spec on CL_KERNEL_ATTRIBUTES, for kernels not created from OpenCL C
source and the clCreateProgramWithSource API call the string returned from this
query will be empty.
But in test_kernel_attributes test, it read from bc binary and expect to get
kernel attribute, which is not consistent with OpenCL spec.
* Fix clang format issue
* Add tests for entrypoint cl_khr_suggested_local_work_size
Tests added within test_conformance/workgroups. The tests cover several
shapes (num dimensions) and sizes of global work size, kernels using
local memory (dynamic and static) and present/non-present global work
offset.
Signed-off-by: Kallia Chronaki <kallia.chronaki@arm.com>
* Fix in comparison for error checking
Signed-off-by: Kallia Chronaki <kallia.chronaki@arm.com>
* 'test_wg_suggested_local_work_size' fixes
* Refactoring of 'test_wg_suggested_local_work_size'
Modifications to reduce code duplication and minimize build time
* subgroups: Fix setting cl_halfs and progress check.
cl_float testing uses set_value such that a generated cl_ulong of 1 is
stored as 1.0F in a logical sense. However, cl_half values aren't
intrinsic to C++ and generated cl_ulongs less than 1024 in particular
are interpreted bitwise as subnormals. The test fails on compute devices
lacking subnormal support. Perform the logical conversion to cl_half.
Fix independent forward progress check.
* subgroups_half: Address review comments
* subgroups_half: Formatting fixes required by check-format
* subgroups_half: Modified to query and use rounding mode supported by device
Co-authored-by: spauls <spauls@qti.qualcomm.com>
* add basic test for cl_khr_pci_bus_info
* correctly use TEST_SKIPPED_ITSELF
Co-authored-by: Kévin Petit <kpet@free.fr>
* fix related usage of TEST_SKIPPED_ITSELF
Co-authored-by: Kévin Petit <kpet@free.fr>
A recent update to the object wrapper classes (#1268) changed the
behavior of assigning to a wrapper, whereby the wrapped object is now
released upon assignment. A couple of tests were manually calling
clReleaseMemObject and then assigning `nullptr` to the wrapper,
resulting in the wrapper calling clReleaseMemObject on an object that
had already been destroyed.
* 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>
* Minor fixes for CL_UNORM_SHORT_565, CL_UNORM_SHORT_555
* Fix verification for undefined bit
* Relax current infinitely precision requirement for these formats
and move check in common function.
* Add proper debug output.
Signed-off-by: John Kesapides <john.kesapides@arm.com>
* Minor Formating fix.
Signed-off-by: John Kesapides <john.kesapides@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>
* Avoid manual memory management
Prefer std::vector over malloc and free. This will allow removing goto
statements by leveraging RAII.
Use appropriate type (bool) to store overflow predicates and allocate
std::vector<bool> of appropriate sizes: before this change the
allocation was unnecessary bigger than required.
No longer attempt to catch "out of host memory" issues, given that in
such situation it is generally not possible to cleanly report an error.
Rely on std::bad_alloc exception to report such issues.
Introduce a new header for common code in the math_brute_force
component. It is currently complementary to utility.h and is expected to
hold cleaned up content extracted from future refactoring operations.
List all headers as source in CMake for better compatibility with IDEs.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
* Remove manual or unnecessary memset
In order to use non-POD types as fields of TestInfo, memset must be
replaced with a compatible zero-initialisation.
Remove an unnecessary memset in MakeKernels.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
A program having a type (such as ThreadInfo) defined differently in
multiple translation units exhibits undefined behaviour.
This commit fixes such issues in the math_brute_force component by
ensuring most types are local to their translation unit with the help of
anonymous namespaces. Later refactoring will be able to extract common
definitions to a single place.
This patch also removes unnecessary static and typedef keywords.
Otherwise, code is only moved around with no change.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Remove workaround for #783, this was fixed by #1237.
Remove workaround for overflow, #699 has been merged.
Disable errors from -Wimplicit-const-int-float-conversion, the issue is
covered by #1250.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
* allocations: Run buffer non-blocking even without images
Testing buffer non-blocking should not be dependent on whether images
are supported by a device or not.
* allocations: Fix typos
* 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>
Only nan() is tested by unary_u_float.cpp and unary_u_double.cpp.
Testing of half_sin, half_tan and half_cos is done in unary_float.cpp
and unary_double.cpp.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
* 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>
* Add Test for CL_KERNEL_ATTRIBUTES (#832)
This test generates dummy kernels which have any
permutation combining the following attributes:
* vec_type_hint
* work_group_size_hint
* reqd_work_group_size
It then gets the attributes by using clGetKernelInfo
and validates that the attributes returned are correct.
By matching the attributes which were used to generate
the kernel are present in the returned string from
clGetKernelInfo.
This test has been implemented as part of the
test_conformance/api suite.
Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com>
* [SQUASH] Remove Signed Vector Attribute Hints
As per comments, SPIR-V does not distinguish the signedness
of an argument. This change removes the "signed" types
to ensure that the test passes in all scenarios.
Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com>
* [SQUASH] Add TODO for Signed Vector Hints
As the current version only tests for unsigned
vector types (uchar/uint/etc), add a TODO in the code
as a reference to future work to introduce signed vector
tests
Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com>
* 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>
As the extension is vector size and type independent, we only need to
check for the extension once per test and not for every possible
combination of inputs, thereby drastically reducing the log output of
the test when the extension is not supported.
Fix heap-buffer-overflow reported by AddressSanitizer: ensure the
appropriate number of elements are allocated for the list of tests.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Builtin functions producing two results can have their worst error, for
each result, on different inputs. Report both inputs.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Make variables local to loops, with appropriate types. These variables
are not read after the loop without being reset first, so this patch
doesn't change behaviour.
These variables should now be used for one purpose only, making it
easier to reason about the code. This will make future refactoring
easier.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>