Remove the test timing functionality from the conversions test, because
it
- is not advertised in the help,
- is not supported on all platforms, triggering warnings during the
build,
- goes beyond the core purpose of the conformance test suite.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Using C++17's `if constexpr` avoids Wformat warnings in this template
function, as it is now made explicit that the various format strings are
only used with appropriate types.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit links to issue (#2234).
When cross-compiling for AArch64, using gcc 13.3, you encounter three
warnings types that turn into errors:
- maybe-uninitialized
- stringop-truncation
- strict-aliasing
This commit fixes all the warnings found, in regards to the first two
rules. To resolve the warnigns due to strict-aliasing, I am editing the
CMake build system.
Signed-off-by: Antonios Christidis <a-christidis@ti.com>
Move the global `-Wno-format` compiler option to the individual tests
that still trigger Wformat warnings. The majority of the tests now
compile cleanly with `-Wformat` enabled.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Printing of a `size_t` requires the `%zu` specifier.
This fixes occurrences where the previous wrong specifier appears to
work in a typical 64-bit build, but causes a Wformat warning in 32-bit
builds.
---------
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Commit b6941b6c ("Add fp16 testing to conversions and bruteforce
(#1975)", 2024-06-18) introduced a behavioural change for non-half
tests. The `-cl-denorms-are-zero` option could be added for non-half
tests such as `char_rtn_float` even when `gForceFTZ` was `false`. Fix
the condition by also taking the input and output types into account.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Fixes narrowing conversion build errors in test_common
Removing disable of narrowing errors in main CMakeLists.txt
and moving it down to specific test_conformance suite's
CMakeLists.txt where there are many more build errors revealed
from this fix.
Fixes a few simple issues under test_conformance in the process.
Contributes #787
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
---------
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
The handling of NaN values in the templated function was incorrect due
to improper initialization of the input data source. Specifically, the
function ZeroNanToIntCases used a global pointer gIn, which was not
correctly set or did not point to the same data as the local input
pointer s used in the non-templated implementation.
to solve the issue I updated the templated function ZeroNanToIntCases to
take an additional parameter for the input data source.
and then passed the correct input data (s) to the templated function
during its invocation.
Co-authored-by: Banan Ashkar <banan.ashkar@mobileye.com>
This is 7-year old CMake code that never did anything because the
function invocation is missing the PROPERTIES keyword.
Adding the keyword results in build errors, so just drop the dead code
since everything seems to be working without it anyway.
Remove an assigned-to but unused variable.
Reenable the Wunused-but-set-variable warning for the conversions
suite, as it now compiles cleanly with this warning enabled.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Only disable `-Wsign-compare` for tests that do not compile cleanly
with this warning enabled. Re-enable the warning for the other tests,
so that it can catch any new occurrences.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
`gMTdata` was initialized twice, but freed only once.
Drop the first initialization with a local seed, and initialize with
`gRandomSeed` instead.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Avoid a shift by 64 on a `uint64_t`. The value resulting from the
spurious shift was overwritten later, so just avoid the shift in that
case.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
The refactoring of the conversions test dropped the workaround added
by 59a12047a ("Fix for test_conversions failure with Clang build on
Linux #1057 (#1062)", 2021-05-11).
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
For conversion from integers to float, the DataInfoSpec constructor
tries to convert `CL_FLT_MAX` to an integer. The float value cannot
be represented as an integer, which is undefined behaviour.
Fix by only doing this conversion when `InType` is a floating point
value.
While at it, use `static_cast` for the conversions.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* Modernization of conversions test, preparation to handle cl_khr_fp16 extension
* Added missing virtual descructor
* Added corrections due to code review
* More separators removed
* Fixed clang format
* Added multiple corrections related to code review
* Corrected missing implicit test lost after modernization corrections
* Corrected single, selected test to limit number of unnecessary operations
Only disable `-Wunused-but-set-variable` for tests that do not compile
cleanly with this warning enabled. This re-enables the warning for
most other tests, so that it can catch any new occurrences.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* [NFC] Remove duplicate symbol declarations
Those are provided by testHarness.h.
Signed-off-by: Kévin Petit <kpet@free.fr>
* add missing include
---------
Signed-off-by: Kévin Petit <kpet@free.fr>
* grab latest from upstream OpenCL
* Removed events for host to device data transfers
* grab latest from upstream OpenCL
* 1.) revert changes to CMakeLists.txt and run_batch script in hopes this will solve the CI issues for the PR.
2.) resolve the merge conflict in test_conversions.cpp
* 1.) resolve 2 additional merge conflicts
* 1.) resolve 1 additional merge conflicts
* locally this fails clang-format but CI version seems to require it.
* fix the warning.
* Remove now-unused event
Also, cut down a comment that is no longer accurate.
Co-authored-by: Joshua Luceno <joshualuceno@gmail.com>
Co-authored-by: Chip Davis <chip@holochip.com>
Co-authored-by: Chip Davis <cdavis5x@gmail.com>
* grab latest from upstream OpenCL
* Use clEnqueueFillBuffer rather than memset4 in all test files
* Cleanup leftover code from memset_pattern4
* Remove unnecessary map, unmap, writeBuffer from math_brute_force tests
* Remove extraneous build system change
* Appease clang-format
* Add option to perform buffer fills on the host
Co-authored-by: Taeten Prettyman <taeten.j@gmail.com>
Co-authored-by: taetenp <taet@holochip.com>
Co-authored-by: Chip Davis <chip@holochip.com>
Move functions in .h files to .cpp files where appropriate; align
prototypes and definitions; and remove functions that are not used.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Fix a few instances where an incorrect number of arguments was
supplied when calling (v)log_error.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Remove unused variables throughout the code base and enable the
`-Wunused-variable` warning flag globally to prevent new unused
variable issues being introduced in the future.
This is mostly a non-functional change, with one exception:
- In `test_conformance/api/test_kernel_arg_info.cpp`, an error check
of the clGetDeviceInfo return value was added.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
The way that program sources were being constructed involved capturing
pointers to strings that were allocated on the stack, and then trying
to use them outside of that scope. This change uses a stringstream
defined in the outer scope to build the program instead.
The host compiler will not always calculate reference values
the same, depending on optimization level. It generates
instructions that do not respond to CPU rounding mode in
the same way. Use QCOM rounding mode emulation to correctly
calculate reference values on aarch64.
* 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>
* Preserve existing release flags in MSVC
Without this the `/MD` flag is lost on Release builds,
resulting in the below error when using a Ninja CMake generator with
VS2019 compiler. Before replacement `/MD /O2 /Ob2 /DNDEBUG`, after replace
`/MD /Od /Ob0 /DNDEBUG`
```
harness.lib(testHarness.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in test_conversions.cpp.obj
```
* Remove Visual Studio 2005 release flag workarounds
* Add Travis CI jobs for Arm and AArch64
- Use fixed Linaro toolchains
- Move travis script to a shell file
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
* Fix Arm build and string comparisons added under #637
* Remove verbose flag on tar command
* Fix conversions build with gcc 4.8.5 armhf.
Re-named fplib.c to fplib.cpp.
Updated the conditions under which fplib.cpp will be included in the build by CMake.
* Build: Added a global archtiecture variable, CLConform_TARGET_ARCH.
The reset of the build can query this variable whenever archtiecture specific options are required. The current supported values of this variable are "ARM", "x86", and "x86_64".
This change also replaces all existing locations where CMAKE_SYSTEM_PROCESSOR was queried.
* Build: Added ARM64 as a valid value for CLConform_TARGET_ARCH.
* Conversions: Don't build fplib.cpp for ARM64.