Commit Graph

110 Commits

Author SHA1 Message Date
gorazd-sumkovski-arm
bcfd8f82cd Extend testing of CL_UNORM_INT_101010_2 (#2031)
All existing tests in `test_image_streams`, that are capable of testing
image formats using the `CL_UNORM_INT_101010_2` data type, now do so.
2024-09-16 08:45:16 -07:00
arm-wk
f47354680f Limit buffers sizes to leave some memory for the platform (#1172)
Some conformance tests use directly the size returned by the runtime
for max memory size to allocate buffers.
This doesn't leave enough memory for the system to run the tests.
2024-08-06 09:32:08 -07:00
ellnor01
13848621f1 Unduplicate kernel_read_write image tests (read) (#1552)
The kernel_read_write tests have a lot of duplicate code. These are the
next steps to reducing the duplication, by using the functions in
test_common.cpp as common for 1D, 1D array and 2D array.

---------

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
Co-authored-by: Ahmed Hesham <117350656+ahesham-arm@users.noreply.github.com>
2024-08-06 09:28:39 -07:00
Sven van Haastregt
f775377e6a image_streams: fix -Wformat warnings (#1948)
The main sources of warnings were:

 * Printing of a `size_t` which requires the `%zu` specifier.

* Printing of 64-bit values which is now done using the `PRI*64` macros
to ensure portability across 32 and 64-bit builds.

* Calling log_error with a format string of `"%f %f %f %f"` but
specifying only three arguments.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-07-02 09:38:36 -07:00
Ahmed
b3c89ebde0 Fixes for Image_from_buffer_alignment_negative when alignments are 1 (#1971)
The Image_from_buffer_alignment_negative test creates images with
incorrect pitches by adding 1 and tests whether the image creation
fails.

Devices that return 1 for either of
CL_IMAGE_REQUIREMENTS_ROW_PITCH_ALIGNMENT_EXT,
CL_IMAGE_REQUIREMENTS_SLICE_PITCH_ALIGNMENT_EXT or
CL_IMAGE_REQUIREMENTS_BASE_ADDRESS_ALIGNMENT_EXT will successfully
create the image and therefore fail the test.

This change allows to skip the image creation in this case as the error
condition (pitch % pitch_alignment != 0) will not be triggered for these
devices.
2024-06-18 09:40:14 -07:00
John Kesapides
fb39357911 Raw10/12 CTS tests (#1830)
Add support for cl_ext_image_raw10_raw12 testing
on test_image_streams.

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2024-05-21 08:44:28 -07:00
Romaric Jodin
be8b56d949 Test IMAGE1D_BUFFER in more scenario (#1806)
* 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
2024-04-16 08:48:05 -07:00
Romaric Jodin
7d3db1bd07 fix return code when readwrite image is not supported (#1873)
This function (do_test) starts by testing write and read individually.
Both of them can have errors.

When readwrite image is not supported, the function returns
TEST_SKIPPED_ITSELF potentially masking errors leading to the test
returning EXIT_SUCCESS even with errors along the way.
2024-01-16 09:52:08 -08:00
niranjanjoshi121
b041ec0a9a Replace OBSOLETE_FORAMT with OBSOLETE_FORMAT (#1776)
* 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
2023-12-28 18:52:13 +00:00
John Kesapides
115e999a38 Image2d_from_buffer_positive comparison fix (#1569)
Only check against 2D image types as per the spec.
Move some device checks out of the loop.
Only perform the checks when element_size is a power of two.

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2023-11-07 09:31:18 -08:00
John Kesapides
4984196bcb Fix CopyImage verification for 1D/2D images (#1791)
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>
2023-10-03 09:30:46 -07:00
Sven van Haastregt
aa953aaa51 [NFC] cmake: do not suppress -Wsign-compare globally (#1810)
Only disable `-Wsign-compare` for tests that do 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>
2023-09-20 15:48:25 +01:00
John Kesapides
8fd55dc889 Fix minimum image size for cl_ext_image_requirements_info (#1790)
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>
2023-08-29 09:18:11 -07:00
Sven van Haastregt
475a37abbf [NFC] Do not use reserved names for include guards (#1737)
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>
2023-06-09 11:25:20 +01:00
Sven van Haastregt
957e3b3985 Convert some if-else chains to switch statements (#1730)
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>
2023-05-24 11:11:23 +01:00
Sven van Haastregt
1884042f5d [NFC] cmake: do not suppress -Wunused-but-set-variable globally (#1723)
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>
2023-05-16 09:58:04 +01:00
Kévin Petit
06c0c99c2e Enable clCopyImage suite to run in parallel (#1717)
Signed-off-by: Kévin Petit <kpet@free.fr>
2023-05-13 10:21:34 +01:00
paulfradgley
033aa195c5 Pass 'flag' variable through to clGetImageRequirementsInfoEXT (attempt 2) (#1700)
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.
2023-04-25 09:17:22 -07:00
Ahmed
9afb918bf5 Disable vendor extension formats from image_from_buffer_fill_positive as the verification step is incorrect and can cause seg fault, e.g. for YUV images (#1657) 2023-03-28 09:16:15 -07:00
Ahmed
14f421e54b Fix slice pitch for 1D array images on image_from_buffer_read_positive kernel_read_write images subtest (#1654) 2023-03-28 09:15:33 -07:00
Sven van Haastregt
8352966818 [NFC] Remove unused imagePtr variable (#1682)
This variable is shadowed by another variable further down.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-03-27 12:03:07 +01:00
Ben Ashbaugh
e71a7bce68 Revert "Image streams optimization (#1616)" (#1638)
This reverts commit b73c3149ad.
2023-02-28 09:06:34 -08:00
Chip Davis
b73c3149ad Image streams optimization (#1616)
* 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.
2023-02-07 08:46:15 -08:00
Sven van Haastregt
3cadff7115 Fix unused-function warnings and enable -Wunused-function (#1576)
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>
2022-12-13 09:47:48 -08:00
Kévin Petit
ed27a90775 samplerlessReads: split out 1D Buffer testing into a separate test (#1570)
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>
2022-12-10 11:01:35 +00:00
Stuart Brady
77049a3a0f Add missing newlines in log messages for image tests (#1564)
Also use log_info instead of printf for skipped tests, for consistency.

Signed-off-by: Stuart Brady <stuart.brady@arm.com>

Signed-off-by: Stuart Brady <stuart.brady@arm.com>
2022-11-08 09:28:30 -08:00
Sven van Haastregt
f29ebf0d59 [NFC] image_streams: Remove unused label (#1560)
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2022-11-04 08:54:05 -07:00
Sven van Haastregt
8bb69ef665 Fix -Wformat-extra-args warnings (#1533)
Fix a few instances where an incorrect number of arguments was
supplied when calling (v)log_error.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2022-11-01 13:09:48 -07:00
Grzegorz Wawiorko
f6e37b17d2 Fix image test image2d_from_buffer_positive (#1515) 2022-10-11 09:34:33 -07:00
Nikhil Joshi
07b055cd68 Cap CL_DEVICE_MAX_MEM_ALLOC_SIZE to SIZE_MAX (#1501)
* Fix enqueue_flags test to use correct barrier type.

Currently, enqueue_flags test uses CLK_LOCAL_MEM_FENCE.
Use CLK_GLOBAL_MEM_FENCE instead as all threads across work-groups
need to wait here.

* Add check for support for Read-Wrie images

Read-Write images have required OpenCL 2.x.
Read-Write image tests are already being skipped
for 1.x devices.
With OpenCL 3.0, read-write images being optional,
the tests should be run or skipped
depending on the implementation support.

Add a check to decide if Read-Write images are
supported or required to be supported depending
on OpenCL version and decide if the tests should
be run on skipped.

Fixes issue #894

* Fix formatting in case of Read-Write image checks.

Fix formatting in case of Read-write image checks.
Also, combine two ifs into one in case of
kerne_read_write tests

* Fix some more formatting for RW-image checks

Remove unnecessary spaces at various places.
Also, fix lengthy lines.

* Fix malloc-size calculation in test imagedim

unsigned char size is silently assumed to be 1
in imagedim test of test_basic.
Pass sizeof(type) in malloc size calculation.
Also, change loop variable from signed to unsigned.
Add checks for null pointer for malloced memory.

* Cap CL_DEVICE_MAX_MEM_ALLOC_SIZE to SIZE_MAX

Cap CL_DEVICE_MAX_MEM_ALLOC_SIZE to SIZE_MAX
when CL_DEVICE_GLOBAL_MEM_SIZE is capped with SIZE_MAX.
test_allocation caps the value of GLOBAL_MEM_SIZE to SIZE_MAX
if it exceeds the value of SIZE_MAX(value depends on platform bitness),
but doesn’t modify MAX_ALLOC_SIZE the same way.
Due to this MAX_ALLOC_SIZE becomes greater than GLOBAL_MEM_SIZE
and the test fails.

Modify MAX_MEM_ALLOC_SIZE as GLOBAL_MEM_SIZE when it exceeds SIZE_MAX

OpenCL-CTS #1022
2022-10-04 09:13:18 -07:00
ellnor01
c014122742 Creating common functions for image/kernel_read_write read tests (#1141)
* Make InitFloatCoords suitable for all image types

Contributes #616

* Create common functions neutral for image types

Remove 3D specific code from common test_read_image so using
it for other image types is simpler in following patches

Contributes #616

* Removing unused code

Tidying commented out or unnecessary code

Contributes #616

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* Restoring 'lod' variable name

Contributes #616

* Default cases to handle unsupported image types

Contributes #616

* Resolving build issues

Contributes #616

* Fix formatting

Contributes #616

* Using TEST_FAIL as an error code.

Contributes #616

* Add static keyword, improve error handling

Contributes #616

* Fix build errors with least disruption

Contributes #616

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2022-09-26 12:57:42 +01:00
Sven van Haastregt
92285f7c9d cmake: Add set_gnulike_module_compile_flags (#1510)
Factor out a macro to set module-specific compilation flags for
GNU-like compilers.  This simplifies setting compilation flags per
test.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2022-09-22 13:17:55 -07:00
Kévin Petit
c0a10f4e12 Tests for cl-ext-image-from-buffer and cl-ext-image-requirements-info (#1438)
* Add CTS tests for cl_ext_image_requirements_info

Change-Id: I20c1c77ff5ba88eb475801bafba30ef9caf82601

* Add CTS tests for cl_ext_image_from_buffer

Change-Id: Ic30429d77a1317d0fea7d9ecc6d603267fa6602f

* Fixes for image_from_buffer and image_requirements extension

* Use CL_MEM_READ_WRITE flag when creating images that support CL_MEM_KERNEL_READ_AND_WRITE (#1447)

* format fixes

Change-Id: I04d69720730440cb61e64fed2cb5065b2ff8bf90

Co-authored-by: Oualid Khelifi <oualid.khelifi@arm.com>
Co-authored-by: oramirez <oramirez@qti.qualcomm.com>
Co-authored-by: Sreelakshmi Haridas Maruthur <sharidas@quicinc.com>
2022-09-13 09:58:24 -07:00
Sven van Haastregt
6554c49018 [NFCI] Remove unused variables and enable -Wunused-variable (#1483)
Remove unused variables throughout the code base and enable the
`-Wunused-variable` warning flag globally to prevent new unused
variable issues being introduced in the future.

This is mostly a non-functional change, with one exception:

 - In `test_conformance/api/test_kernel_arg_info.cpp`, an error check
   of the clGetDeviceInfo return value was added.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2022-09-08 12:54:36 +01:00
Stuart Brady
cdf5a105fc Fix misleading indentation and enable -Wmisleading-indentation (#1458)
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
2022-08-02 18:16:03 +01:00
paulfradgley
3bf46004ef Fixes incorrect slice pitch calculation in clCopyImage 1Darray (#1258)
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
2022-05-31 08:55:42 -07:00
Jeremy Kemp
d54954c7cf Enable mipmap extension pragmas (#1349)
* Enable mipmap pragmas where appopriate.

* clang-format changes.
2022-05-17 08:52:40 -07:00
Jason Ekstrand
6e6249fb48 images: Stop checking gDeviceType != CL_DEVICE_TYPE_GPU (#1418)
* images: Stop checking gDeviceType != CL_DEVICE_TYPE_GPU

If the device type also advertises CL_DEVICE_TYPE_DEFAULT (which should
be valid), this causes it to be considered a CPU device and the tests
enforce different precision and rounding expectations.

* Fix clang-format

* Drop redundant NORM_OFFSET checks
2022-05-17 08:51:53 -07:00
Ben Ashbaugh
02bf24d2b1 remove min max macros (#1310)
* remove the MIN and MAX macros and use the std versions instead

* fix formatting

* fix Arm build

* remove additional MIN and MAX macros from compat.h
2021-09-13 13:25:32 +01:00
John Kesapides
80a4a833be Minor fixes for CL_UNORM_SHORT_565, CL_UNORM_SHORT_555 (#1129)
* Minor fixes for CL_UNORM_SHORT_565, CL_UNORM_SHORT_555

* Fix verification for undefined bit
* Relax current infinitely precision requirement for these formats
  and move check in common function.
* Add proper debug output.

Signed-off-by: John Kesapides <john.kesapides@arm.com>

* Minor Formating fix.

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2021-06-11 09:44:16 +01:00
Stuart Brady
0876ea10be Ignore padding bits in clCopyImage/clFillImage testing (#1184)
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>
2021-05-24 16:59:03 +01:00
John Kesapides
68ee30fb4b Fix possible size_t overflow in 32-bit builds. (#1131)
* Fix possible size_t overflow in 32-bit builds.

Use cl_ulong temporary values for row/slice_pitch.

Signed-off-by: John Kesapides <john.kesapides@arm.com>

* Remove redundant casts

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2021-03-09 22:57:49 +00:00
Stuart Brady
6f2cd12a0b Deduplicate logging of pixel differences (#1175)
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>
2021-03-09 09:09:52 +00:00
ellnor01
ca673af488 First steps in tidying image/kernel_read_write tests (#1121)
* Move common global variable and functions to header

InitFloatCoords for 3D read images has also been renamed
so it can later be used as a common function

Contributes #616

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* Set-up for using 3D functions as a base

test_read_image_3D had been moved to common.cpp (and renamed
test_read_image) along with corresponding
determine_validation_error_offset and InitFloatCoords.

Only function names and the formatting have been changed.

Contributes #616

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2021-02-02 08:56:00 +00:00
John Kesapides
5930853a9b Minor fixes for clCopyImage. (#1130)
* 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.
2021-01-29 14:16:55 +00:00
James Price
03a0989998 Use std::vector for format lists in images suite (#1105)
* Use std::vector for format lists in images suite

Avoids memory deallocation issues and generally simplifies the code.

* Fixup formatting with git-clang-format
2021-01-14 13:27:59 +00:00
james-morrissey-arm
901f5fcb63 Fix samplerlessReads read_write (#329) (#1016)
The test was trying to create read_write image with read_only formats.
Make it use common image formats for both read_only and read_write
flags when creating images.

Fixes issue #329

Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
Signed-off-by: James Morrissey <james.morrissey@arm.com>

Co-authored-by: Radek Szymanski <radek.szymanski@arm.com>
2021-01-11 15:02:26 +00:00
Grzegorz Wawiorko
2597027737 Use highest OpenCL C version (#1081)
* Set the highest supported OpenCL C version.

* Remove gDeviceLt20 variable - not used anymore.

* Fix formatting issues
2021-01-11 13:54:19 +00:00
james-morrissey-arm
24e6a9125c Use the right flags when creating images (#328) (#1015)
Test was querying for supported images with CL_MEM_WRITE_ONLY flag, but
always used CL_MEM_READ_ONLY to create images.

Fixes issue #328

Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
Signed-off-by: James Morrissey <james.morrissey@arm.com>

Co-authored-by: Radek Szymanski <radek.szymanski@arm.com>
2021-01-07 12:26:44 +00:00
ellnor01
5ae5e7a1fa Remove imageSupportRequired parameter to runTestHarness (#1077)
* Tests requiring image support use runTestHarnessWithCheck

Removing special case for images in runTestHarness.

Fixes #710

* Remove imageSupportRequired argument

Tests which require image support now specify this while
calling runTestHarnessWithCheck.

Fixes #710

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2020-12-09 16:12:40 +00:00