1. Remove duplicate `create_image` code that is in both clFillImage and
clCopyImage test directories.
2. Unify how pitch buffer's memory is deallocated; The buffer can be
allocated with either `malloc` or `align_malloc` and the free function
is pre-set in `pitch_buffe_data`'s member variable `free_fn` and used
when the buffer is deallocated. With this, the change removes
`is_aligned` conditional variable that was used to select the
appropriate free function.
Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
This change fixes the following issues when running `clCopyImage` test
with `use_pitches` flag for 1D buffer images.
1. Query device CL version using `get_device_cl_version` rather than
using `CL_DEVICE_VERSION`. Previously, using `char` may not be enough to
store the return value.
2. Pass `host_ptr` to `clCreateBuffer` when creating the buffer for the
1D image. `host_ptr` may not be `nullptr` if use_pitches flag is used.
Also, `buffer_flags` will contain `CL_MEM_USE_HOST_PTR` which requires a
host pointer to be passed.
3. Conditionally use the `host_ptr` when calling `clCreateImage`, it
will not be used with 1D image buffer. This is made to align with the
spec, in which if `mem_flags` has `CL_MEM_USE_HOST_PTR` a host pointer
must be present, but if the memory flag is not present, host pointer
must be `nullptr`.
4. Use the correct free function `free` and `align_free` based on the
allocation function that was used.
Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
Printing of a `size_t` requires the `%zu` specifier.
This fixes occurrences where the previous wrong specifier appears to
work in a typical 64-bit build, but causes a Wformat warning in 32-bit
builds.
---------
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* cl_copy_images
* cl_get_info
* cl_fill_image
* cl_read_write_image
* kernel_image_methods
* IMAGE1D_BUFFER cannot be created with (USE_|ALLOC_|COPY_)_HOST_PTR
* do not allow mipmap with 1D buffer
* adjust M to be within maximum_sizes and max_pixels
* remove unused variables
* make sure M will never be 0
* fix region[0] after refactoring removing mipmap
* fix formatting
* format with clang-format-11
* fix image1d_buffer creation with gEnablePitch
* add missing case in switch
* use align_malloc when CL version is at least 2.0
* use CL_DEVICE_NUMERIC_VERSION and align_free
* fix free of pitch buffer
* fix formatting
* fix formatting
* fix data->is_aligned
The verification uses a common function with nested loops to verify
the result of the copy operation. The upper loop limits thirdDim and
SecondDim should be set according to the image type under test. Previously
for 1D/2D they were set from dstImageInfo->depth and dstImageInfo->height.
The issue is that the depth and height are set to 0 when unused. This
caused the verification loop to be skipped.
Signed-off-by: John Kesapides <john.kesapides@arm.com>
The slice pitch/padding calculation assumed that the 'height' variable contained the pixel height of the image, which it doesn't for IMAGE1D_ARRAY.
Fixes#1257
The CL_UNORM_SHORT_555 and CL_UNORM_INT_101010 formats contain padding
bits which need to be ignored in clCopyImage and clFillImage testing.
For clFillImage tests, padding was not ignored for the CL_UNORM_SHORT_555
format, and was ignored for CL_UNORM_INT_101010 by modifying actual and
reference data. For clCopyImage tests, padding was not ignored, both for
CL_UNORM_SHORT_555 and for CL_UNORM_INT_101010.
Fix this by adding a new compare_scanlines() function, which is used for
both of these formats, and does not modify the actual or reference data.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
clCopyImage and clFillImage contain near-duplicate code for logging of
pixel difference errors. Move this into imageHelpers.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* Minor fixes for clCopyImage.
Signed-off-by: John Kesapides <john.kesapides@arm.com>
Change-Id: I63c47570e45580e5e29716a46929cb1127711c6b
* Convert comment to CTS style.
Return error code instead of -1 in clFinish.
* Remove unused code in clCopyImage
Some of the declarations that are still used now moved to testBase.h
as these are reused throughout the image tests.
Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
* Add missing file
Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
This function is duplicated across clCopyImages files, so just keep one
definition in common file, and get rid of the duplicated ones.
Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
* set gDeviceType in testharness.c, also moved gTestRounding to imageHelpers.cpp & .h and removed duplicate code from host_atomics.cpp
* Cleaned up some redundant code
* Reversed the change in testharness.c
Some of the setup functionality is already there in the test harness, so
use that and remove the duplicated code from within the suite.
Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>