* 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>
* Fix Tests Assuming Online Compilation in Offline MOde
* Update the list of tests to skip in offline mode. These tests need
to be skipped for offline-binary mode since they make API calls that
rely on a compiler being present in the runtime.
- [x] Skip `get_kernel_arg_info_compatibility` since it makes calls to
`clBuildProgram`. (these tests cannot be run in offline mode since:
*Kernel argument information is only available if the program object
associated with kernel is created with `clCreateProgramWithSource` and
the program executable was built with the `-cl-kernel-arg-info` option
specified in options argument to `clBuildProgram` or `clCompileProgram`
.*)
- [x] Skip `compiler` tests that make calls to `clCompileProgram`. These
tests could still be run in offline spirv mode if there is a compiler in
the driver.
- [x] Use offline compilation path in `contractions` in the case that
CTS is run in offline.
* Avoid shadowing `error` variable
Co-authored-by: Ewan Crawford <ewan@codeplay.com>
- [x] Add `CL_DEVICE_NAME` to list of device properties printed into the
clDeviceInfo file for offline compilation testing.
- [x] Add `get_device_name` helper function.
- [x] Update offline compiler interface explanation file with
`CL_DEVICE_NAME` and `CL_DEVICE_IMAGE_SUPPORT` which was missed from
this file when added.
- [x] Add `CL_DEVICE_IMAGE_SUPPORT` to the clDeviceInfo file
which contains
device specific information for the purposes of offline compilation. For
devices with images support `CL_DEVICE_IMAGE_SUPPORT=1` is printed,
otherwise `CL_DEVICE_IMAGE_SUPPORT=0`.
* Remove duplicate IsXSubnormal functions
Is{Double,FLoat,Half}Subnormal function duplicates are currently in the codebase.
Fixes#511
Change-Id: Ibe97f20a6e38db6aed00c9ba397cfa72036bd1c5
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Update conversions.h
* Enable -Werror for GCC/Clang builds
Fixes many of the errors this produces, and disables a handful that
didn't have solutions that were obvious (to me).
* Check for `-W*` flags empirically
* Remove cl_APPLE_fp64_basic_ops support
* Undo NAN conversion fix
* Add comments to warning override flags
* Remove unneeded STRINGIFY definition
* Fix tautological compare issue in basic
* Use ABS_ERROR macro in image tests
* Use fabs for ABS_ERROR macro
* Move ABS_ERROR definition to common header
* Accept OpenCL 3.0 in version parsing code and use where appropriate
There were a number of tests against 2.2 that are clearer against 3.0.
Fixes#751
Signed-off-by: Kévin Petit <kpet@free.fr>
* Remove CL_EXPERIMENTAL guards
Signed-off-by: Kévin Petit <kpet@free.fr>
* formatting
* Configure the headers for OpenCL 3.0
* more format fixes
* Use std::string for get_device_*_string helpers
Removes need to use BufferOwningPtr to avoid memory leaks.
* Rename get_device_info to get_device_info_string
Makes it more obvious that it should only be called for device queries
that return strings.
* Tokenize extensions in is_extension_available
Avoids the potential issue where one extension name is a prefix of
another.
* Throw exception when device info size is 0
* Allow CL_HALF_FLOAT denorm flushing for write tests (#452)
* On mismatch, add relaxation when denormal half result is expected
* Refactor to use common validation function
* Clean up some diagnostics
* Fix review comments
- use cl_half
- remove extraneous casts
- replace literals with sizeof()
* Document rollover trick for IsHalfSubnormal
Removing all references to check_opencl_version as similar
get_device_cl_version() can be used instead.
Fixes#527
Change-Id: I474b6f536033707e1beb9b5b39410de24672c040
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
They are duplicate functions
Fixes#709
Change-Id: I8f7d6b8254047adb9e09ede4951dedc3ec5c1099
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
is_extension_available is modified to handle errors by throwing
exceptions.
Contributes to #627
Change-Id: Ie9423df588892a0f8effa03d1cb48bf12400b983
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
- Introduce MTdataHolder
- Use BufferOwningPtr to manage allocations (fixes a few leaks in error cases)
- Introduce variable for common expressions
- Remove image format support check as the format is required by OpenCL 1.0
Contributes to #700
Signed-off-by: Kévin Petit <kpet@free.fr>
(Patch1)
A number of tests have got their own code for checking the presence of
extensions. This change replaces that code with is_extension_available
function.
Contributes to #627
Change-Id: I8dd2233719aa8c84841ac61776437d7f6e3fafe6
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Harness: Added an option for a test to skip itself.
New condtion in callSingleTestFunction. This allows a test to return TEST_SKIP if the device does not support the requested test.
* Split generic_ptr_to_host_mem into two tests.
The old generic_ptr_to_host_mem test tests two different device capabilities (SVM and not SVM). This is a prerequisite for the following commit.
* Generic Address Space: Skip tests utlilising SVM on devices that do not support SVM.
Where a device does not support SVM, do not run the generic address space test(s) that rely on SVM.
Add gDeviceType set on kernel_read_write tests(image_streams)
as the device type affects the way validation is performed in the test.
Signed-off-by: John Kesapides <john.kesapides@arm.com>
An existing workaround on the max_image size calulcation that disallows
the width of an image to be less than 16 can stress the calculcation of
the remainder dimension to be less than 1.0 in size. In three dimentional
objects (3d,2d array) where one dimention is set to max and the other is
set to 16 there might not be enough space left for the 3rd one.
This workaround clamps the third dimension to a minimum of 1.0
Signed-off-by: John Kesapides <john.kesapides@arm.com>
Fixes#693 by returning `TEST_SKIP` instead of `TEST_FAIL` from the
`verifyImageSupport()` kernel helper function when
`checkForImageSupport()` reports the device does not support images.
* imageHelpers: Created generic function that returns a vector of required image formats.
An upcoming commit requires access to the vector of required image formats, separatley from check_minimum_supported.
* imageHelpers: Added a new function is_image_format_required.
This function can be used to determine for any given cl_image_format, whether the implementaion is required to support it.
Conditionally test BGRA in Basic readimage3d (#623)
This change adds checks to see if testing against an embedded implementation and if so, queries whether BGRA is supported or not.
* Refactor based on PR review.
* Update passed message code.
* Changed scope of struct to be within test_readimage3d.
posix_memalign requires alignment to be a power of two and a multiple
of sizeof(void*). All powers of two greater than sizeof(void*) are
multiples of sizeof(void*) so we only need to make sure sizeof(void*)
is the minimum value passed to posix_memalign.
Fixes#644
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
* Update table of required image formats (#427)
This commit updates the table of required image formats. The table is built depending on the profile of the device, the requested image type, and the avaiablitiy of relevent extensions.
* Fixed incorrect argument to memcpy.
* Made image format arrays static.
* Utilised ARRAY_SIZE where appropriate.
* Re-named required image format bools to be more explicit.
* Made sRGBA, CL_UNORM_INT8 a required full format profile.
Misinterpretation of the spec had made this optional.
* check_minimum_supported: switched to using vectors.
* Added CL_sRGB CL_UNORM_INT8 to full profile required formats.
This matches the same channel data type requirement as CL_sRGBA.
* Overload <= and >= for the Version class.
* Correct the condition under which sRGB images are required.
* Correct the required image formats are based on OpenCL version.
The spec says that for different OpenCL versions, different sets of image formats are required.
* Print out the correct OpenCL version when required image format is not found.
* Improved the way in which image formats are added based on profile and version.
* Potential build fix regarding isnan namespace issues.
* Image Helpers: Remove duplicate copies when building required image format vectors.
Also re-ordered a branch to make it clearer.
Moved all duplicate 'PrintArch' functions to testHarness.c
Replaced sysctl system call used in 'PrintArch' function with uname
system call
Signed-off-by: bhargavdas <bhargav_das@mentor.com>
Update testHarness.c
* set gDeviceType in testharness.c, also moved gTestRounding to imageHelpers.cpp & .h and removed duplicate code from host_atomics.cpp
* Cleaned up some redundant code
* Reversed the change in testharness.c