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.
Enable a larger set of compiler warnings globally for gcc/clang-like
compilers. This should help catch issues early and result in better
code quality. These warnings are primarily aimed at OpenCL-CTS
developers, so only enable them for non-release builds.
Ensure `-Wall` and `-Werror` are set before any `-Wno-...` options, as
the `-Wall`/`-Werror` flags undo `-Wno-...` for some compilers.
The code base does not compile cleanly with `-Wall` yet, so disable
some warnings. Do this globally for now, to keep this patch small and
localized.
Silence `-Wunknown-pragmas` (instead of only making them non-fatal),
to avoid verbose warning logs.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
To the best of my understanding, these occurrences of the
`-Wunused-but-set` warnings do not reveal any underlying issues, so we
can safely remove these variables. There are more occurrences of this
warning in other places (not touched by this commit) that require
further analysis.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
The `-Wno-...` compiler flags only result in a diagnostic if another
diagnostic is emitted. When passing such flags to
`add_cxx_flag_if_supported` (and `check_cxx_compiler_flag`), the test
would always succeed. For such cases, test the `-W...` flag instead
of the `-Wno-...` flag.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* Added support to test half floats with printf calls (issue #142, printf)
* Added corrections related to rounding and casting halfs (issue #142, printf)
* Reusing similar function (issue #142, printf)
* Corrected path without cl_khr_fp16 support (issue #142, printf)
* Cosmetic fix for order of vector tests (issue #142, printf)
* Added correction related to vendor test review (issue #142, printf)
* Added initial commit for issue #1369, p.1.4
* Added support for clGetCommandBufferInfoKHR test cases (issue #1369, p.1.3)
* Added correction for CL_COMMAND_BUFFER_QUEUES_KHR query test (issue #1369, p.1.4)
* Added corrections related to changed orders of operations Skip/SetUp and code review (issue #1369, clGetCommandBufferInfoKHR)
* Added cosmetic correction related to printout messages (issue #1369, clGetCommandBufferInfoKHR)
* Corrected info_prop_array test to accept scenario without simultaneous use (issue #1369, p.1.4)
* Added protection test agains POCL unexpected values (issue #1369, p.1.4)
* Added corrections related to Ben's code review