Commit Graph

152 Commits

Author SHA1 Message Date
Michael Rizkalla
6774fc1dc3 Add negative tests for context API functions (#2494)
This PR adds negative tests for the following API functions:

- clCreateContext
- clCreateContextFromType
- clRetainContext
- clReleaseContext
- clSetContextDestructorCallback

Also, define a new macro `test_object_failure_ret` to test for an
expected error code and the returned object is `NULL` as a result of a
failure.

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2026-01-13 17:43:13 +00:00
Marcin Hajder
5179e06ed9 Added test to verify reqd_work_group_size attribute with cl_khr_command_buffer extension (#2583)
Fixes #2501 according to issue description

---------

Co-authored-by: Ben Ashbaugh <ben.ashbaugh@intel.com>
2025-12-09 08:37:12 -08:00
Michael Rizkalla
011caecb57 Implement negative tests for cl_device_id API functions (#2495)
Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
Co-authored-by: Chetankumar Mistry <chetan.mistry@arm.com>
2025-12-02 09:34:45 -08:00
Michael Rizkalla
c0e6447961 Implement negative tests for clEnqueueMarkerWithWaitList (#2502)
This change adds negative tests for `clEnqueueMarkerWithWaitList`

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2025-11-26 16:20:46 -08:00
Ben Ashbaugh
0da389cedb temporarily disable the negative_invalid_arg_size_local test (#2573)
Temporarily disable the negative_invalid_arg_size_local test, pending
working group discussion.
2025-11-26 16:11:20 -08:00
Ben Ashbaugh
afc7e64c57 fix the null required work group size test (#2576)
A 3D required work-group size is always valid, but a 1D or 2D required
work-group size is only valid when the work-group size in those
dimensions is equal to one.

fixes #2575
2025-11-26 16:10:47 -08:00
Ben Ashbaugh
e641de99a5 add test for a NULL local work size and a required work-group size (#2514)
see #2501 

This tests the following scenarios:

1. Execute a kernel with a required work-group size, passing `NULL` as
the local work size.
2. Query the suggested work-group size for a kernel with a required
work-group size.
2025-11-04 08:50:30 -08:00
Michael Rizkalla
a31589412f Implement negative tests for cl_command_queue functions (#2505)
This change adds negative tests to `cl_command_queue`-related APIs:
- clCreateCommandQueue
- clCreateCommandQueueWithProperties
- clSetDefaultDeviceCommandQueue
- clRetainCommandQueue
- clReleaseCommandQueue
- clGetCommandQueueInfo
- clSetCommandQueueProperty

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
Co-authored-by: Chetankumar Mistry <chetan.mistry@arm.com>
Co-authored-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-10-14 08:48:20 -07:00
Marcin Hajder
4e8aa9d3e2 Added test to verify negative result of clSetKernelArg with CL_INVALID_SAMPLER and sampler argument (#2453)
Related to #2282, according to work plan from
[here](https://github.com/KhronosGroup/OpenCL-CTS/issues/2282#issuecomment-3069182773)
2025-09-17 09:25:12 -07:00
Marcin Hajder
aa950deaf1 Added test to verify negative result of clSetKernelArg with CL_INVALID_ARG_SIZE and sampler argument (#2452)
Related to #2282, according to work plan from
[here](https://github.com/KhronosGroup/OpenCL-CTS/issues/2282#issuecomment-3069182773)
2025-09-17 08:14:30 -07:00
Marcin Hajder
c2baafae3f Added test to verify negative result of clSetKernelArg with CL_INVALID_ARG_SIZE (#2448)
Related to #2282, according to work plan related to CL_INVALID_ARG_SIZE
result
2025-09-16 08:45:22 -07:00
Marcin Hajder
a0bd81d574 Added test to verify negative result of clSetKernelArg with CL_INVALID_ARG_SIZE and memory object argument (#2450)
Related to #2282, according to work plan from
[here](https://github.com/KhronosGroup/OpenCL-CTS/issues/2282#issuecomment-3069182773)
2025-09-09 08:44:35 -07:00
Harald van Dijk
913e6e4388 Fix test_api negative_set_read_write_image_arg. (#2510)
When the implementation does not have image support, the functions used
are not required to be defined and the test should be skipped.
2025-09-02 09:48:51 -07:00
Karol Herbst
1562bcf03c Fix OOB read in negative_set_immutable_memory_to_writeable_kernel_arg (#2481)
The image was created with 4 channels, but the initialization data only
accounted for a single channel.
2025-09-02 09:44:46 -07:00
Marcin Hajder
8a2b91c715 Added test to verify negative result of clSetKernelArg with CL_INVALID_KERNEL (#2460)
Related to #2282, according to work plan from
[here](https://github.com/KhronosGroup/OpenCL-CTS/issues/2282#issuecomment-3069182773)
2025-09-02 08:40:11 -07:00
Ben Ashbaugh
555b7cd383 tests for cl_khr_spirv_queries (#2409)
See: https://github.com/KhronosGroup/OpenCL-Docs/pull/1385
2025-08-13 08:11:10 +01:00
Romaric Jodin
86634c07f9 fix test_api min_max_image_buffer_size (#2342)
print a `log_info` and use the minimum value (`1`) for `pixelBytes`
instead of printing an error and returning with an error value.
It allows device exposing a big CL_DEVICE_IMAGE_MAX_BUFFER_SIZE (more
than CL_DEVICE_MAX_MEM_ALLOC_SIZE/2) to pass test_api
min_max_image_buffer_size

Fix #2245
2025-08-12 08:46:59 -07:00
Marcin Hajder
4115d04ae0 Added test to verify negative result of clSetKernelArg with CL_INVALID_ARG_INDEX (#2458)
Related to #2282, according to work plan from
[here](https://github.com/KhronosGroup/OpenCL-CTS/issues/2282#issuecomment-3069182773)
2025-08-12 08:40:13 -07:00
Marcin Hajder
2e0f803699 Added test to verify negative result of clSetKernelArg with CL_INVALID_ARG_SIZE and local qalified argument (#2449)
Related to #2282, according to work plan from
[here](https://github.com/KhronosGroup/OpenCL-CTS/issues/2282#issuecomment-3069182773)
2025-08-08 14:06:15 -07:00
Karol Herbst
e2580bded2 Use CL_KERNEL_WORK_GROUP_SIZE more often (#2435)
Drivers _may_ choose to advertise values for
`CL_DEVICE_MAX_WORK_GROUP_SIZE` or `CL_DEVICE_MAX_WORK_ITEM_SIZES` that
kernels without a `reqd_work_group_size` are not able to be launched
with.

The CTS should therefore make sure that the local_size passed to
`clEnqueueNDRangeKernel` does not exceed `CL_KERNEL_WORK_GROUP_SIZE`

This fixes it up in two places I've noticed this not happening.
2025-08-05 14:40:11 -07:00
Marcin Hajder
c7abbe57a4 Added test to verify negative result of clSetKernelArg with CL_INVALID_ARG_VALUE (#2445)
Related to #2282, according to work plan with mismatched read/write only
qualifier for image_t objects
2025-08-05 09:09:16 -07:00
Michael Rizkalla
880bce6047 Fix memory leaks in api test suite (#2363)
This commit fixes three tests that have memory leaks due to unreleased
CL objects.
- `kernel_local_memory_size`
- `multi_queue_flush_on_release`
- `queue_flush_on_release`

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2025-06-24 15:27:15 -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
Kévin Petit
110799bb67 Add missing coverage to api::zero_sized_enqueue (#2378)
- Cases with a NULL global_work_size were not tested
- The specification states that zero-sized enqueues behave similarly to
marker commands. Test that events for NDRange kernel commands have the
correct CL_COMMAND_NDRANGE_KERNEL command type to guard against
implementations naively using a marker command.
- Tidy up the code a bit and add missing error checking.

Signed-off-by: Kévin Petit <kpet@free.fr>
2025-05-13 03:51:43 +01:00
Romaric Jodin
3f7889bdbd Remove CL_DEVICE_HALF_FP_CONFIG when cl_khr_fp16 is not supported (#2354)
Specification does not require to return an error when querying
CL_DEVICE_HALF_FP_CONFIG and cl_khr_fp16 is not supported.

Fix #2339
2025-05-06 09:33:34 -07:00
Marcin Hajder
8aa47754de Added object comparability verification for CL_DEVICE_PLATFORM query (#2225)
Fixes #1485 according to work plan, point CL_DEVICE_PLATFORM
2025-05-06 08:40:18 -07:00
Kévin Petit
9fc0d23b4c Define SubDevicesScopeGuarded in the harness and remove duplicate copies (#2379)
Signed-off-by: Kévin Petit <kpet@free.fr>
2025-04-21 11:16:17 +01:00
Starla Huang
395648cfef Use max work item size instead (#2294)
The test is using CL_DEVICE_MAX_WORK_GROUP_SIZE as first dimension of
local work size. But it can be bigger than the first dimension of
CL_DEVICE_MAX_WORK_ITEM_SIZEs which results in failure.

This patch corrects it to query and use the first dimension of
CL_DEVICE_MAX_WORK_ITEM_SIZES instead.

Signed-off-by: Xing Huang <xing.huang@arm.com>
2025-03-18 09:03:13 -07:00
Marcin Hajder
0ddfbbe673 Added object comparability verification for context devices query (#2176)
Fixes #1485 according to work plan, point `CL_CONTEXT_DEVICES`
2025-02-25 08:42:09 -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
c6cfb6800f Added test to verify flush on clReleaseCommandQueue with multiple queues (#2134)
Fixes #2087 according to task description.
2025-01-28 08:53:40 -08:00
Ahmed Hesham
794d332bab Migrate API suite to the new test registration framework (#2196)
Contributes to #2181

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2024-12-18 17:29:08 +00:00
John Kesapides
177be0969b Extend clSetDefaultDeviceCommandQueue test coverage (#1551)
Fixes #23

Signed-off-by: Vikas Katariya <vikas.katariya@arm.com>

---------

Signed-off-by: Vikas Katariya <vikas.katariya@arm.com>
Signed-off-by: John Kesapides <john.kesapides@arm.com>
Co-authored-by: Vikas Katariya <vikas.katariya@arm.com>
2024-12-17 09:53:35 -08:00
Ben Ashbaugh
d8228f0d72 remove using namespace std and use std namespace explicitly (#2125)
Removes `using namespace std` and adds `std::` explicitly instead, which
is usually on calls to `min`.

This is generally best practice, and it also might be helpful when there
are the same function names in the std namespace and in the global
namespace (e.g. #1833).
2024-10-29 09:44:49 -07:00
Harald van Dijk
7d3e1f0b82 Fix check for CL_DEVICE_HALF_FP_CONFIG. (#2108)
When cl_khr_fp16 is not supported, this property is not available.

Note that the spec is different for
CL_DEVICE_{PREFERRED,NATIVE}_VECTOR_WIDTH_HALF: those properties are
always available and return 0 if cl_khr_fp16 is not supported, so those
checks are left as is.
2024-10-29 09:41:16 -07:00
Kamil-Goras-Mobica
b1dfe8a640 Add testing for CL_KERNEL_LOCAL_MEM_SIZE #1235 (#2089)
#1235
2024-10-29 08:55:46 -07: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
Jaroslaw Warchulski
9cf439488a Fix printing in test_api_min_max (#2102)
before: Filling constant buffer with 553805440 cl_ints (-2079745536
bytes).
after: Filling constant buffer with 553805440 cl_ints (2215221760
bytes).
2024-10-03 11:58:28 +02:00
Kamil-Goras-Mobica
bcd54787e7 Added fp16 and fp64 api consistency tests (#2058)
#1578
2024-10-01 08:51:37 -07:00
Sven van Haastregt
90f523ea57 api: fix -Wformat warnings (#2025)
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>
2024-09-02 12:02:28 +02:00
Kamil-Goras-Mobica
746544af80 Strengthen testing of CL_DEVICE_TYPE query and use of CL_DEVICE_TYPE* (#1977)
Issue: #1930
2024-08-20 08:54:06 -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
995e46590e Add clSetCommandQueueProperty test (#1182)
Add test to check that clSetCommandQueueProperty
successfully changes command queue properties.

Fixes #904

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

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2024-08-06 09:31:01 -07:00
Sven van Haastregt
2d8028668f [NFC] api: remove duplicate and unused macros (#1949)
The removed macros were never used.

Use the more common `ARRAY_SIZE` macro instead of defining an identical
`NELEMS` macro.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-07-02 09:37:49 -07:00
Julia Jiang
02471c8f56 Fix build errors related with variable defined array length and gl te… (#1957)
…sts logged error
2024-07-02 09:34:53 -07:00
Ewan Crawford
8e6c519354 Negative test for CL_INVALID_QUEUE_PROPERTIES (#1935)
Test that verifies `CL_INVALID_QUEUE_PROPERTIES` is returned from
`clCreateCommandQueue`, `clCreateCommandQueueWithProperties`, and
`clCreateCommandQueueWithPropertiesKHR` to match spec wording

> CL_INVALID_QUEUE_PROPERTIES if values specified in properties are
valid but are not supported by the device.
2024-06-25 09:40:32 -07:00
David Tobolik
61a220ff33 fix: move suggested_local_size to test_api (#1916) 2024-04-16 08:49:24 -07:00
niranjanjoshi121
6530ae45b5 Add NULL CL_MEM_HOST_PTR check for all flag combinations (#1850)
* Add NULL CL_MEM_HOST_PTR check for clGetMemObjectInfo

The spec requires implementations return NULL for CL_MEM_HOST_PTR
when the flags passed at memory object creation time do not contain
CL_MEM_USE_HOST_PTR

CTS was not checking this. Add the same check.

Fixes #1752

* Add NULL CL_MEM_HOST_PTR check for all flag combinations

As part of suggestions to #1801, add NULL CL_MEM_HOST_PTR
check for all flag combinations.

Fixes #1752

* Fix formatting issues
2024-03-12 09:31:46 -07:00
imilenkovic00
ac7a14ece1 api tests fix: Use MTdataHolder in test_get_image_info (#1871) 2024-01-30 09:22:17 -08:00
Pekka Jääskeläinen
8bb89b165c subgroups: fix for testing too large WG sizes (#1620)
It seemed to be a typo; the comment says that it
tries to fetch local size for a subgroup count with
above max WG size, but it just used the previous
subgroup count.

The test on purpose sets a SG count to be a larger
number than the max work-items in the work group.
Given the minimum SG size is 1 WI, it means that there
can be a maximum of maximum work-group size of SGs (of
1 WI of size). Thus, if we request a number of SGs that
exceeds the local size, the query should fail as expected.
2024-01-30 09:13:22 -08:00