Commit Graph

1110 Commits

Author SHA1 Message Date
Sven van Haastregt
729cd8b7a9 [NFC] device_execution: use raw string literals for block kernels (#1767)
Modernize by using raw string literals, which makes the kernel sources
easier to read/extract.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-06-28 09:34:07 +01:00
Ewan Crawford
75aca34e60 Test CL_COMMAND_BUFFER_CONTEXT_KHR (#1697)
Test coverage for spec PR https://github.com/KhronosGroup/OpenCL-Docs/pull/899
which introduces a new cl_khr_command_buffer query for the cl_context
2023-06-28 08:13:15 +01:00
Paweł Jastrzębski
56974a5858 Add global offset tests for cl_khr_command_buffer_mutable_dispatch. (#1743)
* Add global offset tests for cl_khr_command_buffer_mutable_dispatch.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Add kernel with observable output.

We should check that there's some observable output from the kernel
as a result of the change to global work offset, not just that
clGetMutableCommandInfoKHR has been updated. E.g we could call
get_global_offset() inside of the kernel, write something to a
buffer based on that, and read the buffer after the command-buffer
enqueue has finished.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix review comments.

Applied review comments for mutable dispatch global offset test:
- clFinish to ensure command-buffer has finished executing for calling clUpdateMutableCommandsKHR
- Change variable and constant names for global offset
- Remove redundant return CL_SUCCESS

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix review comments.

Changes made:
- Fix skip conditions
- Remove obsolete variable
- Replace a variable with a constant

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix review comments.

Changes made:
- Remove explicit base class call
- Fix constant magic number

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix constant magic number.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix clang-format.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix condition for result check.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

---------

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
2023-06-27 08:54:14 -07:00
Paweł Jastrzębski
fee6d6bb66 Command buffer re-enqueue testing. (#1738)
* Command buffer re-enqueue testing.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Remove reenqueue tests and add reenqueue to existing tests.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Add re-enqueue for copy and barrier tests.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix review comments.

Applied review comments for command buffer re-enqueue testing:
- Add second clEnqueueCommandBufferKHR for all tests
- Reinitialise memory before second enqueue of command buffers
- Add different patterns for second enqueue of command buffers

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix verification patterns for second enqueue tests.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Reinitialise output memory for second command buffer re-enqueue.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix cast for conversion from 'const cl_char' to 'const cl_uint.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix compilation error for MSVC.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Reinitialise in_mem and out_mem with zero.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix cast for conversion from 'const cl_int' to 'const cl_uint'.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

---------

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
2023-06-27 08:47:24 -07:00
Marcin Hajder
73ead9da04 Added cl_khr_fp16 extension support for test_op_negate from spirv_new (#1762)
* Added cl_khr_fp16 extension support for test_op_negate from spirv_new (issue #142)

* Added clang format fix
2023-06-27 08:43:44 -07:00
Marcin Hajder
43c244f01d Added cl_khr_fp16 extension support for test vector_times_scalar from spirv_new (#1757)
* Added cl_khr_fp16 support for vector_times_scalar from spirv_new (issue #142, spirv_new)

* Logging correction
2023-06-27 08:42:56 -07:00
Marcin Hajder
2495eca9fa Added cl_khr_fp16 extension support for test_commonfns (#1695)
* Added cl_khr_fp16 extension support for commonfns test (issue #142, commonfns)

* Added missing header due to presubmit check

* Corrected radians/degrees ulp calculations + cosmetic fixes

* Corrected presubmit code format

* Corrections related to code review

* Moved string format helper to test_common in separate header

* Added clang format for last commit

* Corrections related to code review

* Modified mix verification procedure for half type to only report max error

* Removed redundant condition for logging mix verification

* Corrected generator limits for half tests
2023-06-27 08:42:02 -07:00
Marcin Hajder
60f025a7da Added cl_half support for test_select (#1617)
* Added cl_half support for test_select (issue #142, select)

* Added corrections due to code review + performance optimization + replaced C object with wrappers

* minor fix

* Corrected use of user event

* Removed unnecessary user event
2023-06-27 08:40:35 -07:00
Sven van Haastregt
2e88013b34 compiler: fix memory leak from unnecessary strdup (#1761)
The result of the `strdup` was never freed.  The string duplication
isn't necessary, so remove it.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-06-21 22:08:21 -07:00
Sven van Haastregt
50f9f06323 test_common: fix -Wsign-compare warnings (#1759)
In preparation of re-enabling `-Wsign-compare` globally, avoid mixing
signed and unsigned integers in comparisons in test_common.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-06-21 15:19:21 +01:00
Marcin Hajder
df3ec8deec Added cl_khr_fp16 extension support for test_int2fp from basic (#1742)
* Added cl_khr_fp16 and cl_khr_fp64 support for float2int and int2float tests from basic

* removed debug output

* Replaced procedure to generate random half values in specific range (issue #142, basic)

* Added cosmetic fixes due to code review comments

* Moved string helper procedures due to request for test_commonfns PR #1695
2023-06-20 08:44:45 -07:00
Marcin Hajder
0e229b8f01 Added cl_khr_fp16 extension support for test_fpmath from basic (#1718)
* Added half and double support for fpmath test from basic (issue #142, basic)

* Cosmetic corrections due to code review

* Removed unnecessary casting

* Added corrections due to code review

* Tuning range of input generation to avoid hitting infinity

* Moved string helpers procedures due to request from test_commonfns PR #1695
2023-06-20 08:42:57 -07:00
Sven van Haastregt
44b2578ac7 basic: fix unused-but-set variables (#1764)
Remove the unused `numItems` variable.

As this fixes all occurrences of this warning in test_basic, remove
the suppression flag.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-06-16 10:53:08 +01:00
Marcin Hajder
16a75dc0af Added cl_khr_fp16 extension support for test_vector_creation from basic (#1728)
* Added cl_khr_fp16 extension support for vector_creation test from basic

* Added corrections related to vendor's review

* Added protection to avoid similar creation cases

* Added comment for recent correction

* cosmetics

* Corrected factor array to restore lost capacity of original test..

leaving only 16-sizes vector tests limited.
2023-06-13 08:41:39 -07:00
Marcin Hajder
095091bc57 Added cl_khr_fp16 extension support for test_vec_type_hint from basic (#1724)
* Added cl_khr_fp16 extension support for test_vec_type_hint from basic (issue #142, basic)

* Added correction to fix casting problem
2023-06-12 23:39:22 -07:00
Sven van Haastregt
475a37abbf [NFC] Do not use reserved names for include guards (#1737)
Names that begin with an underscore followed by an uppercase letter
are reserved for the C++ implementation.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-06-09 11:25:20 +01:00
Sven van Haastregt
c8061ab21a mem_host_flags: use size_t for element count (#1755)
More recent GCC versions (e.g. 12.2, 13.1) report that the argument to
`new[]` in the `Init` methods exceeds the maximum object size,
seemingly related to the negative range of the widened `int`.

Use an unsigned type to avoid the warning and propagate the signedness
change to other uses of the `num_elements` member.

Fixes https://github.com/KhronosGroup/OpenCL-CTS/issues/1582

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-06-08 13:27:20 +01:00
Romaric Jodin
1011f8ea81 fix async strided test outputing error during verify (#1754)
This bug was introduced by
https://github.com/KhronosGroup/OpenCL-CTS/pull/1711

Ref google/clspv#1127
2023-06-07 15:53:12 +01:00
Sven van Haastregt
658a8b62fb [CI] Build Vulkan loader with USE_GAS=ON (#1756)
https://github.com/KhronosGroup/Vulkan-Loader/pull/1212 broke builds
that set `USE_GAS=OFF`.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-06-07 15:07:25 +01:00
Sven van Haastregt
b843b3bd8c relationals: fix missing includes (#1753)
With GCC 13 some headers are no longer included transitively through
C++ Standard Library headers.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-06-07 10:51:38 +01:00
Marcin Hajder
c467391680 Added support for cl_khr_fp16 extension in test_async_copy from basic (issue #142, basic) (#1707) 2023-06-06 08:46:56 -07:00
Sven van Haastregt
63a8cb6b9d non_uniform_work_group: fix unused-but-set variables (#1733)
Remove the unused `nonRemainderGlobalSize` array.  Inspect the result
of the `clGetDeviceInfo` call.

As this fixes all occurrences of this warning, remove the suppression
flag from this test.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-06-05 11:45:25 +01:00
Sven van Haastregt
ce17549812 cmake: do not suppress -Wsometimes-uninitialized globally (#1741)
Fix an instance of this warning in mem_host_flags.

Only disable `-Wsometimes-uninitialized` for the SVM test, which does
not compile cleanly with this warning enabled.  Re-enable the warning
for the other tests, so that it can catch any new occurrences.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-06-02 10:57:10 +01:00
Sven van Haastregt
abd556f7a2 relationals: add missing virtual destructor (#1739)
`RelationalsFPTest` contains a vector of `RelTestBase` pointers to
`RelTestParams` instances, so the base class destructor should be
virtual to avoid undefined behaviour.

Fixes https://github.com/KhronosGroup/OpenCL-CTS/issues/1731

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-05-31 10:02:54 +01:00
Chris Gearing
19f4fc3f3d Make extended_async_copy tests type agnostic (#1619)
The latest version of the cl_khr_extended_async_copies extension uses
element size rather the element type as its base. The means it can be
called with arbitrary and in particular non power of 2 sizes, such as 3
or 13.

Update the test_async_copy2D and test_async_copy3D tests to make them
element size based rather than type based.

As well as this run all tests that can fit into the memory of the
target rather than presumed large elements cannot fit.

Make some addtional good practice changes in terms of const usage,
declaring variables where they are use, and usage of iterators.

The test coverage increases from 1224 cases to 1332 cases for the
test_async_copy2D and test_async_copy3D cases.

Ticket: #1579

Signed-off-by: Chris Gearing <chris.gearing@mobileye.com>
Co-authored-by: Chris Gearing <chris.gearing@mobileye.com>
2023-05-30 09:05:18 -07:00
Zhaoyu Zhang
38abfc7d24 select: using clEnqueueReadBuffer rather than clEnqueueMapBuffer (#1712)
* select: using clEnqueueReadBuffer rather than clEnqueueMapBuffer

* Update code to be compatible with clang-format

* update code again to be compatible with clang-format

* update code again to comply with clang-format

* updata code again to be compatible with clang-format

The clang-format tool is so weird, it's not even consistent between runs...
2023-05-30 08:54:32 -07:00
Marcin Hajder
b3c1401d48 Added cl_khr_fp16 extension support for test_async_strided_copy from basic (issue #142, basic) (#1711) 2023-05-30 08:52:27 -07:00
Marcin Hajder
c58ead9aea Added cl_khr_fp16 extension support for test_astype from basic (#1706)
* Added support for cl_khr_fp16 extenstion in test_astype from basic (issue #142, basic)

* Added correction to iterate over vector of types

* Fixed case with both fp16 and fp64 supported

* Cosmetic corrections due to code review

* Cosmetic corrections due to code review
2023-05-30 08:52:06 -07:00
Sreelakshmi Haridas Maruthur
9692380505 Semaphore test: Use blocking semaphores (#1675)
Semaphore spec has been updated to reflect the fact that semaphores
will be in the appropriate - pending signal or pending wait - state
when returning from clEnqueueSignalSemaphore or
clEnqueueWaitSemaphore commands: KhronosGroup/OpenCL-Docs#882

Deleted the following tests to match the updated spec:

semaphores_order_1 - Test calls EnqueueWaitSemaphore before calling
EnqueueSignalSemaphore and expects this wait to succeed.
This behavior is not compatible with the recent
spec updates to semaphores.

semaphores_order_2 & semaphores_order_3 - Calling
clEnqueueSignalSemaphoresKHR with a dependency on a user event may
cause the implementation to block until the user event is complete.
This is unsafe usage of clEnqueueSignalSemaphoresKHR and may
lead to deadlock.

semaphores_invalid_command - This test checks for specific behavior
when waiting on a semaphore in an invalid state.
According to the spec, this is undefined behavior,
and therefore cannot be tested directly.

Co-authored-by: Joshua Kelly <joshkell@qti.qualcomm.com>
2023-05-30 08:49:31 -07:00
Marcin Hajder
4cb39b8c14 Added cl_khr_fp16 extension support for test_hiloeo from basic (#1721)
* Added cl_khr_fp16 support for hiloeo test from basic (issue #142, basic)

* Added correction due to compiler warrning

* Cosmetic correction
2023-05-30 08:48:09 -07:00
Paweł Jastrzębski
35b8db35c6 Add check for CL_COMMAND_BUFFER_STATE_EXECUTABLE_KHR after completion. (#1740)
* Add check for CL_COMMAND_BUFFER_STATE_EXECUTABLE_KHR after completion.

Added check for state CL_COMMAND_BUFFER_STATE_EXECUTABLE_KHR in state info tests.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Add wait for event.

Wait for event to guarantee that a command-buffer has finished executing by this point.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Add new event to wait for.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

---------

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
2023-05-30 08:43:58 -07:00
Marcin Hajder
4dece20f7d Added cl_khr_fp16 extension support for test_vector_swizzle from basic (#1729)
* Added cl_khr_fp16 extension support for vector_swizzle from basic (issue #142, basic)

* Added code review related fix
2023-05-29 14:04:04 +01:00
John Kesapides
3e8898ffeb Deduplicate test_basic int2float/float2int (#1537)
Merge int2float,float2int.

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2023-05-24 16:55:25 +01:00
Sven van Haastregt
957e3b3985 Convert some if-else chains to switch statements (#1730)
All of these if-else chains compare against enums, which is better
done using switch statements.  This helps avoid some
`-Wsometimes-uninitialized` warnings of variables that are assigned
inside the switch.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-05-24 11:11:23 +01:00
Sven van Haastregt
4f62adf1ca computeinfo: fix use of uninitialized config_size_ret (#1727)
The variable `config_size_ret` is only assigned to inside the `if`.
If the condition is false, we would read uninitialized data.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-05-23 09:43:25 +01:00
Sven van Haastregt
8f3027387a Fix some Wformat size_t warnings (#1726)
Printing a `size_t` requires the `%zu` specifier.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-05-18 09:29:27 +01:00
Tuomas Lauttia
85c95297ac Removed hardcoded -cl-std=CL2.0 build option from progvar tests (#1710)
* Removed hardcoded -cl-std=CL2.0 build option from progvar tests

Fixes issue #1380
https://github.com/KhronosGroup/OpenCL-CTS/issues/1380

These changes will query the device for the latest supported CL C
version instead of using a hardcoded value. The create_single_kernel_helper
function queries for the latest CL C version internally, so calls to
create_single_kernel_helper_with_build_options were replaced with calls
to create_single_kernel_helper instead.

* Fixed formatting
v2023-05-16-00
2023-05-16 08:46:28 -07:00
Marcin Hajder
32688a47b3 Complementation and modernization of commonfns tests (#1694)
* Unified common functions tests due to preparation for adding cl_khr_fp16 support

* Renamed base structure, few cosmetic corrections

* Added corrections due to code review

* Removed comment separators

* Added review related corrections
2023-05-16 08:44:42 -07:00
Juan Manuel Martinez Caamaño
0447b7a2c8 Avoid integer overflows when computing abs_diff (#1689)
After compiling OpenCL CTS with -fsanitize=undefined I stumbled upon
some signed integer overflows.

test_absdiff.cpp:103:24: runtime error: signed integer overflow:
  419625160 - -1937831252 cannot be represented in type 'int'
test_absdiff.cpp:101:28: runtime error: signed integer overflow:
  1277901399 - -1294103363 cannot be represented in type 'int'
test_absdiff.cpp:140:24: runtime error: signed integer overflow:
  8945130301981949496 - -2872789959208163723 cannot be represented in type
  'long int'
test_absdiff.cpp:138:29: runtime error: signed integer overflow:
  5488544718097069860 - -5558131619970145206 cannot be represented in type
  'long int'

The result from these operations was used to compare against the kernel result.

This patch replaces the abs_diff manual computations by a function that handles
the signed integer overflow case.
2023-05-16 08:44:15 -07:00
Marcin Hajder
f31b2f029c Added cl_half support for test_relationals (#1623)
* Added cl_khr_fp16 support for test_relationals (issue #142, relationals)

* Added cl_khr_fp16 support for any and bitselect test cases (issue #142, relationals)

* correction related to automated travis build for macOS (issue #142, relationals)

* more corrections related to automated travis build for macOS (issue #142, relationals)

* Added few cosmetic corrections (issue #142, test_relationals)

* Added missing clang format

* Added corrections related to order of initialization

* Added corrections due to code review (issue #142, relationals)

* Correction for prev commit

* Added subnormals related condition for test verification (issue #142, relationals)

* Added indexing correction due to code review

* Replaced hardcoded iteration limit (issue #142, relationals)
2023-05-16 08:43:47 -07:00
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
Kévin Petit
06c0c99c2e Enable clCopyImage suite to run in parallel (#1717)
Signed-off-by: Kévin Petit <kpet@free.fr>
2023-05-13 10:21:34 +01:00
Sven van Haastregt
b23268acf5 math_brute_force: don't get build log after clCreateKernel (#1722)
The OpenCL specification states that the build log is only for
clBuildProgram, clCompileProgram or clLinkProgram.  Calling it after
clCreateKernel should not give any additional information, so this is
effectively dead code.  In case building failed, any logs would
already have been printed by create_single_kernel_helper.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-05-13 10:21:13 +01:00
Sven van Haastregt
d223e46f20 atomics: Remove unused variable in atomic_add_index_bin (#1709)
Remove a variable that was set when an OpenCL API call failed, but
never read again.  Instead, return immediately upon failure.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-05-11 14:12:09 +01:00
Sven van Haastregt
8272c83c6f math_brute_force: consider all types for extension pragmas (#1705)
When generating the kernel code, consider the return type(s) and the
types of all parameters, instead of only the first parameter type.
This fixes a missing extension pragma for certain cases (such as
`nan`).

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-05-10 10:45:44 +01:00
Sven van Haastregt
20afedbd4a [NFC] math_brute_force: remove unused MakeKernel function (#1714)
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-05-04 16:18:35 +01:00
Banan-Askhar-Mobileye
caa656c268 fixing test events (#1678) 2023-05-03 09:16:21 +01:00
Kévin Petit
ff1369d94e Add basic support to the harness for parallel test execution (#1687)
This change introduces a new command-line parameter to enable
parallel execution by a specified number of worker threads. When
parallel execution is requested, tests are distributed across
the worker threads. This behaviour is disabled by default.

This does not currently work for all suites as some of them are
using global variables to configure tests. For the suites that
do not use global state, this change reduced the execution time
by up to 5x on an 8-core machine.

Signed-off-by: Kévin Petit <kpet@free.fr>
2023-04-25 19:30:42 +01:00
paulfradgley
033aa195c5 Pass 'flag' variable through to clGetImageRequirementsInfoEXT (attempt 2) (#1700)
Rebase of my previous clGetImageRequirementsInfoEXT flag=0 fix PR: PR1632

Pass 'flag' variable through to clGetImageRequirementsInfoEXT:

Almost all of the image_from_buffer cl_ext_image_requirements_info tests pass '0' as the 'flags' to clGetImageRequirementsInfoEXT.
Passing '0' as the flags is valid according to the spec, but since the tests are calling clGetImageRequirementsInfoEXT in a loop over a list of flags it doesn't seem intended that all the tests pass '0'.

Fixed CL_MEM_KERNEL_READ_AND_WRITE flag override:

The mem_flags override for CL_MEM_KERNEL_READ_AND_WRITE was incorrectly affecting subsequent iterations of the image_format loop.
Fixed by using a separate variable inside the loop.
2023-04-25 09:17:22 -07:00
Sven van Haastregt
aa34b4b8c3 [NFC] Remove unused depth_lod variables (#1696)
Remove the remaining unused variables in the test harness.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-04-25 09:16:10 -07:00