Simplify code by returning directly instead of using goto statements.
Although intended as an NFC commit, this changes the behaviour when
verification fails: the output buffer is no longer unmapped. Although
not ideal, this aligns the behaviour of `macro_unary_float` to the
other math_brute_force tests.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* Fix for Command buffer wait_for_sec_queue_event subtest, call clFinish in the correct order.
queue has a command that depends on a command that resides in queue_sec, calling clFinish(queue) before clFinish(queue_sec) causes the test to hang as the queue_sec command never got a chance to finish.
* Update PR change as per the suggestion.
* Vulkan: Fix descriptor sets
Use descriptor set arrays when programming
arrays for compute shader.
Change-Id: Idabab775a256a223660eb7a850e26f290453659e
* Vulkan: Fix queue propertyies
Transfer bit for queue family is not required
to be reported by the implementation, it is
implicit for compute.
Change-Id: I7424b00e25e35145433dd74b0b4dfe7eeeaf98c8
* Vulkan: Allow implementation to choose dedicated memory
Dedicated vs non-dedicated memory must be queried by
the app. Implementations are not required to support
exportable non-dedicated memory.
Change-Id: Idbc46ace1be20f61d1b58b34756f6d79a7745911
* Fix formatting
Auto-generated formatting fix
* Fix bug in dedicated memory.
* Add check for if OpenCL assumes linear tiling
Change-Id: Idd2e24d9d69e1fbc3ccb4a279067533104185332
* Changed macro name to reflect spec
CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_HANDLE_TYPES_KHR to
CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR
Also changed some functions to not use the KHR variants.
---------
Co-authored-by: Joshua Kelly <joshkell@qti.qualcomm.com>
Some new extension formats require the width to be a multiple
of 4 or 2 (see cl_ext_image_raw10_raw12).
Change has not functional impact as the affected image is only used
for generic queries.
Signed-off-by: John Kesapides <john.kesapides@arm.com>
This patch adds two test cases related to command-buffer finalization:
1) That it is an error to finalize and already finalized command-buffer.
See https://github.com/KhronosGroup/OpenCL-Docs/pull/817
2) That it is not an error to create, finalize, and execute an empty
command-buffer. Closes issue #1781
The subgroup and workgroup sizes reported by clGetKernelSubGroupInfo
and clGetKernelWorkGroupInfo are of type `size_t`. Avoid changing the
values to an `int` type as they are propagated through the tests and
then compared against `size_t` again.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Before this change, `add_index_bin_test` would not release `cl_mem`
resources or `malloc`ed memory when encountering an error. Fix by
using `clMemWrapper` and `std::unique_ptr` to automatically release
resources.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Avoid a maybe-uninitialized warning by ensuring that `oldMode` is
always initialized to 0. There is no need to use `memset` for this,
as `FPU_mode_type` is either an `int` or an `int64_t`.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Modify the external semaphore extension test
to use SYNC_FD, if available on the device.
Deleted tests that are not compatible with blocking
semaphores.
`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>
* 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>