In `os_helpers.cpp`, the preceding `if` already handles negative
values, so cast to unsigned.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
The OpenCL Headers have cl_khr_external_memory_dx, cl_khr_external_memory_dma_buf and cl_khr_external_semaphore_dx_fence as extension strings, but CTS Compiler fails if an implementation says that it supports them.
`sizes` is a pointer argument, so the expression does not compute the
presumably intended number of elements in `sizes`.
Fixes a `-Wsizeof-pointer-div` warning.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* Added initial commit for event sync test cases (issue #1369, p.3.3)
* Added test cases for return event scenarios with and without out-of-order, work in progress (#1369, p.3.3)
* Added support for return event test cases for both regular and out-of-order command queue (#1369, p.3.3)
* Added user event test cases, cosmetic corrections (#1369, p.3.3)
* Added correction for windows build (#1369, p.3.3)
* Corrected proper testing of test fail/skip conditions (#1369, p.3.3)
* Added corrections related to PR review (#1369, p.3.3)
* Added correction related to change of order Skip/SetUp (issue #1369, event sync)
* Added clang format correction for previous commit
* Reordered initialization of attributes.
The `cl_*` types need two levels of braces for initialization: the
outer braces for the union and the inner braces for the array.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
test_vulkan is disabled by default as part of
PR #1530.
Given the ongoing development to test_vulkan,
it is important to have this enabled in CI builds
to avoid breaking test builds.
Enable the test build as part of presubmit script.
Disabling of frem and fmod by b81b49e1 ("spirv: disable frem and fmod
tests for now (#1614)", 2023-02-07) introduced some new warnings about
multi-line `//` comments due to the trailing backslashes. Fix these.
Also fix a typo.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* Added test cases for profiling command-buffers according to issue description #1369, p.3.2:
https://github.com/KhronosGroup/OpenCL-CTS/issues/1369
* Added cosmetic fixes (#1369, p.3.2)
* Corrected the path of initialization profiling event for simultaneous test (#1369, p.3.2):
https://github.com/KhronosGroup/OpenCL-CTS/issues/1369
* clang format fix
* Added correction related to macos build error (#1369, p.3.2)
* Applied corrections related to code review (#1369, p.3.2)
* Corrected query of queue properies (issue #1369, command buffer profiling)
* Reverted formating of unrelated header
* Added code review corrections for type consistency and fail condition (issue #1369, p.3.2)
* Reordered initialization of attributes.
* Reverted correct order of initialization.
* Add test for clGetEventInfo info queries.
Test clGetEventInfo() info queries from event returned by command-buffer
enqueue for the single command-queue to command-buffer case:
* CL_EVENT_COMMAND_TYPE is CL_COMMAND_COMMAND_BUFFER_KHR
* CL_EVENT_COMMAND_QUEUE
* CL_EVENT_CONTEXT
* CL_EVENT_COMMAND_EXECUTION_STATUS
* CL_EVENT_REFERENCE_COUNT
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
* Fix return TEST_FAIL instead of -1.
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
---------
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
The `command_buffer` member is initialized with `this`, and should
thus be initialized after all other members have been initialized, to
avoid any potential uninitialized data accesses by `command_buffer`'s
constructor. This is currently not a problem, but would become a
problem when `command_buffer`'s constructor accesses the object
through its parameter.
Fixes a -Wreorder warning.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* Added tests for 1.1 individual command entry-points.
* Adding fixes pointed out in review: checks for CL_DEVICE_IMAGE_SUPPORT, remove redundant buffers, synchronisation issues, fixed clang-format, other minor issues.
* Fix compilation issues for Windows and macOS, fix clang-format.
* Fix compilation issue for Windows.
* Removed redundant blocking and event operations.
* Style fixes for test skip conditions.
* Fix clang format.
* Fixed function names, file names, comments and barrier test.
* Restored Individual command entry-points tests after merge with main.
* Fix clang format.
* Superficial fixes for review.
* Fix Skip() condition for barrier test
* Fix typos
* Fix new line
Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
The OpenCL SPIR-V Environment Specification does not require the SPIR-V
opcodes `OpFMod` and `OpFRem` to match any OpenCL C semantics, so
implementations implementing those two instructions according to Vulkan
and/or OpenGL semantics will fail those tests without actually violating
any OpenCL specification.
We should keep those tests disabled until we figure out what the actual
precision requierement should be and update the test accordingly.
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Simplify code by returning directly instead of using goto statements.
Although intended as an NFC commit, this changes the behaviour around
clFlush calls. Before this commit, failure of the third clFlush call
would print "clFlush 3 failed" and return the clFlush error code.
This behaviour is inconsistent with the other clFlush calls in
math_brute_force, which are not fatal. The lack of a `goto exit`
makes me suspect that this 3rd clFlush call was intended to be
non-fatal too. As such, this commit makes all clFlush calls non-fatal
by returning `CL_SUCCESS` even when the third clFlush call fails.
Original patch by Marco Antognini.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* Don't recalculate image parameters repeatedly in `test_read_image()`
We've already done this in the loop. There's no need to recalculate
those parameters over and over again in `sample_image_pixel*()` and
`read_image_pixel*()`. This should save some work during the image
streams test.
This only affects the 3D tests for now, but my time profiles indicate
this is where we spend the most time anyway.
* Vectorize read_image_pixel_float() and sample_image_pixel_float() for SSE/AVX
This shortens the image streams test time from 45 minutes without it to
37 minutes. Unfortunately, most of the time is now spent waiting for
memory, particularly in the 3D tests, because the 3D image doesn't
neatly fit in the cache, especially in the linear sampling case, where
pixels from two 2D slices must be sampled. Software prefetching won't
help; it only helps when execution time is dominated by operations, but
this is dominated by memory access. Randomized offsets are likely a
factor, because they throw off the hardware prefetcher.
One possible further optimization is, in the linear sampling case, to
load two sampled pixels at once. This is easy to do using AVX, which
extends SSE with 256-bit vectors.
Obviously, this only applies to x86 CPUs with SSE2. The greatest
performance gains, however, are seen with SSE4.1. Most modern x86 CPus
have SSE4. Work is needed to support other CPUs' vector units--ARM
Advanced SIMD/NEON is probably the most important one. Another
possibility is arranging the code so that the compiler's
autovectorization will kick in and do what I did here manually.
Simplify code by avoiding manual resource management.
This fixes use of an uninitialized `d` in the `free_mtdata` call, in
the case a `goto exit` was executed before initializing `d`.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
There is no particular reason to limit the domain of unsigned 32-bit
integers in the input, so use genrand_int32 directly.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
Align `verify_data` with `checker_image_mem_host_read_only.hpp`, that
is, take an explicit pointer to compare against.
Add a missing (but unused) `float` parameter to
`KernelArgSampler::compare`.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Xcode 14 deprecated functions such as `sprintf` which is used in many
places. As an immediate fix for the pre-commit checks, disable
deprecated function warnings when building for macOS.
Contributes to https://github.com/KhronosGroup/OpenCL-CTS/issues/1626
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* grab latest from upstream OpenCL
* Removed events for host to device data transfers
* grab latest from upstream OpenCL
* 1.) revert changes to CMakeLists.txt and run_batch script in hopes this will solve the CI issues for the PR.
2.) resolve the merge conflict in test_conversions.cpp
* 1.) resolve 2 additional merge conflicts
* 1.) resolve 1 additional merge conflicts
* locally this fails clang-format but CI version seems to require it.
* fix the warning.
* Remove now-unused event
Also, cut down a comment that is no longer accurate.
Co-authored-by: Joshua Luceno <joshualuceno@gmail.com>
Co-authored-by: Chip Davis <chip@holochip.com>
Co-authored-by: Chip Davis <cdavis5x@gmail.com>
* grab latest from upstream OpenCL
* Use clEnqueueFillBuffer rather than memset4 in all test files
* Cleanup leftover code from memset_pattern4
* Remove unnecessary map, unmap, writeBuffer from math_brute_force tests
* Remove extraneous build system change
* Appease clang-format
* Add option to perform buffer fills on the host
Co-authored-by: Taeten Prettyman <taeten.j@gmail.com>
Co-authored-by: taetenp <taet@holochip.com>
Co-authored-by: Chip Davis <chip@holochip.com>
* Added on-device reset for half
* run clang-format.
* test_half - Reset buffer with ushort rather than half type
* Half - update type in secondary reset kernel src
* Remove useless memset() calls.
* Add an option to still perform buffer resets on the host
* Check for program generation failure before attempting to create the kernel
* Don't exceed the range of a ushort when storing
* Appease clang-format
Co-authored-by: Joshua Luceno <joshualuceno@gmail.com>
Co-authored-by: taetenp <taet@holochip.com>
Co-authored-by: Chip Davis <chip@holochip.com>
print_hex_mem_dump was calling `sprintf` with source and destination
buffers overlapping, which is explicitly forbidden. Rewrite the
function to use C++ stringstreams instead.
This commit only affects the error path and does not change the
printed output. Error logs before and after this commit should not
differ.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
It only contains a pointer type definition for test functions that
really ought to be provided by testHarness.h.
Signed-off-by: Kévin Petit <kpet@free.fr>
Signed-off-by: Kévin Petit <kpet@free.fr>
Fail when an unhandled image format is encountered instead of
continuing validation with uninitialized variables.
Fixes a `-Wsometimes-uninitialized` warning for e.g. the `tolerance`
variable.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Simplify code by relying on RAII to free resources.
This commit only affects tests that use `BuildKernelInfo2`, which are
the single-threaded tests.
Original patch by Marco Antognini.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
`BufferAction::Setup` has an additional parameter `allocate` which
hides the virtual function `Action::Setup`. The additional parameter
was unused anyway, so remove it.
Fixes a -Woverloaded-virtual warning.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Replace repetitions of extensions_supported[num_of_supported_extensions]
with a single pointer variable.
Replace character-by-character comparisons with a new string_has_prefix
function.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
Move functions in .h files to .cpp files where appropriate; align
prototypes and definitions; and remove functions that are not used.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* very basic test infrastructure
* move test to integer_ops
* added bitfield_reverse test
* added test for bitfield insert
* add a separate file for bitfield_extract
* cleaned up implementation and all tests are passing
* rename helper file so it can be used by other tests
* remove temporary hacks
* fix formatting
* address code review comments
* remove duplicated code after rebase
* fix formatting
a few naming changes for consistency
more changes for consistency
* fix copyright dates
* remove unused variable
So we get finer grain reporting and better parallelisation in the future.
Signed-off-by: Kévin Petit <kpet@free.fr>
Signed-off-by: Kévin Petit <kpet@free.fr>
Remove a misleading comment at the end. Improve comments in general,
and use `true`/`false` for `bool`s.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
It seems the intent was to use `.xyzw` vector component accessors in
the kernel whenever `vecSize` is 2, 3, or 4. The condition was wrong
(i.e., always true for any value of `vecSize`), causing it to always
create a kernel with numeric (`.s0123...`) vector component accessors.
The restriction on the use of `.xyzw` for 8 and 16-component vectors
has been lifted a while ago (see
https://github.com/KhronosGroup/OpenCL-Docs/issues/549) so we do not
need this check at all.
Also, fix the `vecSize` argument of two calls of `get_order_string`
when getting the order string for the "in" kernel argument. Pass
`inVecSize` in these cases, not `outVecSize`.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Simplify code by relying on RAII to free resources. Reduce code
duplication.
This commit only affects tests that use `BuildKernelInfo`, which are
the multi-threaded tests. Another patch will deal with the
single-threaded tests, i.e., those using `BuildKernelInfo2`.
Original patch by Marco Antognini.
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
`std::exception` and `std::runtime_error` are polymorphic types and as
such they shouldn't be passed by value.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* Remove invalid assumption from sub-group tests
The sub-group dispatch tests were making the invalid assumption that
querying the local size (via `CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT`)
for a sub-group count obtained from a
`CL_KERNEL_SUB_GROUP_COUNT_FOR_ND_RANGE` with local size `{x, y, z}`
will result in the same local size i.e. that
`CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT` is the inverse of
`CL_KERNEL_SUB_GROUP_COUNT_FOR_ND_RANGE`. To take a trivial example
consider the case that there is only ever one sub-group per work
group(i.e. sub-group == work-group). Then regardless of the local size
passed to `CL_KERNEL_SUB_GROUP_COUNT_FOR_ND_RANGE` the sub-group count
will always be `1`, and `CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT` can
return any valid local size since all local sizes result in `1`
sub-group.
* Format surrounding changes