Commit Graph

849 Commits

Author SHA1 Message Date
Pierre Moreau
06f7661fdc basic/async: Check for extension only once per test (#1242)
As the extension is vector size and type independent, we only need to
check for the extension once per test and not for every possible
combination of inputs, thereby drastically reducing the log output of
the test when the extension is not supported.
2021-05-12 11:39:17 +01:00
sravikumar3393
59a12047a8 Fix for test_conversions failure with Clang build on Linux #1057 (#1062)
* Avoid optimization by using volatile qualifier
    * Fix both uint2float and ulong2double
2021-05-11 18:17:48 +01:00
Marco Antognini
3dd6d4137d Avoid manual memory management, fixes #975 (#1240)
Fix heap-buffer-overflow reported by AddressSanitizer: ensure the
appropriate number of elements are allocated for the list of tests.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-05-11 18:06:16 +01:00
Marco Antognini
3dab3df48d Report inputs for worst errors (#1231)
Builtin functions producing two results can have their worst error, for
each result, on different inputs. Report both inputs.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-05-07 09:29:28 +01:00
Marco Antognini
5daca107ad Remove dead variables and functions (#1238)
These were identified using Clang's -Wunused warning flag.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-05-07 09:28:38 +01:00
Marco Antognini
01497c402e Reduce scope of variables (#1228)
Make variables local to loops, with appropriate types. These variables
are not read after the loop without being reset first, so this patch
doesn't change behaviour.

These variables should now be used for one purpose only, making it
easier to reason about the code. This will make future refactoring
easier.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-04-28 09:30:51 +01:00
Marco Antognini
cba7a8a537 Remove dead CMake code (#1230)
Remove CMake statements that have no effect in math_brute_force.

set_source_files_properties without a list of files has no effect.

When MODULE_NAME is FOO,
set_source_files_properties(${MODULE_NAME}_SOURCES ...) sets the
properties of "FOO_SOURCES", not of the files listed in the variable
named FOO_SOURCES.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-04-28 09:30:25 +01:00
Chetan Mistry
edc36b5d53 Remove NULL Platform Check for Negative clGetPlatformInfo (#1222) (#1229)
Part of the negative CTS test for clGetPlatformInfo
incorrectly tested with a NULL platform. As this is a
special case it meant that the test was not correct.
This change removes the incorrect part of the test so that
it conforms with the OpenCL specification.

Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com>
2021-04-27 15:43:39 +01:00
Marco Antognini
b8d1ea9962 Fold constant global variable (#1217)
gWimpyBufferSize is never modified and is actually not used to modify
the number of tests -- gWimpyReductionFactor is used for that purpose by
some tests, but not all.

This patch removes this unnecessary global variable to simplify the
codebase, and reduce differences between tests.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-04-21 10:45:34 +01:00
Marco Antognini
7542ae2443 Fold code into loop (#1218)
Use one loop to read buffers from device, with the last read operation
blocking until complete.

This pattern cannot be elegantly refactored just yet, mainly for two
reasons:
 - Some tests use goto statements to clean their resources.
 - Some tests (not modified in this patch) only use blocking read
   operations.

Once code is further unified, this pattern can be refactored into a
helper function.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-04-20 17:10:29 +01:00
Marco Antognini
6683fa91a9 Use lambda to reduce amount of code (#1219)
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-04-20 17:10:06 +01:00
Marco Antognini
7286e06a94 Make variables and functions local to translation unit (#1216)
* Make variables and functions local to translation unit

Make some global variables local to function, or remove them when
actually dead.

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

* Address comments

Remove unused code.
Reduce scope of gDoubleCapabilities.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-04-15 18:19:09 +01:00
Marco Antognini
b7e7a3eb65 Remove unsupported code (#1211)
* Remove code for runtime measurement

The GetTime() and associated functions are not fully implemented on
Linux. This functionality is assumed to be untested, or unused at best.

Reduce differences between tests by removing this unnecessary feature.
It can be (re-)implemented later, if desired, once the math_brute_force
component is in better shape.

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

* Coalesce if-statements

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

* Keep else branch

Address comments.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-04-13 15:58:44 +01:00
jianguang.li
8e59817ba6 Fix conversion fail when build with -O2 fail (#1193)
* fix conversion fail when compile with gcc -O2

* fix format check error

* fix format check error
2021-04-07 09:19:58 +01:00
Grzegorz Wawiorko
71bef8563e New subgroups - full changes set (#1074)
* Extended subgroups - extended types types

* Extended subgroups - non uniform vote tests

* Extended subgroups - non uniform arithmetic tests

* Extended subgroups - ballot tests

* Extended subgroups - clustered reduce tests

* Extended subgroups - shuffle tests

* Extended subgroups - formating issues

* Extended subgroups - review fixes

* Extended subgroups - review fixes

Fixed: removed additional brakes, kernel_sstr

* Extended subgroups - fix macos build error

* Extended subgroups - review fixes

Fixed: mac os build error

* Extended subgroups - data type verification example

* Extended subgroups - error unification

* Extended subgroups - fix header years

* Extended subgroups - use is_half_nan

* Extended subgroups - compare half as float

* Review fixes mostly for ballot functions.

- Modify kernels for better handling active/inactive workitems
- Modify gen/chk functions for handling non uniform workgroup sizes
- Introduce new variables naming convention
- minor fixes

* Extended subgroups - simplification data generation for ballot lsb/msb functions

* Extended subgroups - minor fixes

* Extended subgroups - move common code to function

* Extended subgroups - formatting errors fix

* Extended subgroups - fix build error

* Extended subgroups - sub_group_elect more sophisticated

Define mask which is 4bytes pattern where bit 1 means work item is active.
If workitem in subgroup matches pattern then run sub_group_elect()

* Extended subgroups - fix Ubuntu build error

* Extended subgroups - voting function review fixes

* adjust all function for using masks
* remove calculate templates
* merge code to one common template
* check results only in active workitems
* normalize values on host side
* minor fixes

* Extended subgroups - fix typos

* Set of fixes and improvements after review

* define WorkGroupParams to stop extended parameters list in function
* better workitems mask handing (WorkGroupParams)
* narrow values of data input generation to avoid overflows (arithmetic func)
* implement work item masks for arithmetic functions
* enable half type testing for reduction/scan/broadcast
* minor fixes

* Extended subgroups - fix Linux issues

* Extended subgroups - fix sub_group_local_id data type

* Extended subgroups - use vector instead of array.

* Extended subgroups - change names to subgroup

* Extended subgroups - uncomment code, fix build

* Extended subgroups - build fix, use cl_half_from_float func

* Extended subgroups - remove is_half_nan

* Extended subgroups - do no use undef min/max

* Extended subgroups - use parenthesis, fix formatting
2021-04-06 17:25:48 +01:00
Marco Antognini
c5e4ca6c91 Remove unnecessary APPLE specific code (#1188)
To reduce differences between tests, remove APPLE specific code from
unary tests as no other test have similar logic.

Ensure gMeasureTimes is consistently initialised regardless of operating
systems to ensure a consistent command line interface.

The remaining APPLE specific pieces of code relate either to include
paths, or to the implementation of PreventSleep(), ResumeSleep() and
GetTime(). Those are not removed in this commit.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-04-06 16:43:55 +01:00
James Price
baa226a779 Remove compiler options that are specific to Apple (#1114)
These are causing test failures for non-Apple implementations of
OpenCL running on macOS.
2021-04-06 16:42:46 +01:00
Marco Antognini
5281b4c916 Improve consistency of clEnqueueWriteBuffer operations (#1195)
Reduce differences between tests by ensuring all these operations are
non-blocking.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
v2021-03-25-00
2021-03-24 16:29:25 +00:00
Marco Antognini
8488d4b2de Use the same kernel name for all tests (#1194)
Make signature of BuildKernel more consistent across tests: now only two
variants exist:

  int BuildKernel(const char *name, int vectorSize, cl_kernel *k,
                  cl_program *p, bool relaxedMode)

or

  int BuildKernel(const char *name/symbol, int vectorSize,
                  cl_uint kernel_count, cl_kernel *k, cl_program *p,
                  bool relaxedMode)

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-03-24 16:20:05 +00:00
Marco Antognini
ef19796590 Improve log consistency (#1196)
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-03-24 16:19:37 +00:00
Sven van Haastregt
dbd3e787fe Do not dereference null pointer for no matching tests (#1191)
When invoking for example

    test_c11_atomics test-that-does-not-exist

parseAndCallCommandLineTests() would attempt to dereference
`resultTestList` which is still a null pointer.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2021-03-18 21:46:05 +00:00
Zakaria Taha
6b36f645b8 Add tests to proposed new builtin async_copy functions with a bug fix. (#725)
* Add tests to proposed new builtin async_copy functions with a bug fix.

* Revert "Add tests to proposed new builtin async_copy functions with a bug fix."

This reverts commit 7d0f16d014.

* Add tests to proposed new builtin async_copy functions.

* Added is_extension_available to check if an extension is available.

* Added is extension available for test_async_copy_fence.

* fix build issues on windows.

* include algorithms.h for async copy 2D/3D.

* adding algorithms header.

* Fix numLines - 1 in maxTotalPlanesIn/Out.

* fix formatting violations.

* fixed formatting issue.
2021-03-18 14:27:59 +00:00
Marco Antognini
111bb2b185 Fix discrepancy in logging messages (#1189)
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-03-17 09:50:30 +00:00
Marco Antognini
da2a1bd4a5 Remove trivially dead code (#1190)
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-03-17 09:50:11 +00:00
Marco Antognini
ee600e89d7 Reduce differences by using common names (#1187)
Improve format.

The binary_operator tests are left untouched by this commit as they
require some non-automatic changes.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-03-11 09:44:38 +00:00
John Kesapides
68ee30fb4b Fix possible size_t overflow in 32-bit builds. (#1131)
* Fix possible size_t overflow in 32-bit builds.

Use cl_ulong temporary values for row/slice_pitch.

Signed-off-by: John Kesapides <john.kesapides@arm.com>

* Remove redundant casts

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2021-03-09 22:57:49 +00:00
Marco Antognini
a53917a37e Move code around to reduce differences (#1185)
Code is moved to reduce the differences between tests for single- and
double-precision.

Improve consistency in double-literal.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-03-09 22:55:33 +00:00
Marco Antognini
a483255e50 Fold functions for nextafter (#1176)
* Add assertion to prove isNextafter is true iff the builtin is nextafter()

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

* Fold functions for nextafter

There is no need to differentiate nextafter() from other binary builtin
functions when creating the vtbl entries.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-03-09 09:18:40 +00:00
Stuart Brady
6f2cd12a0b Deduplicate logging of pixel differences (#1175)
clCopyImage and clFillImage contain near-duplicate code for logging of
pixel difference errors.  Move this into imageHelpers.

Signed-off-by: Stuart Brady <stuart.brady@arm.com>
2021-03-09 09:09:52 +00:00
Marco Antognini
17632c9736 Remove undesired conversions from size_t to int (#1180)
Improve math_brute_force kernels by consistently using size_t to store
the result of get_global_id().

This change was missed in 5d7be40e (Remove undesired conversions from
size_t to int (#1153), 2021-02-11).

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-03-09 09:09:10 +00:00
Marco Antognini
afe745f47e Fix typo in array size computation (#1178)
Because specialValuesInt2Count < specialValuesIntCount (when correctly
computed), there was no out-of-bound access when running the tests. This
also means additional cases will be covered now that the typo is fixed.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-03-09 09:08:38 +00:00
jianguang.li
3307ebed9a fix out of boundary when strcpy (#1173)
* fix out of boundary when strcpy, fix #1170

* fix format check failure

* fix format check error
v2021-03-05-00
2021-03-05 14:25:09 +00:00
Marco Antognini
e2fb655e4c Use C++ headers instead of C headers (#1179)
Remove some unnecessary includes.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-03-05 14:24:03 +00:00
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
Kévin Petit
66eb912ad5 ci: move code format check out of the main job/script (#1154)
A bit cleaner than the written-in-a-haste-to-get-ci-going-again current approach.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2021-02-23 14:23:18 +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
Sebastian Łużyński
8b5d3c2055 Fix buffer tests memory leaks (#1165)
* Fix buffer tests memory leaks

This change fixes buffer tests, broken by PR #1082. This pull request is similar to #1160

* Fix formatting
2021-02-18 10:07:10 +00: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
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
John Kesapides
c67aa0535b Fix Minor memory leaks in test_buffer/compiler. (#1160)
* Fix Minor memory leaks in test_buffer/compiler.

Signed-off-by: John Kesapides <john.kesapides@arm.com>

* Fixes in test_buffer
* Remove commented unmap call
* remove unused ii variables.

Signed-off-by: John Kesapides <john.kesapides@arm.com>

* test_buffer fixes:
* test_buffer_fill remove unsued ii

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2021-02-17 09:19:06 +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
Sven van Haastregt
87a1525d53 NFC: clang-format test_basic_parameter_types.cpp (#1151)
* Use raw string literals in basic parameter test; NFC

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Change-Id: I294d2aa95c6bab37e5efb7c8b1e43a06d31a0081

* clang-format test_basic_parameter_types.cpp; NFC

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Change-Id: I0792037f5fa6f79d493c099bed15238f0f1486ac
2021-02-11 11:37:14 +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
Chetan Mistry
f6b501352d Implement Negative Test for Platform Layer Functions (#1076)
* Implement Negative Tests for clPlatform Functions

This change introduces negative tests for clPlatform
functions as well as changes to the Harness to help with
other negative tests.

Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com>

* [SQUASH] Remove magic macro from Negative Platform Tests

This change removes the negative-testing macro and all
other changes related to its usage.

Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com>
2021-02-05 16:36:16 +00:00
Pierre Moreau
3719a0183c api: Fix testing of local memory size requirement (#1112)
The current test would always end up assuming a minimum of 16 KB
regardless of the exposed OpenCL version, and the logic for testing the
OpenCL version was hard to follow.

Besides fixing the test for OpenCL 1.1 through 2.1, it also
* adds support for OpenCL 2.2, 3.0, and future OpenCL versions (as long
  as `get_device_cl_version()` supports those);
* adapts the error message to mention the currently exposed OpenCL
  version rather than a hardcoded OpenCL 1.1;
* reports the advertised local memory size as KB and not Kb, since local
  memory size is given in bytes.
2021-02-05 11:34:10 +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