159 Commits

Author SHA1 Message Date
Marco Antognini
9a481c6167 Split math_brute_force files (#1169)
* Split math_brute_force files

Split each file into two: one covering float and the other covering
double. The goal is to make it possible to diff files to identify bugs
more easily, reduce differences between code for float and double, and
ultimately reduce code duplication in all math_brute_force.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>

* Address clang-format issues

In be936303 (Remove dead code in math_brute_force (#1117), 2021-01-20)
the code was reformatted using git-clang-format, which apparently is less
reliable than clang-format itself when changes occur in large files.

With the previous split of large files, git-clang-format complains about
the format of code originating from binary_two_results_i.cpp.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-03-02 15:50:14 +00:00
Marco Antognini
84d70e23c8 Fix incorrect use of kernel parameter (#1168)
This issue was introduced in 8ad1088a (Reduce difference between files
in math_brute_force (#1138), 2021-02-10).

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-02-18 11:11:28 +00:00
Marco Antognini
70b2492f30 Regroup vtbl definitions to one translation unit (#1167)
Move function declarations to a new header file, with relevant existing
documentation.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-02-18 10:06:37 +00:00
Marco Antognini
7181bcdbac Rename files for consistency (#1166)
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-02-17 17:05:09 +00:00
Marco Antognini
5d2a4bc522 Reduce difference between files (#1155)
Moves `if (!gSkipCorrectnessTesting)` in binary_i.cpp to follow
structure of binary.cpp, unary.cpp, macro_unary.cpp and
macro_binary.cpp.

Other non-semantic changes include adding/removing new lines and
updating comments.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-02-17 09:17:34 +00:00
doe300
901f4db449 Fix compilation error in rtz mode detection (#1163) 2021-02-17 08:57:02 +00:00
Marco Antognini
b398f8c1b2 Fix typo in error handling (#1152)
When creating sub-buffers in math_brute_force, the wrong variables were
checked for runtime errors. This patch fixes this and ensures the logs
are consistent.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-02-11 11:38:01 +00:00
Marco Antognini
5d7be40e68 Remove undesired conversions from size_t to int (#1153)
Improve math_brute_force kernels by consistently using size_t to store
the result of get_global_id().

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-02-11 11:37:38 +00:00
Marco Antognini
8ad1088af9 Reduce difference between files in math_brute_force (#1138)
* Reduce differences between files

This will help reduce code duplication is future commits.

Some code is moved around, some variables are renamed and some
statements are slightly altered to reduce differences between files in
math_brute_force, yet the semantics remains the same.

The differences were identified using n-way diffs. Many differences
remain however.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>

* Workaround clang-format limitation

Introduces some insignificant spaces to force clang-format to reduce the
indentation and reduce differences between files.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-02-10 10:38:31 +00:00
Marco Antognini
b67f6bbb29 Fix command line interface for math_brute_force (#1145)
Ensure the following forms of command lines are supported, as per usage
message (-h):
 - math_brute_force [<name1> [<name2> ... [<nameN>]]]
 - math_brute_force I [J]

Remove dead/unnecessary code.

Fix regression introduced in f337e0b6 ( Fix command-line function range
for bruteforce  (#1127), 2021-01-29).

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-02-05 10:29:45 +00:00
Marco Antognini
545e4d0309 Make functions local to translation unit (#1125)
Remove unnecessary declarations.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-01-29 14:20:39 +00:00
Marco Antognini
eb2287cc1b Remove unnecessary scope (#1126)
Reformat code using clang-format.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-01-29 14:19:15 +00:00
Nikhil Joshi
f337e0b6f9 Fix command-line function range for bruteforce (#1127)
* Fix enqueue_flags test to use correct barrier type.

Currently, enqueue_flags test uses CLK_LOCAL_MEM_FENCE.
Use CLK_GLOBAL_MEM_FENCE instead as all threads across work-groups
need to wait here.

* Add check for support for Read-Wrie images

Read-Write images have required OpenCL 2.x.
Read-Write image tests are already being skipped
for 1.x devices.
With OpenCL 3.0, read-write images being optional,
the tests should be run or skipped
depending on the implementation support.

Add a check to decide if Read-Write images are
supported or required to be supported depending
on OpenCL version and decide if the tests should
be run on skipped.

Fixes issue #894

* Fix formatting in case of Read-Write image checks.

Fix formatting in case of Read-write image checks.
Also, combine two ifs into one in case of
kerne_read_write tests

* Fix some more formatting for RW-image checks

Remove unnecessary spaces at various places.
Also, fix lengthy lines.

* Fix malloc-size calculation in test imagedim

unsigned char size is silently assumed to be 1
in imagedim test of test_basic.
Pass sizeof(type) in malloc size calculation.
Also, change loop variable from signed to unsigned.
Add checks for null pointer for malloced memory.

* Fix command-line function range for bruteforce

Runnning "test_bruteforce N M" is expected to skip
first N functions and test M functions after it.
When N is 0, the test currently skips M functions
and run all functions thereafter.
Fix the test to honor semantics of these
command-line options to correctly test
first M functions when N is 0.
2021-01-29 14:13:54 +00:00
Marco Antognini
be93630330 Remove dead code in math_brute_force (#1117)
* Remove dead code

Signed-off-by: Marco Antognini <marco.antognini@arm.com>

* Remove tautological statements

PARALLEL_REFERENCE is unconditionally defined. Remove preprocessor
condition that always hold.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>

* Remove unnecessary declarations

Also removed unused macro.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>

* Format code

An unnecessary scope was removed. This formats the code using
clang-format.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-01-20 15:01:59 +00:00
Marco Antognini
e5f89249fa Apply clang-format on math_brute_force (#1104)
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-01-14 13:27:18 +00:00
Jeremy Kemp
904fb419ee Restored the embedded reduction factor to bruteforce. (#1052)
* Restored the embedded reduction factor to bruteforce.

This change was present on the GitLab branch but missed out during the transition to GitHub.

This change is intentionally as close as possible to the patch on GitLab.

Fixes #1045

* Added helper functions for bruteforce step and scale.

* Added missing files from 1e4d19b.

* Renamed getTestScale and getTestStep to set*.
2021-01-07 11:34:58 +00:00
ellnor01
25d9ff5d6e Using helper functions for clCreateKernel (#1064)
* Using helper functions for clCreateKernel

Uses of clCreateKernel following create program helper
functions, have been incorporated into
create_single_kernel_helper when suitable.

Contributes #31

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* Skip tests using clCompileProgram in offline mode

Contributes #31

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* Using type wrappers when using kernel helper functions

Also includes fix for windows build

Fixes #31

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* Remove clReleaseKernel for wrapped kernel

Fixes #31

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2021-01-07 11:34:42 +00:00
alan-baker
b7adaa5c3b Add more relaxed math conformance tests (#1079)
* Add relaxed tests for functions (in an implementation that uses
  derived functions) that define an absolute ULP error requirement, but
  were not tested in the current conformance suite
  * acos
  * asin
  * atan
  * cospi
  * sinpi
  * log10
2020-12-09 16:12:19 +00:00
Ewan Crawford
55976fad35 Permit half overflow within allowable ULP (#600)
* Permit half overflow within allowable ULP

Modify the algorithm for calculating half precision ULP error so
that it duplicates the behaviour of the single precision ULP algorithm,
in regards to allowing overflow within the defined ULP error.

In the case where the test value is infinity, but the reference is
finite, pretend the test value is 63336.0 and calculate the ULP error
against that.

Encountered this while testing half precision `hypot()` in PR !529,
for inputs `hypot(-48864.0, 43648.0)` which has reference
`65519.755799`. With RTE rounding this only just rounds to `65504` as half,
and returning INF is currently infinite ULP error. Using the leniency
introduced by this change however the error is `~0.5` within the `2` ULP
bounds defined by the spec.

* Run clang-format over changes

Code now conforms to style guidelines and allows `check-format.sh` to pass.
2020-10-28 10:13:40 +00:00
Sreelakshmi Haridas Maruthur
6b1e61f9de bruteforce: Fix out-of-domain input handling in bruteforce (#699)
Cast input array to floats before setting NANs which are also floats to
prevent large nonsensical numbers outside of the valid domains of
several math functions from being tested.

Khronos Bug: https://github.com/KhronosGroup/OpenCL-CTS/issues/491

Test Suite Affected: bruteforce Subtests: sin, cos, sincos, reciprocal

Change-Id: Ie029837f4f9dfc73d6a9c356b73158e2ad41b871
2020-09-06 08:57:27 +01:00
Jeremy Kemp
93001e99a4 Bruteforce - embedded, relaxed ulp requirements (#839)
* Add embedded profile ULP requiremnts for relaxed tests.

* Fixed exp relaxed ULP for embedded.

* Added a utility function, getAllowedUlpError, for determining FP32 ULP.

* Collection of requested changes from PR.

Re-named float_embedded_relaxed_ulps -> relaxed_embedded_error.

Re-ordered Func struct members.
2020-08-10 13:19:26 +01:00
Jacek Jankowski
9c0edebd3c Print hex values when reporting a failure (#838) 2020-07-24 11:31:48 +01:00
Grzegorz Wawiorko
450f583800 Fix code format errors vs.2 2020-07-23 17:21:07 +01:00
Grzegorz Wawiorko
2a8cecb925 Test bruteforce/conversions - run finish only on existing queue. 2020-07-23 17:21:07 +01:00
Grzegorz Wawiorko
9a006ba1a0 Spirv readiness - move to harness
Fixes support  cl_khr_il_program
2020-07-23 17:21:07 +01:00
Grzegorz Wawiorko
3730bce4e8 SPIR-V handling on different OpenCL devices version
Example usage for bruteforce and spirv_new
2020-07-23 17:21:07 +01:00
Jack Frankland
96ea9d6011 Skip Reduced Precision Testing (#819)
* OpenCL versions before 2.0 do not have precision requirements for
reduced precision math.

* Skip reduced precision testing for devices with
versions < 2.0.
2020-07-02 10:43:10 +01:00
ellnor01
164b5ef5cf Remove duplicate IsXSubnormal functions (#826)
* 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
2020-06-17 10:14:33 +01:00
Grzegorz Wawiorko
105a3aff62 Fix relaxed mode in math bruteforce - binaryOperator (#828) 2020-06-15 12:00:14 +01:00
Grzegorz Wawiorko
782fe2c83b Test bruteforce - fix relaxedMode in unary.cpp (#818) 2020-06-10 16:36:45 +01:00
Jack Frankland
ecee2c18d2 Remove gTestFastRelaxed Dependencies in Brute Force (#807)
* 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.
2020-06-04 10:44:39 +01:00
Grzegorz Wawiorko
519f658b51 Test bruteforce - fix islessgreater function for intel compiler (#811) 2020-06-04 10:44:19 +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
Ankit Goyal
4fbcd96e7f Remove "C" linkages (#781)
* Remove extern C linkages

* Update crc32 to cpp and remove extern C linkage
2020-05-20 14:16:19 +01:00
ellnor01
93e76a8a4a Ensure is_extension_available is used where possible (#722)
(Patch2)
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

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

Change-Id: I17e007e5ad009e522c5006c42537bf1170550a6f
2020-04-03 10:49:53 +01:00
Kévin Petit
cba5a191c3 Remove duplicate code setting _cpu_capabilities (#676)
All tests that have this code are using the harness which does
this already.

Signed-off-by: Kévin Petit <kpet@free.fr>
2020-03-17 10:21:18 +00:00
Kévin Petit
b2eba77d42 Get rid of test_finish macro and related ATF cruft (#633)
Closes #431

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2020-03-02 15:06:44 +00:00
Radek Szymanski
80c3a27a6a Remove unused parameter (#630)
The imageSupportRequired param is not needed in runTestHarnessWithCheck,
so just remove it.

Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
2020-02-27 15:36:28 +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
James Price
40f50d77a3 Rename test .c sources to .cpp where necessary (#604)
Remove hacks to force language from CMake files.

Closes KhronosGroup/OpenCL-CTS#25
2020-02-21 17:34:31 +00:00
Bhargav Das
b2cb18073c Improved PrintArch functions (#595) (#601)
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
2020-02-21 16:47:54 +00:00
Grzegorz Wawiorko
3b7056decd Fixes issue #502 - bruteforce do not need build option (#525) 2019-12-19 11:13:56 +00:00
Kévin Petit
937a2cb67d Use clCreateCommandQueue when possible (in a few tests) (#474)
In all these cases, the new entrypoint is not necessary. These
changes enable the tests to work or are a necessary step to get
the tests to work on an OpenCL 1.2 implementation.

While this may not be the final approach we want to solve this
specific compatibility issue, it also has the nice property of
reducing the diff with cl12_trunk until we merge.

Signed-off-by: Kévin Petit <kpet@free.fr>
2019-11-11 17:16:22 +00:00
Pavan K Lanka
b763c6b07e Fix for Khronos https://github.com/KhronosGroup/OpenCL-CTS/issues/249 (#444)
* Fix for Khronos https://github.com/KhronosGroup/OpenCL-CTS/issues/249 where incoming errors are overwritten by exit block

* Fix for build failure that was observed in cl12_trunk with prior #249 change
2019-09-23 21:01:21 +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
03650057bb Move printing sub-test information into test harness (#421)
This removes all the duplicated code from each test, and moves it to
test harness so that we have single place where this information is
printed.

Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
2019-08-05 15:16:12 +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
Grzegorz Wawiorko
7ee74ae17f Fix spirv path in bruteforce tests (#357)
* Fix spirv path in bruteforce tests

* Compilation fix - align_malloc already defined in kernelHelpers.c

* Fix spirv path in bruteforce tests - more places
2019-07-10 13:56:38 +01:00
Grzegorz Wawiorko
8c7bd610d9 Intel compiler bruteforce - fix signbitl function (#288) 2019-06-11 09:42:27 +01:00
Radek Szymanski
2668020fb7 cl22: Reuse test harness code in math_brute_force (#196)
Some of the setup functionality is already there in the test harness, so
use that and remove the duplicated code from within the suite.

Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
2019-04-22 12:06:02 +01:00