Commit Graph

768 Commits

Author SHA1 Message Date
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
Stephen Clarke
fad6a005c9 Fix test_vector_swizzle possible overwrite of padding of 3-element vectors (#1124)
Use vstore3 to ensure padding is not overwritten in destination buffer.

Fixes #1120
2021-02-03 14:34:18 +00:00
Grzegorz Wawiorko
216455842d Change arg type to unsigned int from signed int (#1078)
* Change arg type to unsigned int from signed int

* Fix formatting issues
2021-02-02 16:43:37 +00:00
ellnor01
ca673af488 First steps in tidying image/kernel_read_write tests (#1121)
* Move common global variable and functions to header

InitFloatCoords for 3D read images has also been renamed
so it can later be used as a common function

Contributes #616

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

* Set-up for using 3D functions as a base

test_read_image_3D had been moved to common.cpp (and renamed
test_read_image) along with corresponding
determine_validation_error_offset and InitFloatCoords.

Only function names and the formatting have been changed.

Contributes #616

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2021-02-02 08:56:00 +00:00
Stephen
4abea6f761 Fix literal integer types for atomics tests (#1059)
* Fix literal integer types for atomics tests

* [NFC] Format previous changes
v2021-02-01-00
2021-02-01 09:23:10 +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
bfca863cb8 Handle NULL hostptr in conformance image tests (#1087)
* 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.

* Handle NULL hostptr in conformance image tests

As per the spec, clCreateBuffer and clCreateImage return
CL_INVALID_HOST_PTR if host_ptr is NULL
and CL_MEM_USE_HOST_PTR or CL_MEM_COPY_HOST_PTR are set in flags
or if host_ptr is not NULL
but CL_MEM_USE_HOST_PTR or CL_MEM_COPY_HOST_PTR are not set in flags."

Host pointer should be NULL when USE/COPY_HOST_PTR is not set in flags.

* Revert "Handle NULL hostptr in conformance image tests"

This reverts commit 49fa049f9b.

* Move cl_mem_flag and host_ptr check to ImageHelper

Add a check to see if cl_mem_flag has
USE_HOST_PTR or COPY_HOST_PTR.
Override host_ptr with NULL if none of them
are specified.
2021-01-29 14:18:13 +00:00
John Kesapides
5930853a9b Minor fixes for clCopyImage. (#1130)
* Minor fixes for clCopyImage.

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

* Convert comment to CTS style.
Return error code instead of -1 in clFinish.
2021-01-29 14:16:55 +00:00
John Kesapides
c587b45a2b Minor fixes for CL_ARGB channel order. (#1128)
Signed-off-by: John Kesapides <john.kesapides@arm.com>
Change-Id: I4f6bbce14535f6156365a5a46c4739d6a7257ab2
2021-01-29 14:15:16 +00:00
Stuart Brady
31fafb0ff5 Install generate_spirv_offline.py script (#1109)
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
2021-01-29 14:14:45 +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
ellnor01
bf883dc800 Fix compilation issues for conforming_version.cpp (#1113)
Previously this file used the auto keyword to
declare a string. This can cause compilation
issues when used in a later function.

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2021-01-22 10:28:47 -05:00
Nikhil Joshi
0130c24fe5 Fix malloc-size calculation in test imagedim (#1100)
* 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.

* Use size_t instead of int for imagedim

The size calculation for image with larger dimensions
is overflowing with int values.
Change image dim variables to use size_t
to avoid overflow.
While at it, fix formatting at various places.

* Use new instead of malloc in test imagedim

Use new and delete in place of malloc
and free through test_basic imagedim
to avoid NULL pointer checks.

* Revert sizeof changes from size calculation

As the types of width and height are now
changed to size_t, sizeof is not required
in size calculation.
Revert the same.
2021-01-21 13:31: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
James Price
af6d55d68c Use delete[] to deallocate after new[] (#1107)
* Use delete[] to deallocate after new[]

* Fixup formatting with git-clang-format
2021-01-19 16:35:30 +00:00
Grzegorz Wawiorko
0d74b3f926 Test api fix - sampler properties is 0 in compatibility mode (#1106) 2021-01-15 16:31:03 +00:00
James Price
03a0989998 Use std::vector for format lists in images suite (#1105)
* Use std::vector for format lists in images suite

Avoids memory deallocation issues and generally simplifies the code.

* Fixup formatting with git-clang-format
2021-01-14 13:27:59 +00:00
AlexBinXie
0b6fbd15d1 Use glFinish to replace glFlush (#1102)
In OpenCL spec 1.1:
"Prior to calling clEnqueueAcquireGLObjects, the application must ensure that any pending GL
operations which access the objects specified in mem_objects have completed. This may be
accomplished portably by issuing and waiting for completion of a glFinish command on all GL
contexts with pending references to these objects."

Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
2021-01-14 13:27:45 +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
Anastasia Stulova
ffa75c37ce Test cl_ext_cxx_for_opencl (#1095)
Add tests for API extension for compilation
of kernels in C++ for OpenCL language.
* Test that -cl-std=CLC++ is accepted and a
  basic kernel with C++ features is compiled.
* Test that API extension reports the same
  language version as __OPENCL_CPP_VERSION__.

This commit also adds a separate folder for extension
tests.

Signed-off-by: Victoria Holodovsky <victoria.holodovsky@arm.com>

Co-authored-by: Victoria Holodovsky <victoria.holodovsky@arm.com>
2021-01-12 10:17:13 +00:00
james-morrissey-arm
901f5fcb63 Fix samplerlessReads read_write (#329) (#1016)
The test was trying to create read_write image with read_only formats.
Make it use common image formats for both read_only and read_write
flags when creating images.

Fixes issue #329

Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
Signed-off-by: James Morrissey <james.morrissey@arm.com>

Co-authored-by: Radek Szymanski <radek.szymanski@arm.com>
2021-01-11 15:02:26 +00:00
Grzegorz Wawiorko
2597027737 Use highest OpenCL C version (#1081)
* Set the highest supported OpenCL C version.

* Remove gDeviceLt20 variable - not used anymore.

* Fix formatting issues
2021-01-11 13:54:19 +00:00
James Price
f02cbad2e3 Fix scope of clEventWrapper declarations (#1099)
This change allows us to remove the extra clReleaseEvent calls which
were causing double-free issues.
2021-01-10 12:55:25 +00:00
james-morrissey-arm
24e6a9125c Use the right flags when creating images (#328) (#1015)
Test was querying for supported images with CL_MEM_WRITE_ONLY flag, but
always used CL_MEM_READ_ONLY to create images.

Fixes issue #328

Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
Signed-off-by: James Morrissey <james.morrissey@arm.com>

Co-authored-by: Radek Szymanski <radek.szymanski@arm.com>
2021-01-07 12:26:44 +00:00
ellnor01
18c54be0a4 Validate CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED (#1086)
* Validate CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED

Adding test to validate value returned from clGetDeviceInfo with
CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED.

Fixes #993

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

* Fixes for formatting on computeinfo add tests

Fixes #993

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2021-01-07 11:39:57 +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
Chetan Mistry
85bae70f81 Fix Context Leak in api:clone_kernel (#1090)
In this test we repeated call create_single_kernel_helper
to create different kernels but reuse the same clProgramWrapper.
create_single_kernel_helper() creates a new program each time it
is called, creating a new reference on the underlying context.
When the test ends, the program is released (as it should when
using the clProgramWrapper), however there are multiple program
objects attached to the context resulting in reference leak errors.

Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com>
2021-01-04 16:13:06 +00:00
James Price
1cd9d084d5 Fix implicit int->float warning inside kernel (#1093)
* Fix implicit int->float warning inside kernel

This kernel is used to test various compiler options including
-Werror. Some compilers produce a warning about the implicit
conversion which results in this test failing when -Werror is used.

* Fix formatting
2021-01-04 16:12:44 +00:00
ellnor01
42d58be9a3 Use clang-format-9 binary in Github Actions (#1088)
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2021-01-04 15:20:55 +00:00
Chetan Mistry
5f869e1c98 Move TEST_SKIPPED_ITSELF to test_status in testHarness (#1089)
TEST_SKIPPED_ITSELF was originally located in
threadTesting.h but this no longer makes sense.
This change moves the definition to the test_status
struct in testHarness so that it can be used in the same
way that test_status' can be used.

Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com>
2021-01-04 15:20:19 +00:00