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>
* 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>
* Adds testing for CL_PROGRAM_IL
Added a test to check SpirV as an IL for programs built with IL
which includes a negative test for programs built without IL.
Added a test_fail macro.
Fixes#164
Change-Id: I908241242b369551806e43b90ab414f895d5c8f7
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* COMPUTE-11739 Removing unused platform and device_version
Fixes#164
Change-Id: Ib1168f6396132b69996d07166e1b593fa933d245
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Dynamically select the `-cl-std` option on the basic `sizeof` and
`wg_barrier` tests to be one of `CL1.X`, `CL2.0` or `CL3.0`.
Use the most recent CL C standard supported on the device.
* Specify GCC flag `-frounding-math` on x86
We have been seeing fails in `test_conversions` on x86_64 when converting to the following integer types from `cl_double` with a non-default rounding mode:
```
char_rtn_double
char_rtp_double
int_rtn_double
int_rtp_double
long_rtn_double
long_rtp_double
long_sat_rtn_double
long_sat_rtp_double
short_rtn_double
short_rtp_double
uchar_rtp_double
uint_rtp_double
ulong_rtp_double
ushort_rtp_double
```
After investigation it was discovered that `rint()` was incorrectly rounding `cl_double` inputs despite the rounding mode being correctly set using `fesetround()` beforehand. E.g For 'char_rtn_double' `-3.5` was getting rounding to `-3.0` rather than `-4.0`.
This is a gcc issue https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92164 when using the builtin `rint()` implementation, rather than `std::rint()`, that only presents itself when compiling a Release build with `-O2` rather than Debug.
Adding the compiler flag `-fno-builtin-rint` to the CMake works around this problem, however based on the discussion in the gcc ticket using `-frounding-math` appears to be a more comprehensive fix. As `-frounding-math` tells gcc that the code will be modifying the rounding mode, removing the assumption that the same rounding mode is in effect everywhere.
* Set FENV_ACCESS ON in rounding_mode.h
Inform compilers which are aware of the `FENV_ACCESS` pragma that TUs
which include `harness/rounding_mode.h` may manipulate the floating
point environment.
* Remove FENV_ACCESS pragma from test_conversions.cpp
This pragma is now set in the included header
`test_common/harness/rounding_mode.h`
Co-authored-by: Kenneth Benzie (Benie) <k.benzie@codeplay.com>
* Use float<->half conversion routines from the OpenCL headers
Fixes#870
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
* Use cl_half_from_double
* Fix windows build errors
* Fix more build errors
* Code formatting
* Remove TEST class
The compiler tries to compile the same source multiple times and more
importantly write out to the same filename. Adding a lock to prevent
simultaneous compilation solves this issue. This is particularly
noticeable in integer_ops testing when using offline compilation,
but just in case, hold the lock for the entire program creation.
Signed-off-by: Mats Petersson <mats.petersson@arm.com>
Signed-off-by: Stuart Brady <stuart.brady@arm.com>