`gMTdata` was initialized twice, but freed only once.
Drop the first initialization with a local seed, and initialize with
`gRandomSeed` instead.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* Use CTS type wrappers for test_basic test_loop
* Move variable declaration to first use in verify_loop
Signed-off-by: John Kesapides <john.kesapides@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>
Avoid a shift by 64 on a `uint64_t`. The value resulting from the
spurious shift was overwritten later, so just avoid the shift in that
case.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
The refactoring of the conversions test dropped the workaround added
by 59a12047a ("Fix for test_conversions failure with Clang build on
Linux #1057 (#1062)", 2021-05-11).
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
For conversion from integers to float, the DataInfoSpec constructor
tries to convert `CL_FLT_MAX` to an integer. The float value cannot
be represented as an integer, which is undefined behaviour.
Fix by only doing this conversion when `InType` is a floating point
value.
While at it, use `static_cast` for the conversions.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* Add out of order tests for cl_khr_command_buffer_mutable_dispatch.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Replace CL_KERNEL_EXEC_INFO_SVM_PTRS with cl_mutable_dispatch_arg_khr command-buffer mutable buffer update.
CL_KERNEL_EXEC_INFO_SVM_PTRS limits the test to devices which support SVM.
Updating arg_list with a cl_mutable_dispatch_arg_khr struct is one of the
best supported, and also easiest to verify, configurations to change.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Fix skip condition.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Fix review changes.
Changes made:
- Fix skip condition
- Add event
- Add memory verification
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Fix review comments.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
---------
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Add global size 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's some observable output from the kernel
as a result of the change to global work size, not just that
clGetMutableCommandInfoKHR has been updated. For example,
getting every work-item to call get_global_size() inside of
the kernel and writing it to a buffer, then reading the buffer
after the command-buffer enqueue has finished and check it
matches what we expect.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Fix review comments.
Applied review comments for mutable dispatch global arguments test:
- clFinish to ensure command-buffer has finished executing for calling clUpdateMutableCommandsKHR
- Change variable and constant names for global size
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 condition check
- 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>
* Remove uneeded comments.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
---------
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Add local size 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's some observable output from the kernel
as a result of the change to local work size, not just that
clGetMutableCommandInfoKHR has been updated. For example,
getting every work-item to call get_local_size() inside of
the kernel and writing it to a buffer, then reading the buffer
after the command-buffer enqueue has finished and check it
matches what we expect.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Fix review comments.
Applied review comments for mutable dispatch local size test:
- clFinish to ensure command-buffer has finished executing for calling clUpdateMutableCommandsKHR
- Change variable and constant names for local size
Applied review comments for mutable dispatch global arguments test:
- clFinish to ensure command-buffer has finished executing for calling clUpdateMutableCommandsKHR
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>
* Remove explicit base class call.
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>
* Update global size and local size to meet the spec requirements.
Make sure work-groups number is not increased after update of command-buffer.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Remove uneeded includes.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
---------
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Add tests for external sharing not dependant on semaphores.
Additional external sharing tests that use fences instead of semaphores.
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>
* Apply changes for review.
Apply changes for review:
- Make VkFence + clFinish a synchronization option to existing tests
instead of creating a separate test that uses fence.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Fix build break.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Fix resource release conditions.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Fix fence usage.
Fixed following fence issues:
- Add missing link to command buffer
- Add fence reset before wait
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Add Vulkan wrapper for fence.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Rework fence reset.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Change synchronisation mechanisms.
Changes made:
- wait for fence with clFinish
- queue submit with wait for fence
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Replace clFinish with vkWaitForFences.
Replaced clFinish with vkWaitForFences in Vulkan exectution context.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Replace remaining clFinish with vkWaitForFences.
Replaced remaining clFinish with vkWaitForFences in Vulkan exectution context.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Fix review comments for synchoronisation simplification.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Fix review comments for synchoronisation simplification for remaining tests.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Fix condition check.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
---------
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Modernization of conversions test, preparation to handle cl_khr_fp16 extension
* Added missing virtual descructor
* Added corrections due to code review
* More separators removed
* Fixed clang format
* Added multiple corrections related to code review
* Corrected missing implicit test lost after modernization corrections
* Corrected single, selected test to limit number of unnecessary operations
* Added cl_khr_fp16 support for test_vloadstore from basic (issue #142, basic)
* Moved string helper procedures due to request from test_commonfns PR #1695
* restored original test sizes
* Corrected invalid initialization of reference buffer
* Added cl_khr_fp16 extension support for test_op_vector_extract from spirv_new (issue #142)
* Added missing condition to test available cl_khr_fp16 extension
* Added cl_khr_fp16 extension support for test_op_vector_insert from spirv_new, work in progress.
* Added cl_khr_fp16 extension support for test_op_vector_insert from spirv_new (issue #142)
`create_single_kernel_helper` is called in a loop, overwriting the
objects contained in the wrapper classes. The wrapper class is not
aware of this, as the overwriting happens through its `operator&`.
Move the wrapper objects into the loop, so that the contained objects
get released as soon as the program and kernel objects are no longer
needed.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
In preparation of re-enabling -Wsign-compare globally, fix some
instances of this warning.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
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>
* 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>
* 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...