In CMake 3.24+, there is built-in support for adding -Werror that does
not require adding -Werror explicitly, and allows it to be downgraded to
a warning if the user wants that. Use this, to account for warnings that
have false positives.
This enables many useful newer C++ features. C++17 is already required
by many components of the Khronos ecosystem.
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
Add custom commands and targets to automatically assemble and validate
the SPIR-V shaders used by the test.
Automatic assembly depends on finding `python3`, `spirv-as` and
`spirv-val`. `SPIRV_TOOLS_DIR` can be defined by the user during
configuration to provide an override path. Default behaviour assumes
that the binaries exist in `PATH`.
---------
Signed-off-by: Ahmed Hesham <ahmed.hesham@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>
Currently Intel® C++ Compiler Classic (ICC) is supported to build
OpenCL-CTS on Windows. This compiler has been discontinued since the
second half of 2023. Instead, Intel recommends that users transition to
use the LLVM-based Intel® oneAPI DPC++/C++ Compiler (ICX).
This change is to enable users to build OpenCL-CTS with ICX on Windows.
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>
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>
Fix an instance of this warning in mem_host_flags.
Only disable `-Wsometimes-uninitialized` for the SVM test, which does
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>
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>
* define CL_NO_PROTOTYPES
When we switch to generated headers this will suppress declaration
of extension functions, so we can continue to declare function
pointers with the same name.
* switch to CL_NO_EXTENSION_PROTOTYPES
CL_NO_PROTOTYPES will omit declarations of core OpenCL APIs also.
Enable a larger set of compiler warnings globally for gcc/clang-like
compilers. This should help catch issues early and result in better
code quality. These warnings are primarily aimed at OpenCL-CTS
developers, so only enable them for non-release builds.
Ensure `-Wall` and `-Werror` are set before any `-Wno-...` options, as
the `-Wall`/`-Werror` flags undo `-Wno-...` for some compilers.
The code base does not compile cleanly with `-Wall` yet, so disable
some warnings. Do this globally for now, to keep this patch small and
localized.
Silence `-Wunknown-pragmas` (instead of only making them non-fatal),
to avoid verbose warning logs.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
The `-Wno-...` compiler flags only result in a diagnostic if another
diagnostic is emitted. When passing such flags to
`add_cxx_flag_if_supported` (and `check_cxx_compiler_flag`), the test
would always succeed. For such cases, test the `-W...` flag instead
of the `-Wno-...` flag.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Xcode 14 deprecated functions such as `sprintf` which is used in many
places. As an immediate fix for the pre-commit checks, disable
deprecated function warnings when building for macOS.
Contributes to https://github.com/KhronosGroup/OpenCL-CTS/issues/1626
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.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>
Allow enabling/disabling building of the Vulkan interop tests via CMake
option without modifying the CMake. This matches the optionality of the
D3D10, D3D11, GL, and GLES interop tests.
Factor out a macro to set module-specific compilation flags for
GNU-like compilers. This simplifies setting compilation flags per
test.
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>
* Fix clang 10 build errors
Lossy casts due to inexact float representation of CL_INT_MAX
* Fix clang format
* Remove implicit-const-int-float-conversion flag
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>
* 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>
* Move media_sharing tests to test_conformance/extensions/
And rename to cl_khr_dx9_media_sharing.
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
* format code
* more format changes
- Remove the build_<platform> scripts that were simply calling cmake in favor of
using cmake directly
- Move flag CRT_SECURE_NO_WARNING into a section specifically for visual studio
- Change vendor file selection to just use the file if present
- Add a variable for determining whether to link against pthread
- Delete all lines in CMakeVendor.txt so each implementation can define their own
Change-Id: Ibbd83521ce4d42d09dcbd0b16efa9fbe6cbf785d
* 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
* 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>
* 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
* 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.
* Define CMAKE_ARM_COMPILER automatically (#469)
Makes use of CMAKE_SYSTEM_PROCESSOR to detect whether compilation is happening for an ARM architecture.
* Use the correct guard for specifying msse2 compiler flags.
Bruteforce and conversions were only checking against ANDROID which was not sufficient for ARM Linux builds.
* Remove redundant uses of the msse2 compiler flag.
* Globally set -msse2 for x86/amd64 gcc, Apple and Clang builds.
This is a change in behaviour. Prior to this commit, msse2 was only set for bruteforce and conversions.
msse and mfpmath=sse were already set globally prior to this change.
This commit introduces a generic method of copying the opencl_conformance_tests_*.csv files during the build.
Fixes any unspecified files from being omitted during the copy process.
* Test name adjustment and Windows compilation clarification.
* Add CLConform_GL_LIBRARIES_DIR CmakeLists variable for GL support
* GL sharing tests - library names justification
* Fix compilation errors function are overridden in glext.h.
- remove compiler-specific options
- disable GNU extensions
- require C++11 and C99 for the whole code base
Signed-off-by: Kevin Petit <kevin.petit@arm.com>