* 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>
* 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
* 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
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>
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>
* 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
* 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
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>
* 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.
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>
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>
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>
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>
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>
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>
* 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...
* 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
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>
* 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>
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>
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>
* Removed hardcoded -cl-std=CL2.0 build option from progvar tests
Fixes issue #1380https://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
* 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
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.
* 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)
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>
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>
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>
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>
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>
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.
* define CL_NO_PROTOTYPES
When we switch to generated headers this will suppress declaration
of extension functions, so we can continue to declare function
pointers with the same name.
* switch to CL_NO_EXTENSION_PROTOTYPES
CL_NO_PROTOTYPES will omit declarations of core OpenCL APIs also.