* 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
* skip test cases rather than fail without cl_khr_3d_image_writes
cl_khr_3d_image_writes is required for OpenCL 2.x devices, but is not
required for OpenCL 1.x or OpenCL 3.0 devices. A check for the presence
of the extension on OpenCL 2.x devices already exists in
test_min_max_device_version, so we don't need any failure conditions
here, and can just skip tests if the extension is not supported.
* clang-format changes
* `test_enqueued_local_size` will be skipped for OpenCL < 2.0. However,
non-uniform work-groups became optional in 3.0 and so check that they
are supported before running `test_enqueued_local_size`. If they are not
suppported round the global sizes up to the next multiple of the local
size, so that we can still test that `get_enqueued_local_size() ==
get_local_size()` in the case of uniform workgroups.
* add a test for clSetContextDestructorCallback
* add a 10 second timeout for mem object and context destructor callbacks
* clang-format fixes
* address review comments
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>
* Skip sub_group_dispatch.
If sub groups aren't supported, skip the test.
* Do not test for cl_khr_subgroups as the extension requires IFP.
3.0 allows sub groups *without* IFP so the check was invalid.
* 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>
Test has previously been commented out and adds no value.
Struct array is already tested with test_stream_read.
Change-Id: I4f5acfc431b7cf39408e3e0fd41a6f89fc9353fa
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
Basic conformance testing for the cl_khr_device_uuid extension. Checks
that the ID queries return the right sizes and that the returned IDs are
stable across two calls to clGetDeviceInfo. If device LUID validity is
true, also checks that one and only one bit is set in the device node
mask.
Signed-off-by: Einar Hov <einar.hov@arm.com>
The OpenCL SPIR-V Environment Specification was updated to mandate that
all variables decorated with `BuiltIn` must be in the `Input` storage
class, see https://github.com/KhronosGroup/OpenCL-Docs/pull/278.
Global variables with the Input storage class have to be listed in the
entry points’ interface, which was also taken care of in this commit.
* OpenCL versions before 2.0 do not have precision requirements for
reduced precision math.
* Skip reduced precision testing for devices with
versions < 2.0.
- [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`.
* Turn on building test_gl in travis
* Install packages only on native Linux
* Build test_gl use variable
* Travis - skip OSX system
* Fix test_gl build errors
* Fix test_gl build errors - cast to uintptr_t
* Fix redefinition build issues in travis Xenial build env
* 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
Test has been commented out.
This is effecting clang-format checks in the file.
Removing test as it is not in use.
Change-Id: Ic9a7ab68a514fa6dc01e4d86a7bda1a9856a75e8
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* The global variable `gTestFastRelaxed` has state which is used to
control the behaviour of the compiler flag `-cl-fast-relaxed-math` and
the precision testing of relaxed, fp32 and fp64 types. This is confusing
since the global variable is being set and read in different translation
units, making it very difficult to reason about the logic of the brute
force framework. It is particular difficult to follow since the global
variables is cached and then turned off in the case of fp32 and f64 in
order to use the same code path as relaxed testing, after it is then
turned back on.
* Remove uses of the global variable outside of `main.cpp` (the global
variable remains in use within `main.cpp` since it is a command line
option and used to turn of relaxed testing completely). Replace all uses
of the global variable with boolean `relaxedMode` which is passed as a
function paramter but replaces `gTestFastRelaxed` semantically.