Commit Graph

849 Commits

Author SHA1 Message Date
Sreelakshmi Haridas Maruthur
60b731ce15 c11_atomics: Fix to iteratively reduce workgroup size (#939) (#941)
The generator function for atomic_fence uses the current workgroup
size to determine the number of non atomic variables per thread
in the kernel. The kernel should hence be regenerated when the
workgroup size changes.

However regenerating the kernel can itself change the workgroup
size. This change introduces an iterative loop that reduces the
workgroup sizes by 2 each time re-generating the kernel until
we find one that works (or exit at groupsize == 1)

Change-Id: Ic32fe967e32de6643e01c6775f4bddbcad0a299a
2020-09-22 09:15:09 -07:00
Jack Frankland
9178524d02 Change Behaviour of C11 Atomic Tests for OpenCL-3.0 (#944)
* Change setup code in `KernelCode()` to use `_explicit` builtin
variants that are common to both OpenCL-2.X and OpenCL-3.0.

* Only test optional supported builtin variants (`_explicit` signature
 memory_order/scope) for OpenCL-3.0.

* Disable program scope global variable and generic address space tests
for a OpenCL-3.0 driver which does not optionally support these
features.
2020-09-22 09:08:32 -07:00
Nikhil Joshi
f7a0936879 Add check for Read-Write images support (#965)
* 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.
2020-09-22 09:05:58 -07:00
Kévin Petit
aee9131f87 Print the latest conformance version passed reported by the device (#959)
Fixes #798

Signed-off-by: Kévin Petit <kpet@free.fr>
2020-09-22 09:04:02 -07:00
Sreelakshmi Haridas Maruthur
fffd4f2474 compiler: Modify the IL check code to check for an empty string (#964)
The called function (get_device_info_string) subtracts 1 from
length before returning it. Hence, to check for an empty string
(that the spec requires the implementation to return when
CL_DEVICE_IL_VERSION is not supported) the check should be modified
to check for empty and not length == 1
2020-09-21 17:51:54 +01:00
David Avedissian
3db1a9b3aa Ensure that test_preprocessors checks __OPENCL_C_VERSION__ correctly for CL 3.0 contexts. (#938) 2020-09-17 09:42:58 +01:00
Sreelakshmi Haridas Maruthur
f627a68dd6 device_execution: Modify the check in profiling subtest (#962)
As per the spec CL_PROFILING_COMMAND_COMPLETE is required to
be equal to CL_PROFILING_COMMAND_END only on devices that
do not support the on-device queue.

For other cases it can be >= CL_PROFILING_COMMAND_END
2020-09-17 09:36:43 +01:00
Sreelakshmi Haridas Maruthur
90b57a2d7a api: Allow vendor flags (#957)
Mask off vendor extensions when querying host command queue properties.
2020-09-15 11:19:20 +01:00
Jesse Natalie
7fd87c704a Use power-of-two alignment values for allocating pixel data (#827) 2020-09-11 00:25:58 +01:00
Einar Hov
172322e155 Add async_build test to list of tests to skip during offline compilation mode (#950)
The test attempts to build a program from source containing invalid code, to
provoke a build failure. In offline compilation mode, this causes the offline
compiler to give an error, failing the test.

Signed-off-by: Einar Hov <einar.hov@arm.com>
2020-09-10 16:58:29 +01:00
Ben Ashbaugh
c67868834a switch back to CL_INVALID_MEM_OBJECT for clGetPipeInfo (#947)
* switch back to CL_INVALID_MEM_OBJECT for clGetPipeInfo

* fix formatting

* correct error message to CL_INVALID_MEM_OBJECT
2020-09-10 11:59:15 +01:00
Ben Ashbaugh
4421713cd4 add checks for atomic feature consistency (#946) 2020-09-09 18:13:43 +01:00
Kévin Petit
869d5a1032 Merge vec_step and vec_align binaries into a new vectors binary (#926)
* Merge vec_step and vec_align binaries into a new vectors binary

This change just merges the two suites to reuse common functions
and definitions. There is probably room for further code consolidation
but probably best done as a separate change.

Contributes to #683

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

* format fixes
2020-09-08 18:16:08 +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
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
Ben Ashbaugh
ab106e97f9 specialization constant test fixes (#927)
* remove SPV_KHR_no_integer_wrap_decoration

* address review comments

* remove the assemble_spirv script

There is another PR in flight that adds a much more complete
script that we should merge instead.
2020-09-04 11:46:22 +01:00
Stuart Brady
11f3eaaceb [MinGW] Fix if statements with stray semicolons after condition (#934)
In two places, a stray semicolon between an if statement and its body
would cause the body to be executed unconditionally.  Fix this.

Signed-off-by: Stuart Brady <stuart.brady@arm.com>
2020-09-04 11:25:52 +01:00
Jeremy Kemp
822c5a5fc0 queue_flush_on_release: pass event by reference (#937) 2020-09-03 16:55:43 +01:00
Stuart Brady
5f63747c2e Remove empty statements due to use of double semicolons (#935)
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
2020-09-03 14:36:38 +01:00
Jack Frankland
d1a63f8041 Change Behviour of non-uniform-work-group tests for OpenCL-3.0 (#877)
* Pass `-cl-std=CL3.0` as build option for OpenCL-3.0.
* For an OpenCL-3.0 driver that optionally does not support non-uniform
work-groups round up the global size and run the tests with uniform
work-groups. This increases coverage and allows testing of the
`get_enqueued_local_size` builtin for uniform work-groups.
2020-09-01 08:16:17 -07:00
Kévin Petit
f06e1896a8 Test that queues are flushed by clReleaseCommandQueue (#923)
... as required by the OpenCL specification.

Also introduce a utility function to manage polling for changes
via a user-supplied function. Several tests we introduced lately
could have used this.

Signed-off-by: Kévin Petit <kpet@free.fr>
2020-09-01 10:27:27 +01:00
Ben Ashbaugh
e075026819 test CL_QUEUE_ARRAY_PROPERTIES query (#925)
* OpenCL 3.0 test CL_QUEUE_PROPERTIES_ARRAY

* add verification if requested_size <= CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE
* remove test_case - set NULL properties, get not empty array with 0 terminator
* add printing test_case description

* change logic of checking if requested properties are supported by device
depending on host/device type queue.

* fix a few bugs, rename test for consistency

* add utility function for comparing properties

Co-authored-by: Grzegorz Wawiorko <grzegorz.wawiorko@intel.com>
2020-09-01 10:16:18 +01:00
Jack Frankland
11c3eb6610 Update rw_image_access_qualifier for OpenCL-3.0 (#922)
* Skip `rw_image_access_qualifier` if images are not supported.
* Skip `rw_image_access_qualifier` if read-write images are optionally
not supported on a OpenCL-3.0 or later device.
* Stop assuming `-cl-std=CL3.0` and default to latest OpenCL C supported
by the device.
2020-08-31 15:16:02 -07:00
Jack Frankland
4b377615a2 Automatically Select -cl-std for Compiler Defines Test (#921)
* Automatically select the `-cl-std` build option (stop assuming
`CL2.0`) in the `compiler_defines_for_extensions` test. This will allow
us to test `test_compiler_defines_for_extensions` with an OpenCL-3.0
driver that optionally might not support OpenCL C 2.0. Use the CTS
framework to automatically select the latest version of OpenCL C
supported by the device.
2020-08-31 15:15:27 -07:00
Jack Frankland
3c8ec47aac Automatically Select Latest -cl-std for pragma unroll Test (#920)
* Stop assuming `-cl-std=CL2.0` for the `pragma unroll` test. This
allows us to run this test for OpenCL-3.0 drivers which optionally do
not support OpenCL C 2.0. Use the CTS framework to automatically select
the latest OpenCL C supported by the driver.
2020-08-31 15:14:50 -07:00
Jack Frankland
581d9ea990 Dynamically select -cl-std Build Option for get_(global|local)_linear_id (#876)
* Dynamically select the build option `-cl-std` for the
`get_(global|local)_linear_id()` builtin based on the device version
of the driver.
2020-08-31 15:14:10 -07:00
Jack Frankland
3cc9c2c579 Select Correct -cl-std for ctz Tests Based on Driver (#917) 2020-08-31 15:13:02 -07:00
Jeremy Kemp
1e411b888f Memory consistency model optionality (#907)
* Test minimum memory consistency capabilities for a device reporting >= 3.0.

Skip tests where unsupported memory consistency capabilities are being requested.

* Pass nullptr as program build option.

Allows the CTS framework to select an appropriate CL C version.

* Removed redundant braces.
2020-08-31 15:12:10 -07:00
ouakheli
590321d98d Add test for CL_PROFILING_COMMAND_COMPLETE (#841)
The test checks profiling value CL_PROFILING_COMMAND_COMPLETE
compared to CL_PROFILING_COMMAND_END for two cases:
1) kernel with children with different levels of nesting
2) kernel without children
2020-08-30 13:51:38 +01:00
ellnor01
a31e253397 Adds testing for CL_PROGRAM_IL (#919)
* Adds testing for CL_PROGRAM_IL

Added a test to check SpirV as an IL for programs built with IL
which includes a negative test for programs built without IL.

Added a test_fail macro.

Fixes #164

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

* COMPUTE-11739 Removing unused platform and device_version

Fixes #164

Change-Id: Ib1168f6396132b69996d07166e1b593fa933d245
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2020-08-28 15:31:52 +01:00
Pierre Moreau
c001dc2d9c Only include sys/sysctl.h on for Apple (#916)
glibc deprecated that header in version 2.30, and removed it in 2.32.
2020-08-27 18:31:51 +01:00
Jack Frankland
0ba7cf1369 Dynamically Select -cl-std Option (#879)
* Dynamically select the `-cl-std` option on the basic `sizeof` and
`wg_barrier` tests to be one of `CL1.X`, `CL2.0` or `CL3.0`.
Use the most recent CL C standard supported on the device.
2020-08-25 09:32:08 -07:00
Kévin Petit
faa6ad86c6 Fail gracefully in CL_MEM_PROPERTIES tests when unexpectedly getting zero-size return (#913)
Signed-off-by: Kévin Petit <kpet@free.fr>
2020-08-21 09:56:10 -07:00
Einar Hov
a0d679fe41 Fix bug caught by -Wparentheses (#915)
This fix is required to build with -Wall -Werror with GCC >= 5.

Signed-off-by: Einar Hov <einar.hov@arm.com>
2020-08-21 12:09:22 +01:00
Sven van Haastregt
b79c02729f Fix and line-break build_lnx.sh (#910)
* build_lnx.sh: Fix cmake -G flag

The cmake flag for generator selection is an uppercase G.

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

* build_lnx.sh: split cmake invocation into multiple lines

One option per line makes it easier for users to maintain their local
customized copy of this script, as a single line may get very wide
when paths are filled in.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2020-08-20 12:28:20 +01:00
Grzegorz Wawiorko
41cd9c6d98 New spirv_new test case OpSpecConstant (#719)
* New spirv_new test case OpSpecConstant OpSpecConstantTrue OpSpecConstantfalse

* Register test case with minimal OpenCL version

* Specialization constant - add files uint/int cases

* Specialization constants - fix second build program

* Fix changes clang format.

* spirv_new - Make functions visible outside of main

* Fix clang format issues

* Fix int/uint 32 bit cases

* Fix minimal required version for test_op_spec_constant

* Remove not needed OpName. Update binaries

* Fix code format

* Remove op_spec_constant_int cases in spirv_new tests

* op_spec_constant - add simplified spirv files

* no redundant OpUConvert OpSConvert
* no redundant OpName
* instead of buffers scalar variable

* op_spec_constant - refactor to address review issues

* avoid using program that has already kernel program attached
* remove not used buffer
* Simplified test case - instead of buffers use scalar variable

* spirv_new - remove spec_const duplicated cases (singed versions)

* spirv_new - set clSetProgramSpecializationConstant before clBuildProgram

* Test spirv_new - fix spec const after rebase

* Test spirv_new - fix spec const set min version for bool type tests
2020-08-20 00:39:06 +01:00
Stuart Brady
afa2fcca96 Simplify call to create_single_kernel_helper() in test_select (#900)
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
2020-08-19 19:16:48 +01:00
Ben Ashbaugh
f966212f2b API Feature Consistency Test, Part 1 (#875)
* add api consistency test for Shared Virtual Memory

* add memory model and device enqueue consistency tests

* added pipes test
clang-format fixes

* simplify diffs

* add negative tests for when features are not supported

Previously, this test emitted warnings in the log if a feature
wasn't supported and a query or API call didn't generated the
expected value.  After this change, these tests will fail if
a query or API call does not generate the expected value or
error condition.

* switch handling of expected error codes to test_failure_error

* fix formatting

* use valid pipe creation parameters

* remove calls to clFinish as per review comments

* purposefully pass a bogus pointer to SVM free functions

* fix pointer passed to clEnqueueSVMFree

* change the bogus pointer to a known bit pattern
2020-08-19 14:48:15 +01:00
Grzegorz Wawiorko
185c02a700 Test against clCreateBufferWithProperties and clCreateImageWithProperties OpenCL 3.0 API (#857)
* Test against clCreateBufferWithProperties and clCreateImageWithProperties OpenCL 3.0 API

* Test against clCreateBufferWithProperties and clCreateImageWithProperties - review fixes

* Do not use enum query_type
* Fix test success/failure  conditions

* Fix  test_mem_object_properties_queries.cpp build error.

* Review Fix  test_mem_object_properties_queries.cpp
2020-08-18 17:06: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
Kévin Petit
ed50fcad2d Use float<->half conversion routines from the OpenCL headers (#884)
* Use float<->half conversion routines from the OpenCL headers

Fixes #870

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

* Use cl_half_from_double

* Fix windows build errors

* Fix more build errors

* Code formatting

* Remove TEST class
2020-08-14 13:50:14 +01:00
Jack Frankland
655d83db80 Optionally Skip progvar Tests (#878)
* Optionally skip the proram scope globa variable tests on OpenCL-3.0
devices that optionally do not support programscope global variables.
2020-08-14 13:49:51 +01:00
Ben Ashbaugh
0424fc7f12 skip test cases rather than fail without cl_khr_3d_image_writes (#874)
* skip test cases rather than fail without cl_khr_3d_image_writes

cl_khr_3d_image_writes is required for OpenCL 2.x devices, but is not
required for OpenCL 1.x or OpenCL 3.0 devices.  A check for the presence
of the extension on OpenCL 2.x devices already exists in
test_min_max_device_version, so we don't need any failure conditions
here, and can just skip tests if the extension is not supported.

* clang-format changes
2020-08-14 11:17:44 +01:00
Einar Hov
0ad8c9a9c0 Add cl_khr_device_uuid as approved extension (#881)
Signed-off-by: Einar Hov <einar.hov@arm.com>
2020-08-13 13:57:31 +01:00
Jack Frankland
48114a4e55 Run test_enqueued_local_size if Non-Uniform Work-Groups Not Supported (#789)
* `test_enqueued_local_size` will be skipped for OpenCL < 2.0. However,
non-uniform work-groups became optional in 3.0 and so check that they
are supported before running `test_enqueued_local_size`. If they are not
suppported round the global sizes up to the next multiple of the local
size, so that we can still test that `get_enqueued_local_size() ==
get_local_size()` in the case of uniform workgroups.
2020-08-11 08:04:46 -07:00
Ben Ashbaugh
fb2119eb87 add a test for clSetContextDestructorCallback (#861)
* add a test for clSetContextDestructorCallback

* add a 10 second timeout for mem object and context destructor callbacks

* clang-format fixes

* address review comments
2020-08-10 22:21:37 +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
Mats Petersson
ce484988ab Add lock around compiling (#871)
The compiler tries to compile the same source multiple times and more
importantly write out to the same filename. Adding a lock to prevent
simultaneous compilation solves this issue. This is particularly
noticeable in integer_ops testing when using offline compilation,
but just in case, hold the lock for the entire program creation.

Signed-off-by: Mats Petersson <mats.petersson@arm.com>
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
2020-08-07 12:25:06 +01:00
Grzegorz Wawiorko
c9f4ef23f6 OpenCL 3.0 CL_SAMPLER_PROPERTIES tests. (#858)
* OpenCL 3.0 CL_SAMPLER_PROPERTIES tests.

* Test CL_SAMPLER_PROPERTIES - fix misspelling

* Test CL_SAMPLER_PROPERTIES - fix results verification
2020-08-06 10:02:46 +01:00
Jeremy Kemp
b3db418e06 Skip sub_group_dispatch. (#864)
* Skip sub_group_dispatch.

If sub groups aren't supported, skip the test.

* Do not test for cl_khr_subgroups as the extension requires IFP.

3.0 allows sub groups *without* IFP so the check was invalid.
2020-08-05 14:55:35 +01:00