When comparing scanlines for SNORM images, take into account that -1.0
can be exactly represented in two different ways.
---------
Co-authored-by: Ben Ashbaugh <ben.ashbaugh@intel.com>
All existing tests in `test_image_streams`, that are capable of testing
image formats using the `CL_UNORM_INT_2_101010_EXT` data type, do so.
Signed-off-by: Gorazd Sumkovski <gorazd.sumkovski@arm.com>
Currently we don't escape subnormal values when generating image data.
In sampler read tests, we use `!=` to check the two values even when it
is floating-point data, which requires the two values are bitwise equal.
However, a sampler might flush subnormal values, causing the test case
to fail.
In this patch, when generating random image data, we escape subnormal
values.
* 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
Add support for `CL_UNORM_INT_101010_2` in the `get_pixel_size` helper
function. This fixes the following tests:
* memInfo_image_from_buffer_positive
* image_from_buffer_alignment_negative
* imageInfo_image_from_buffer_positive
Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
* Replace OBSOLETE_FORAMT with OBSOLETE_FORMAT
In imageHelpers.cpp and few other places in image tests, OBSOLETE_FORMAT is misspelled as OBSOLETE_FORAMT.
Fix misspelling by replcaing it with OBSOLETE_FORMAT.
Fixes#1769
* Remove code guarded by OBSOLETE_FORMAT
Remove code guarded by OBSOLETE_FORMAT
as suggested by review comments
Fixes#1769
* Fix formating issues for OBSOLETE_FORMAT changes
Fix formatting issues observed in files while removing
code guarded by OBSOLETE_FORMAT
Fixes#1769
* Some more formatting fixes
Some more formatting fixes to get CI clean
Fixes#1769
* Final Formating fixes
Final formatting fixes for #1769
* 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.
The main sources of warnings were:
* Printing of a `size_t` which requires the `%zu` specifier.
* Printing of `cl_long`/`cl_ulong` which is now done using the
`PRI*64` macros to ensure portability across 32 and 64-bit builds.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* imageHelpers: add CL_UNORM_SHORT_{555, 565} in get_max_absolute_error
Working on a device supporting CL_UNORM_SHORT_565 image data type, I
noticed that the max absolute error authorized was not the right one
for such image data type.
Also because of normalization, there is always an absolute error
authorized whatever the filtering of the sampler.
Ref #1140
* put back if statement on filter_mode
* Fix clang 10 build errors
Lossy casts due to inexact float representation of CL_INT_MAX
* Fix clang format
* Remove implicit-const-int-float-conversion flag
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>
* gles: Fix compile warnings.
For 32 and 64-bit Visual Studio and the Android Q NDK.
* Fix formatting violations
Co-authored-by: spauls <spauls@qti.qualcomm.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>
* Use std::vector for format lists in images suite
Avoids memory deallocation issues and generally simplifies the code.
* Fixup formatting with git-clang-format
* Using helper functions for clCreateKernel
Uses of clCreateKernel following create program helper
functions, have been incorporated into
create_single_kernel_helper when suitable.
Contributes #31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Skip tests using clCompileProgram in offline mode
Contributes #31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Using type wrappers when using kernel helper functions
Also includes fix for windows build
Fixes#31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Remove clReleaseKernel for wrapped kernel
Fixes#31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Reformat common help text
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* Reformat test harness code
This goes part of the way to fixing issue #625.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* Use float<->half conversion routines from the OpenCL headers
Fixes#870
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
* Use cl_half_from_double
* Fix windows build errors
* Fix more build errors
* Code formatting
* Remove TEST class
* Enable -Werror for GCC/Clang builds
Fixes many of the errors this produces, and disables a handful that
didn't have solutions that were obvious (to me).
* Check for `-W*` flags empirically
* Remove cl_APPLE_fp64_basic_ops support
* Undo NAN conversion fix
* Add comments to warning override flags
* Remove unneeded STRINGIFY definition
* Fix tautological compare issue in basic
* Use ABS_ERROR macro in image tests
* Use fabs for ABS_ERROR macro
* Move ABS_ERROR definition to common header
An existing workaround on the max_image size calulcation that disallows
the width of an image to be less than 16 can stress the calculcation of
the remainder dimension to be less than 1.0 in size. In three dimentional
objects (3d,2d array) where one dimention is set to max and the other is
set to 16 there might not be enough space left for the 3rd one.
This workaround clamps the third dimension to a minimum of 1.0
Signed-off-by: John Kesapides <john.kesapides@arm.com>
* imageHelpers: Created generic function that returns a vector of required image formats.
An upcoming commit requires access to the vector of required image formats, separatley from check_minimum_supported.
* imageHelpers: Added a new function is_image_format_required.
This function can be used to determine for any given cl_image_format, whether the implementaion is required to support it.
Conditionally test BGRA in Basic readimage3d (#623)
This change adds checks to see if testing against an embedded implementation and if so, queries whether BGRA is supported or not.
* Refactor based on PR review.
* Update passed message code.
* Changed scope of struct to be within test_readimage3d.
* Update table of required image formats (#427)
This commit updates the table of required image formats. The table is built depending on the profile of the device, the requested image type, and the avaiablitiy of relevent extensions.
* Fixed incorrect argument to memcpy.
* Made image format arrays static.
* Utilised ARRAY_SIZE where appropriate.
* Re-named required image format bools to be more explicit.
* Made sRGBA, CL_UNORM_INT8 a required full format profile.
Misinterpretation of the spec had made this optional.
* check_minimum_supported: switched to using vectors.
* Added CL_sRGB CL_UNORM_INT8 to full profile required formats.
This matches the same channel data type requirement as CL_sRGBA.
* Overload <= and >= for the Version class.
* Correct the condition under which sRGB images are required.
* Correct the required image formats are based on OpenCL version.
The spec says that for different OpenCL versions, different sets of image formats are required.
* Print out the correct OpenCL version when required image format is not found.
* Improved the way in which image formats are added based on profile and version.
* Potential build fix regarding isnan namespace issues.
* Image Helpers: Remove duplicate copies when building required image format vectors.
Also re-ordered a branch to make it clearer.
* 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
* Moved all instances of gDeviceType to imageHelper.cpp
* Missed one instance of gDeviceType
* Removed all instances of extern cl_device_type gDeviceType, except in imageHelpers.h
* Require exact for match normals, instead of arbitrary .005 relative error
* Add relaxation to allow 0 when float denormal is expected
* Refactor to use common validation function
This removes all the duplicated code from each test, and moves it to
test harness so that we have single place where this information is
printed.
Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
This fix is required due to char defaulting to unsigned on
arm platforms while the test code assumes char will be signed.
Signed-off-by: Sam Laynton <sam.laynton@arm.com>
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
The maintenance of the conformance tests is moving to Github.
This commit contains all the changes that have been done in
Gitlab since the first public release of the conformance tests.
Signed-off-by: Kevin Petit kevin.petit@arm.com