Commit Graph

48 Commits

Author SHA1 Message Date
Sven van Haastregt
1884042f5d [NFC] cmake: do not suppress -Wunused-but-set-variable globally (#1723)
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>
2023-05-16 09:58:04 +01:00
Ben Ashbaugh
5b87f53fe8 define CL_NO_EXTENSION_PROTOTYPES (#1325)
* 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.
2023-04-11 09:30:01 -07:00
Sven van Haastregt
9772516c3f cmake: Enable -Wall for non-release builds (#1686)
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>
2023-04-05 09:39:38 +01:00
Sven van Haastregt
8e74722a0a cmake: Fix -Wno- handling in add_cxx_flag_if_supported (#1656)
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>
2023-03-29 11:10:27 +01:00
Sven van Haastregt
9eec8f3352 Suppress -Wdeprecated-declarations for macOS (#1627)
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>
2023-01-27 13:34:50 +00:00
Sven van Haastregt
3cadff7115 Fix unused-function warnings and enable -Wunused-function (#1576)
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>
2022-12-13 09:47:48 -08:00
Kenneth Benzie
babed4c175 Make building the Vulkan interop tests optional (#1530)
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.
2022-10-27 10:16:16 +01:00
Sven van Haastregt
92285f7c9d cmake: Add set_gnulike_module_compile_flags (#1510)
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>
2022-09-22 13:17:55 -07:00
Sven van Haastregt
6554c49018 [NFCI] Remove unused variables and enable -Wunused-variable (#1483)
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>
2022-09-08 12:54:36 +01:00
Stuart Brady
cdf5a105fc Fix misleading indentation and enable -Wmisleading-indentation (#1458)
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
2022-08-02 18:16:03 +01:00
Jim Lewis
03da14d6a9 Fix clang 10 build errors (#1387)
* 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
2022-04-19 09:57:15 -07:00
Ben Ashbaugh
995c7dbfbb suppress MSVC strdup warning (#1314) 2021-08-31 11:44:17 -07:00
Ben Ashbaugh
39fdb462be define NOMINMAX in the CMakefile to fix std::min and std::max on MSVC (#1308) 2021-08-28 10:21:34 +01:00
Kévin Petit
6c3c7e5266 Remove unused definitions in CMakeLists.txt (#1302)
Signed-off-by: Kévin Petit <kpet@free.fr>
2021-08-19 12:15:47 +01:00
Marco Antognini
01aa55029d Update warning options (#1252)
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>
2021-05-21 10:06:13 +01:00
Sreelakshmi Haridas Maruthur
6c8045911a gles: Fix compile warnings. (#1070)
* 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>
2021-05-18 18:10:24 +01:00
Kévin Petit
ad8ab3fe90 Remove OpenCL C++ tests (#1241)
* Remove OpenCL C++ tests

Agreed in the 2021/05/11 teleconference.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>

* fix CI
2021-05-13 09:13:03 +01:00
Kévin Petit
fc67d7b28f Move media_sharing tests to test_conformance/extensions/ (#1164)
* 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
2021-02-18 10:06:56 +00:00
Sreelakshmi Haridas Maruthur
16ddfbb1ae gles: Fix compile errors. (#976)
* fix gles build error

* fix format check fail

* fix Werror and link error

* gles: Makefile changes

Change-Id: Ie493a730e6004f9251bbf9b534f758e0dc920191

Co-authored-by: Guang <891528583@qq.com>
2020-11-09 11:04:57 +00:00
Sreelakshmi Haridas Maruthur
6adf4ead5c build: Various improvements. (#743) (#1006)
- 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
2020-10-21 10:02:22 +01:00
Ben Ashbaugh
75ce4c5b0e API Feature Consistency Test, Part 2 (#912)
* 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
2020-09-08 17:24:09 +01:00
Ewan Crawford
5bb4d089dd Specify GCC flag -frounding-math on x86 (#873)
* 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>
2020-08-18 08:00:14 +01:00
Jim Lewis
0ee260b036 Arbitrary output directory support for compiler test build copies (#848) (#851)
* Move copy from top level down to test_compile module as post-build copy
* Fix windows VS2015 build break
2020-07-24 14:30:24 +01:00
James Price
944b0a8178 Enable -Werror for GCC/Clang builds (#786)
* 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
2020-05-27 19:13:11 +01:00
Kévin Petit
5e2f5b857e Accept OpenCL 3.0 in version parsing code and use where appropriate (#752)
* 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
2020-04-30 11:51:06 +01:00
Jeremy Kemp
4b281af946 Build: Ensure compilers required directory structure is present. (#662)
The compiler test requires that directories named "includeTestDirectory" and "secondIncludeTestDirectory" are present with the binary.
2020-03-07 14:36:53 +00:00
Kévin Petit
c9c3c73aa9 make execution of workgroups test optional (#643) 2020-03-05 08:22:36 +00:00
Kévin Petit
58eb2373a8 Add Travis CI jobs for Arm and AArch64 (#638)
* 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
2020-03-04 15:18:16 +00:00
Jeremy Kemp
61eb79042f Fplib build fix (#637)
* 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.
2020-03-02 17:09:08 +00:00
Jeremy Kemp
996c353c0e CMake Build: Tidy up when -msse2 is passed to gcc (#622)
* 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.
2020-02-25 08:56:54 +00:00
Jeremy Kemp
e3bad1f90e Copy all csv files during build. (#626)
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.
2020-02-25 08:54:27 +00:00
Kévin Petit
681150254f Remove some dead code (#586)
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2020-02-11 09:04:46 +00:00
Kévin Petit
2ad175fb57 Remove redundant variable in CMakeLists.txt (#573)
Fixes #546

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2020-02-04 15:54:40 +00:00
Grzegorz Wawiorko
1d7bd0d10d GL sharing: Test name adjustment and Windows compilation clarification. (#336)
* 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.
2019-12-03 09:32:43 +00:00
Grzegorz Wawiorko
1bffbbe3e4 Fixes #488 - cmake adjustment d3d and media_sharing (#489) 2019-11-15 13:12:17 +00:00
Kévin Petit
76fd344e64 Set required language standards using CMake (#432)
- 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>
2019-08-08 12:02:18 +01:00
Kévin Petit
fa4b278432 Build the harness as a static library (#430)
This reduces by a factor of roughly two the number of files to build.

Fixes #193.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2019-08-07 17:18:10 +01:00
Radek Szymanski
a45012be7a Remove -g flag from conformance build (#423)
This reduces the size of binaries, and makes the tests finish tiny
bit faster. The debug symbols can be enabled by passing to cmake one of:
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_BUILD_TYPE=RelWithDebInfo

Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
2019-08-05 13:54:42 +01:00
Kevin Petit
ef832c330c Stop using ../../test_common to include common headers
Fixes #395.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2019-08-01 18:41:12 +01:00
Kévin Petit
be80a7feaf Align offline compilation with cl21_trunk (#400)
Add a special case for the Khronos compiler and always use it for
OpenCL C++, otherwise use the same logic as on the cl21_trunk
branch.

The CMake option to pass the path to the khronos compiler has
been renamed to KHRONOS_OFFLINE_COMPILER_OPTIONS and is no longer
mandatory.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2019-07-30 11:52:31 +01:00
Grzegorz Wawiorko
bcf994c3a3 Fix building media sharing tests (#389)
* Add media_sharing to cmakes

* Adjust cases to ADD_TEST macro

* Review fixes
2019-07-29 16:07:52 +01:00
Grzegorz Wawiorko
802995053a Intel compiler changes in cmake (#286) 2019-06-11 09:26:36 +01:00
Pierre Moreau
2967b1d705 cl22: CMake improvements (#237)
* Do not append non-existing folder to CMAKE_MODULE_PATH

Fixes #221

* Define CL_TARGET_OPENCL_VERSION to 220

Fixes #227

* Define cmake_minimum_required as first operation

The CMake documentation mentions that
> Call the cmake_minimum_required() command at the beginning of the
> top-level CMakeLists.txt file even before calling the project()
> command. It is important to establish version and policy settings
> before invoking other commands whose behavior they may affect.

* CMake: Match both AppleClang and Clang
2019-04-30 22:20:45 +08:00
Pierre Moreau
6e9736cf1e Fix typos in main CMakeLists.txt (#234) 2019-04-27 08:35:04 +08:00
Pierre Moreau
e597cb53b8 Add toggle for enabling OpenGL ES interop tests 2019-04-26 01:38:51 +01:00
Pierre Moreau
e0091e7cf6 Mark the graphics interop toggles as options
This allows enabling/disabling them via CMake without editing the
CMakeLists.txt file.
2019-04-26 01:38:51 +01:00
Kevin Petit
95b040bec2 Synchronise with Khronos-private Gitlab branch
The maintenance of the conformance tests is moving to Github.

This commit contains all the changes that have been done in
Gitlab since the first public release of the conformance tests.

Signed-off-by: Kevin Petit kevin.petit@arm.com
2019-03-05 16:24:50 +00:00
Kedar Patil
2821bf1323 Initial open source release of OpenCL 2.2 CTS. 2017-05-16 18:44:33 +05:30