Commit Graph

133 Commits

Author SHA1 Message Date
Michael Rizkalla
b681d4f2c8 Add cl_ext_immutable_memory_objects tests writing to and from buffer (#2432)
This change extends the test coverage for
https://github.com/KhronosGroup/OpenCL-Docs/pull/1280

The change tests:
1. Writing to immutable buffers.
2. Writing to buffer/image from immutable buffers.
3. Reading from immutable buffers.

This change adds the following tests:
1. `test_negative_imagearraycopy`
2. `test_negative_imagearraycopy3d`
3. `test_immutable_bufferreadwriterect`
4. `test_immutable_arrayreadwrite`
5. `test_write_from_immutable_buffer_to_buffer`
6. `test_immutable_buffer_map_*`

and extends the following tests:
1. `test_arrayimagecopy3d`
2. `test_arrayimagecopy`
3. `test_imagearraycopy3d`
4. `test_imagearraycopy`
5. `test_buffer_copy`
6. `test_buffer_partial_copy`

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2026-01-13 17:46:02 +00:00
Ahmed
c0f5c4e271 Fix basic progvar_prog_scope_init and progvar_prog_scope_uninit (#2497)
The test was mapping a memory object using CL_MAP_READ but then writing
to its host_ptr using memset.
2025-08-26 09:27:33 -07:00
Yilong Guo
da1008c5da Fix interger overflow for work-group size calculation (#2455) 2025-08-05 09:11:07 -07:00
Wenju He
e15c6eb760 Fix 'fpclassify: ambiguous call' compile fail in MSVC 2022 (#2426)
Similar to #2219, we see "'fpclassify': ambiguous call" error in
test_conformance\basic\test_fpmath.cpp
due to missing constexpr at
https://github.com/KhronosGroup/OpenCL-CTS/blob/9265cbb2c274/test_conformance/basic/test_fpmath.cpp#L104
This PR fixes the issue by moving utility function isnan_fp in
testHarness.h and use it.
Note this PR doesn't modify use of isnan in many tests where only
float/double values are checked.
2025-08-05 09:08:04 -07:00
Ahmed Hesham
044e0be653 Enable -Wnarrowing for the basic test suite (#2467)
Fixes #1156

---------

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-07-31 12:24:03 +01:00
Michael Rizkalla
da953699e9 Refactor imagecopy and imagereadwrite tests (#2362)
Refactor the following tests:
1. `test_imagecopy`
2. `test_imagecopy3d`
3. `test_imagereadwrite`
4. `test_imagereadwrite3d`

The change does the following:
1. Use RAII to manage allocated resources
2. For `imagecopy` and `imagecopy3d`, the change allows for a custom src
image memory flags and adjusts how the source image is created according
to the input flags.

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2025-07-01 13:01:54 -07:00
Michael Rizkalla
9265cbb2c2 Refactor buffer ReadWrite and Copy tests (#2259)
This change refactors the following tests to use RAII to clean-up
allocated resources on exit, and adds additional changes as mentioned
below:

- test_arrayreadwrite
    - Allow different `cl_mem_flags` to be passed to the test.
- test_bufferreadwriterect:
    - Allow different `cl_mem_flags` to be passed to the test.
    - Customisable copy, read and write functions.
- test_buffer_copy
- Fill the destination buffer with `invalid_ptr` instead of `out_ptr` if
created with `CL_MEM_(USE/COPY)_HOST_PTR`.
- test_buffer_partial_copy
- Fill the destination buffer with `invalid_ptr` instead of `out_ptr` if
created with `CL_MEM_(USE/COPY)_HOST_PTR`.

---------

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2025-06-24 15:27:37 -07:00
Michael Rizkalla
8701acfa90 Add tests for cl_ext_immutable_memory_objects (#2286)
This change provides partial test coverage for
KhronosGroup/OpenCL-Docs#1280

Adding CTS tests for:
1. clEnqueueMapBuffer, clEnqueueMapImage.
2. Command buffer negative tests.
3. clSetKernelArgs negative tests.

The bulk of the tests is to make sure that the CL driver does not allow
writing to a memory object that is created with `CL_MEM_IMMUTABLE_EXT`
flag when used with the above APIs.

---------

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2025-06-17 10:19:11 -07:00
Sven van Haastregt
b6924adfb2 basic: fix Wformat warnings (#2343)
Fix all `-Wformat` warnings in the basic test suite, and re-enable the
warning.

---------

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2025-03-25 09:45:18 -07:00
Ahmed Hesham
e88e5be93e Migrate basic suite to the new test registration framework (#2316)
Contributes to #2181.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-03-18 17:32:58 +00:00
Sven van Haastregt
b9301d1ae8 basic: fix -Wformat-security warnings (#2284)
Fix warnings such as:

test_vloadstore.cpp:330:49: error: format string is not a string literal
(potentially insecure)

There were no security issues here as the format string arguments do not
contain any conversion specifiers and are never written to. Make that
latter fact explicit to avoid the warnings.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2025-03-18 09:02:31 -07:00
Romaric Jodin
11db332281 fix error message in work_item_functions_out_of_range (#2303)
The value printed in the error message is not the correct one (used in
the comparison statement)
2025-03-07 23:43:00 +00:00
zzk0
bdd0eb0b7e bugfix nan test for basic fpmath (#2268)
This PR fixes the validation logic for cases where the data type is not
half. Because the variable nan_test is always false, types like float
never trigger a validation failure.
2025-02-18 20:51:19 -08:00
Sven van Haastregt
ea934a7648 basic: fix size_t Wformat warnings (#2264)
Printing of a `size_t` requires the `%zu` specifier.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2025-02-18 09:11:32 -08:00
Sven van Haastregt
9f63decb9c basic: add missing newline at end of error messages (#2275)
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2025-02-13 07:24:51 -08:00
Antonios Christidis
2031e21a58 Fix Build Warnings for AArch64 (#2242)
This commit links to issue (#2234).

When cross-compiling for AArch64, using gcc 13.3, you encounter three
warnings types that turn into errors:

- maybe-uninitialized
- stringop-truncation
- strict-aliasing

This commit fixes all the warnings found, in regards to the first two
rules. To resolve the warnigns due to strict-aliasing, I am editing the
CMake build system.

Signed-off-by: Antonios Christidis <a-christidis@ti.com>
2025-02-05 13:58:17 +01:00
Marcin Hajder
98c3fe4f16 Added test for work-item functions with out-of-range arguments (#2099)
Fixes #2005 according to task description.
2025-01-21 08:39:28 -08:00
Sven van Haastregt
2ea4d165d5 cmake: remove global -Wno-format (#2195)
Move the global `-Wno-format` compiler option to the individual tests
that still trigger Wformat warnings. The majority of the tests now
compile cleanly with `-Wformat` enabled.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-12-24 14:49:31 +01:00
Michael Rizkalla
e61da21cd6 Fix using incorrect free function in arrayimagecopy and imagearraycopy basic tests' unique_ptr (#2177)
This change addresses a free function mis-match issue where `delete` is
used to free memory allocated via `malloc` within `create_random_data`
and in the test function.

The change involves the following tests:
1. arrayimagecopy
2. arrayimagecopy3d
3. imagearraycopy
4. imagearraycopy3d

This should address #2173

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2024-12-17 09:30:48 +01:00
Michael Rizkalla
918d561c6c Refactor test copy from and to image to buffer (#2138)
This change refactors the following files:
1. test_imagearraycopy.cpp
2. test_arrayimagecopy.cpp

The purpose of refactoring is to allow passing different buffer and
image flags to the test function as well as passing customisable test
functions.

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2024-11-19 10:11:58 -08:00
ellnor01
617e7cb233 Re-enabling narrowing errors (#1144)
Fixes narrowing conversion build errors in test_common

Removing disable of narrowing errors in main CMakeLists.txt
and moving it down to specific test_conformance suite's 
CMakeLists.txt where there are many more build errors revealed
from this fix. 

Fixes a few simple issues under test_conformance in the process.

Contributes #787

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

---------

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2024-10-08 09:54:32 -07:00
John Kesapides
cd74e02643 Use CTS type wrappers for test_global_linear_id. (#1545)
Signed-off-by: John Kesapides <john.kesapides@arm.com>

---------

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2024-09-24 18:02:32 +01:00
joshqti
b8981f5fb8 [basic] Enable image format aware scanline comparison. (#2042)
Use format aware memory comparison instead of memcmp.
2024-08-13 09:54:09 -07:00
Ahmed
b4c3bf2af2 Fixes for basic explicit_s2v and commonfns degrees for cl_half (#2024)
Basic explicit_s2v:

The verification step was always using round to even when converting a
float to half even for round to zero cores.

Commonfns degrees:

The verification step was only taking into account infinities and not
values that over/underflow. This resulted in an incorrect error
calculation. E.g:

double cpu_result = 175668.85998711039;
cl_half gpu_result = 31743; // this is 65504 when converting to float,
we overflowed.
float error = (cpu_result - gpu_result) * some_factor;

The fix adds the check if( (cl_half) reference == test ) before
calculating the error.
2024-08-13 09:52:07 -07:00
John Kesapides
dd029cab8f Deduplicate test_imagedim (#1546)
Signed-off-by: John Kesapides <john.kesapides@arm.com>

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2024-07-09 09:56:42 -07:00
John Kesapides
cabdf6a5fc Use CTS type wrappers for test_basic test_if. (#1540)
Signed-off-by: John Kesapides
[john.kesapides@arm.com](mailto:john.kesapides@arm.com)
2024-07-09 09:55:57 -07:00
John Kesapides
cb9b8db894 Deduplicate test_basic image_array_copy (#1538)
Merge image_array_copy, image_array_copy3d
as they share a lot of common code.

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

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2024-07-09 09:55:16 -07:00
Sreelakshmi Haridas Maruthur
5ce18c3f5a basic: workaround MSVC compiler bug with post-increment operator (#1939)
Prevent the compiler from optimizing away initialization loops
2024-05-21 08:47:47 -07:00
BZZiv
90cefbb38e Bug fix in test_async_copy_fence - wrong events usage (#1736) 2024-03-12 09:25:22 -07:00
Harald van Dijk
6a60db558b Fix uninitialised memory use. (#1909)
CL_DEVICE_MAX_WORK_GROUP_SIZE is specified to fill in a size_t. By
asking it to fill in an uninitialised cl_long, on platforms where size_t
is smaller than cl_long, the high bits of the cl_long remain
uninitialised.
2024-03-08 08:07:09 -08:00
Haonan Yang
a73f2b38fb Fix windows stack overflow. (#1839) 2023-12-12 09:33:09 -08:00
John Kesapides
7e4b59dfaa Delete unused file test_float2int.cpp (#1831)
Remove left over file from (#1537)

https://github.com/KhronosGroup/OpenCL-CTS/pull/1537#issuecomment-1642088122

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2023-10-30 13:01:34 +00:00
Karol Herbst
c6dd6f2aa3 make atomic tests in prog var testing optional (#1799)
This is helpful for testing progvars on implementations not implementing
all the optional atomic features.
2023-10-17 09:40:44 -07:00
Marcin Hajder
72bb711646 Added cl_khr_fp16 extension support for test_explicit_s2v from basic (#1713)
* Added cl_khr_fp16 support for test_explicit_s2v from basic (issue #142, basic)

* Cosmetic corrections

* cosmetic fix

* Added correction to distinguish signed and unsigned char types for ARM architecture tests

* Added missing pieces of convertion procedure to support half

* Corrected condition to verify if additional pragma is necessary (issue #142, basic)

* Add NaN check for half to float conversion

* check-format fixes

* Add NaN check for all float types

Use std::isnan for float/double types.

Change-Id: I005bddccaa3f8490ac59b2aa431ed315733ad143

* Fix Ubuntu build error with isnan macro definition

Change-Id: I671ed826a9631fbbc66d0aa9b674ab00124c7967

* Check format fixes

* NAN define not needed anymore

---------

Co-authored-by: Vasu Penugonda <vpenugon@qti.qualcomm.com>
Co-authored-by: Sreelakshmi Haridas <sharidas@quicinc.com>
2023-10-17 09:38:36 -07:00
Sreelakshmi Haridas Maruthur
7759c2669a basic: fix more unused-but-set variables (#1811) 2023-09-21 08:30:32 -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
Sven van Haastregt
d7f24a7986 Fix more -Wsign-compare warnings (#1779)
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-09-14 11:00:30 +01:00
John Kesapides
a01349c44e Use CTS type wrappers for test_basic test_loop (#1541)
* Use CTS type wrappers for test_basic test_loop
* Move variable declaration to first use in verify_loop

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2023-07-27 14:00:03 +01:00
Sven van Haastregt
0460756f6e basic/int2fp: fix missing include (#1789)
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>
2023-07-23 09:36:23 +01:00
John Kesapides
25ce398037 Use CTS type wrappers for test_constant. (#1543)
Signed-off-by: John Kesapides <john.kesapides@arm.com>
2023-07-20 16:13:42 +01:00
John Kesapides
339c932c57 Use the CTS typewrappers in image_r8 (#1539)
Signed-off-by: John Kesapides <john.kesapides@arm.com>
2023-07-19 14:18:49 +01:00
John Kesapides
cd5c165946 Deduplicate test_barrier (#1542)
Merge test_barrier and test_wg_barrier.

Reformat using clang-format kernel source code.

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2023-07-19 13:51:30 +01:00
Marcin Hajder
3a1388a2b4 Added cl_khr_fp16 extension support for test_vloadstore from basic (#1734)
* Added cl_khr_fp16 support for test_vloadstore from basic (issue #142, basic)

* Moved string helper procedures due to request from test_commonfns PR #1695

* restored original test sizes

* Corrected invalid initialization of reference buffer
2023-07-11 08:51:05 -07:00
Sven van Haastregt
9e8430a6a6 [NFC] clang-format basic/test_enqueue_map.cpp (#1777)
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-07-03 10:07:32 +01:00
Marcin Hajder
df3ec8deec Added cl_khr_fp16 extension support for test_int2fp from basic (#1742)
* Added cl_khr_fp16 and cl_khr_fp64 support for float2int and int2float tests from basic

* removed debug output

* Replaced procedure to generate random half values in specific range (issue #142, basic)

* Added cosmetic fixes due to code review comments

* Moved string helper procedures due to request for test_commonfns PR #1695
2023-06-20 08:44:45 -07:00
Marcin Hajder
0e229b8f01 Added cl_khr_fp16 extension support for test_fpmath from basic (#1718)
* Added half and double support for fpmath test from basic (issue #142, basic)

* Cosmetic corrections due to code review

* Removed unnecessary casting

* Added corrections due to code review

* Tuning range of input generation to avoid hitting infinity

* Moved string helpers procedures due to request from test_commonfns PR #1695
2023-06-20 08:42:57 -07:00
Sven van Haastregt
44b2578ac7 basic: fix unused-but-set variables (#1764)
Remove the unused `numItems` variable.

As this fixes all occurrences of this warning in test_basic, remove
the suppression flag.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-06-16 10:53:08 +01:00
Marcin Hajder
16a75dc0af Added cl_khr_fp16 extension support for test_vector_creation from basic (#1728)
* Added cl_khr_fp16 extension support for vector_creation test from basic

* Added corrections related to vendor's review

* Added protection to avoid similar creation cases

* Added comment for recent correction

* cosmetics

* Corrected factor array to restore lost capacity of original test..

leaving only 16-sizes vector tests limited.
2023-06-13 08:41:39 -07:00
Marcin Hajder
095091bc57 Added cl_khr_fp16 extension support for test_vec_type_hint from basic (#1724)
* Added cl_khr_fp16 extension support for test_vec_type_hint from basic (issue #142, basic)

* Added correction to fix casting problem
2023-06-12 23:39:22 -07:00
Romaric Jodin
1011f8ea81 fix async strided test outputing error during verify (#1754)
This bug was introduced by
https://github.com/KhronosGroup/OpenCL-CTS/pull/1711

Ref google/clspv#1127
2023-06-07 15:53:12 +01:00