Commit Graph

1463 Commits

Author SHA1 Message Date
Romaric Jodin
6b20272159 fix compiler/options_build_optimizations (#2595)
We need to define -cl-std when compiling with option not in 1.0.
2025-12-16 17:23:37 +00:00
Yilong Guo
119af24d54 c11_atomics: unify host half representation and conversion with wrapper class (#2503)
Introduce `HostHalf` wrapper class to eliminate explicit
`cl_half_from_float`
and `cl_half_to_float` conversions throughout the test code. The wrapper
provides semantic value constructors/operators and automatic
conversions,
simplifying half-precision arithmetic operations.

Key improvements:
- `HostHalf` class with operator overloading for arithmetic and
comparisons
- Type traits `is_host_atomic_fp_v` and `is_host_fp_v` for generic FP
handling
- Unified floating-point atomic operations (add/sub/min/max/exchange)
- Removed 300+ lines of half-specific conditional branches
- Consistent calculation for all FP types
2025-12-16 08:37:33 -08:00
Marcin Hajder
67fbbe4ee2 Unified cl_khr_external_semaphore tests using the same export and import scheme (#2591)
Due to discussion from #2542 and following work from closed PR #2568

This change refactors the external semaphore tests by unifying
`external_semaphores_import_export_fd` with
`external_semaphores_cross_context` tests, removing duplicated logic and
avoiding OS-specific conditions. The updated test now covers all
import/export handle types consistently across single- and multi-context
scenarios.
2025-12-09 23:40:56 +05:30
Xin Jin
afb6f6519c Tighten AHB buffer row pitch in test_cl_khr_external_memory_ahb test (#2594)
What was wrong:
enqueue_copy_buffer_to_image (and the related write/fill tests) mis-set
imageInfo.rowPitch to width*height*pixelSize. Because get_image_size
multiplies row pitch by height, this wrongly calculates the intended
buffer size.

How it’s fixed: set rowPitch to the true per-line pitch
(width*pixelSize) for all buffer-backed image cases so the calculated
sizes match the actual data layout and stay within the expected memory
footprint.

Signed-off-by: Xin Jin <xin.jin@arm.com>
2025-12-09 23:36:57 +05:30
Marcin Hajder
68c3eec051 Remove overwrite of CMAKE_CXX_FLAGS from cl_khr_external_semaphore test (#2596)
Fixes #2430
2025-12-09 08:40:39 -08: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
gtrebuchet-arm
bd167754d9 Add multi device and negative tests for cl_ext_buffer_device_address (#2561)
The tests checks that invalid parameters for
clSetKernelArgDevicePointerEXT are reported successfully and ensure that
a kernel can access a buffer from their respective device address on
each device in a multi device context.

Signed-off-by: Guillaume Trebuchet <guillaume.trebuchet@arm.com>
2025-12-02 09:40:16 -08:00
Ahmed Hesham
b0876629f8 Add AHB lifetime test (#2569)
Add lifetime test for AHardwareBuffer in which for both CL Buffers and
CL Images the following steps are taken
 - Create AHB
 - Create mem object from the AHB
 - Release the AHB
 - Read and write from and to the mem object
 - Verify the reads and write have happened sucessfully

The CL implementation should maintain a reference count to the AHB since
the AHB must not be deallocated for the test to pass.

Signed-off-by: Alex Davicenko <alex.davicenko@arm.com>
Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
Co-authored-by: Alex Davicenko <alex.davicenko@arm.com>
2025-12-02 09:36:36 -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
Marcin Hajder
0c064ac017 Added a test case for printing an empty string (#2590)
Fixes #2364 according to issue description
2025-12-02 08:41:36 -08:00
Marcin Hajder
0cca0ee869 Added support for cl_ext_float_atomics in CBasicTestFetchSub with atomic_double (#2368)
Related to #2142, according to the work plan, extending
CBasicTestFetchSub with support for atomic_double.
2025-12-02 08:39:16 -08:00
Romaric Jodin
5846e9bc59 include algorithm for std::min(list) (#2587)
std::min(list) is defined in algorithm. Some setup might work without
it, but other require it to find the proper definition.

Otherwise it can lead to compilation error:
```
OpenCL-CTS/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_full_dispatch.cpp:141:22: error: no matching function for call to 'min'
  141 |         group_size = std::min(
      |                      ^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate function template not viable: requires 2 arguments, but 1 was provided
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate function template not viable: requires 3 arguments, but 1 was provided
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```
2025-11-27 07:42:35 +00:00
alan-baker
d1b75bd200 c11_atomics: Filter invalid memory orders for 2 order instructions (#2506)
* OpenCL C (and SPIR-V) require that the failure memory order is not
stronger than the success memory order.

Also see Khronos internal memory model issue #181

CC @bashbaug
2025-11-26 16:25:46 -08:00
vangthao95
2174715160 Fix incompatiable pointer type warning for device_execution test (#2558)
There are multiple incompatiable pointer types warnings when compiling
the device_execution test with clang. There was an upstream llvm patch
that will turn these warnings into an error
https://github.com/llvm/llvm-project/pull/157364.

To not encounter this issue in the future, fix these warnings by
changing the parameter types.

```
warning: incompatible pointer types passing '__global ulong (*)[512]' (aka '__global unsigned long (*)[512]') to parameter of type 'const __generic ulong *' (aka 'const __generic unsigned long *') [-Wincompatible-pointer-types]
   37 |         void (^checkBlock) (void) = ^{ check_res(tid, &value, res); };
      |                                                       ^~~~~~
note: passing argument to parameter 'value' here
--
warning: incompatible pointer types passing '__global int *const __private' to parameter of type '__global atomic_uint *' (aka '__global _Atomic(unsigned int) *') [-Wincompatible-pointer-types]
   10 |   void (^kernelBlock)(void) = ^{ block_fn(len, val); };
      |                                                ^~~
note: passing argument to parameter 'val' here
--
warning: incompatible pointer types passing '__global int *const __private' to parameter of type '__global atomic_uint *' (aka '__global _Atomic(unsigned int) *') [-Wincompatible-pointer-types]
   10 |   void (^kernelBlock)(void) = ^{ block_fn(len, val); };
      |                                                ^~~
note: passing argument to parameter 'val' here
--
warning: incompatible pointer types passing '__global int *const __private' to parameter of type '__global atomic_uint *' (aka '__global _Atomic(unsigned int) *') [-Wincompatible-pointer-types]
   10 |   void (^kernelBlock)(void) = ^{ block_fn(len, val); };
      |                                                ^~~
note: passing argument to parameter 'val' here
--
warning: incompatible pointer types passing '__global int *const __private' to parameter of type '__global atomic_uint *' (aka '__global _Atomic(unsigned int) *') [-Wincompatible-pointer-types]
   10 |   void (^kernelBlock)(void) = ^{ block_fn(len, val); };
      |                                                ^~~
note: passing argument to parameter 'val' here
--
warning: incompatible pointer types passing '__global int *const __private' to parameter of type '__global atomic_uint *' (aka '__global _Atomic(unsigned int) *') [-Wincompatible-pointer-types]
   10 |   void (^kernelBlock)(void) = ^{ block_fn(len, val); };
      |                                                ^~~
note: passing argument to parameter 'val' here
--
warning: incompatible pointer types passing '__global int *const __private' to parameter of type '__global atomic_uint *' (aka '__global _Atomic(unsigned int) *') [-Wincompatible-pointer-types]
   10 |   void (^kernelBlock)(void) = ^{ block_fn(len, val); };
      |                                                ^~~
note: passing argument to parameter 'val' here
```
2025-11-26 16:25:02 -08:00
Jose Lopez
5b2c1acd78 Add clFinish to compiler multiple_build_program test before building again (#2574)
[clBuildProgram](https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#clBuildProgram)
has the next error condition:

>
[CL_INVALID_OPERATION](https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#CL_INVALID_OPERATION)
if there are kernel objects attached to program.

The test needs to wait for the NDRangeKernel to finish in order to build
the program again. If not, kernel0 might still have references and
therefore still be attached to program.
2025-11-26 16:24:03 -08:00
Nadezhda Samartseva
65fd490bc9 Registration for the profiling_timebase test has been changed: version 2.1 is now required. (#2584)
This fix is necessary to install the minimum version of OpenCL in the
profiling_timebase test. This test uses clGetDeviceAndHostTimer,
available only since version 2.1.
fix #2582
2025-11-26 16:23:34 -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
Ewan Crawford
34e9baecda Test mutable command-buffer deferred kernel arguments (#2538)
Tests the scenario outlined in
https://github.com/KhronosGroup/OpenCL-CTS/issues/2520#issuecomment-3280930492
to verify the functionality added in OpenCL-Docs PR
https://github.com/KhronosGroup/OpenCL-Docs/pull/1382.

Closes #2520

---------

Co-authored-by: Ben Ashbaugh <ben.ashbaugh@intel.com>
2025-11-26 16:19:59 -08:00
Romaric Jodin
df46a38e31 Better support for -cl-uniform-work-group-size (#2564)
Add support for build options available only after a certain version:
- -cl-uniform-work-group-size after 2.0
- -cl-no-subgroup-ifp after 2.1

Add specific test for cl-uniform-work-group-size
- Check that test can be executed when work group size is uniform.
- Check that test returns the proper error code when work group size is
not uniform.

Ref #2563
2025-11-26 16:19:33 -08:00
Ole Strohm
b7808f2b2d Limit work group size by the max item size in mutable_command_full_dispatch (#2578)
The maximum value for the workgroup size in a specific dimension can be
lower than the overall maximum workgroup size. This patch queries for
the maximum work item size in the first dimension and limits the
group_size by that value as well.

Signed-off-by: Ole Strohm <ole.strohm@arm.com>
2025-11-26 16:19:03 -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
02e99f4554 fixes a warning and a typo in the mutable dispatch test (#2579)
Fixes a warning in the mutable dispatch test with some compilers:

```
3>C:\git\OpenCL-CTS\test_conformance\extensions\cl_khr_command_buffer\cl_khr_command_buffer_mutable_dispatch\mutable_command_basic.h(82,16): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation
```

Also fixes a misspelled variable name while we're at it.
2025-11-18 15:06:57 -08:00
Marcin Hajder
ec546b80c5 Added an in-order queue variant for the semaphores_import_export_fd test (#2542)
Fixes #2213 according to mentioned discussion
2025-11-18 08:53:42 -08:00
Marcin Hajder
6b59cae6e9 Added test to verify process of building a kernel with long name (#2559)
Closes #2422 according to issue description
2025-11-18 08:52:03 -08:00
Marcin Hajder
3d038fb7ea Added a test for semaphore payloads that are ignored (#2554)
Fixes #2384 according to issue description
2025-11-18 08:51:41 -08:00
paulfradgley
7e26e3b555 Replace error code for invalid size negative test 2025-11-18 15:26:52 +00: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
Marcin Hajder
941f7edb95 Added coverage of using multiple kernels created from the same source program with different builds (#2537)
Fixes #2164 according to issue description
2025-11-04 08:41:26 -08:00
Ahmed Hesham
ba991c0152 Add negative test for AHB (#2539)
Add a wrapper around AHB for proper resource deallocation and refactor
existing tests to use the wrapper.
Add a negative test for AHB to test for error codes when calling
clCreateImageWithProperties and clCreateBufferWithProperties.

---------

Signed-off-by: Alex Davicenko <alex.davicenko@arm.com>
Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
Co-authored-by: Alex Davicenko <alex.davicenko@arm.com>
2025-10-28 23:00:30 +05:30
Ahmed
c6e0f416e7 Specify memory scope and memory order for the atomic operations in generic_address_space generic_atomics_variant generic_atomics_invariant (#2550)
Use the explicit version of the atomic_load/store and atomic_fetch_add
with memory order relaxed and memory scope workgroup to allow devices
that only support the minimum CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES which
are (CL_DEVICE_ATOMIC_ORDER_RELAXED | CL_DEVICE_ATOMIC_SCOPE_WORK_GROUP)
to run the tests.

The test should only require the relaxed ordering and memory scope
workgroup anyway.

From the specificiation:

"The non-explicit atomic_store function requires support for OpenCL C
2.0, or OpenCL C 3.0 or newer and both the
__opencl_c_atomic_order_seq_cst and __opencl_c_atomic_scope_device
features"

"The non-explicit atomic_load function requires support for OpenCL C 2.0
or OpenCL C 3.0 or newer and both the __opencl_c_atomic_order_seq_cst
and __opencl_c_atomic_scope_device features."

"The non-explicit atomic_fetch_key functions require support for OpenCL
C 2.0, or OpenCL C 3.0 or newer and both the
__opencl_c_atomic_order_seq_cst and __opencl_c_atomic_scope_device
features."
2025-10-28 09:04:51 -07:00
Sergiu Bogdan Popescu
d63cc8ce5d Modified kernel code to correspond to the Image declared format (CL_UNSIGNED_INT8) (#2512)
**For mutable_dispatch_image_1d_arguments &
mutable_dispatch_image_2d_arguments:**
As the images are created using CL_UNSIGNED_INT8, the kernel does not
use correct instructions, as they are designed for signed variable. This
fix consists of modifying the kernel code to use unsigned instructions
and auxiliary variables .
2025-10-28 09:01:42 -07:00
Jose Lopez
580fde7501 Replace unique_ptr for vectors in atomics_indexed_cases (#2557)
Use vectors instead of unique_ptr for buffers data
2025-10-28 08:55:41 -07:00
Jose Lopez
16cd0afe4f Add case for clSetKernelExecInfo with empty set (#2551)
Adds a special case to ensure that calling `clSetKernelExecInfo` with
`CL_KERNEL_EXEC_INFO_SVM_PTRS` and an empty set of pointers is valid
2025-10-28 08:54:41 -07:00
Daniel Crawley
39f961b71f Match spv and api version for Vulkan test (#2536)
- Vulkan api version is 1_1, so target env for shaders should be
vulkan1.1
2025-10-28 08:53:54 -07:00
Ahmed
1a4862e84e Use a more genuine kernel for the command buffer device enqueue negative test (#2532)
The current one has no arguments and does not enqueue any work.
2025-10-28 08:50:08 -07:00
Marcin Hajder
d0aa95be2f Added support for cl_ext_float_atomics in CBasicTestFetchSub with atomic_float (#2367)
Related to #2142, according to the work plan, extending
CBasicTestFetchSub with support for atomic_float.
2025-10-28 08:41:24 -07:00
Marcin Hajder
52ba127f79 Added support for cl_ext_float_atomics in CBasicTestFetchMin/Max with atomic_double (#2361)
Related to #2142, according to the work plan, extending
CBasicTestFetchMin/CBasicTestFetchMax with support for atomic_double.
2025-10-28 08:40:13 -07:00
Marcin Hajder
62972418c3 Added support for cl_ext_float_atomics in CBasicTestFetchAdd with atomic_half (#2350)
Related to https://github.com/KhronosGroup/OpenCL-CTS/issues/2142,
according to the work plan, extending CBasicTestFetchAdd with support
for atomic_half.

I wasn't able to test that PR completely due to missing
`CL_DEVICE_LOCAL_FP_ATOMIC_ADD_EXT`/`CL_DEVICE_GLOBAL_FP_ATOMIC_ADD_EXT`
capabilities for atomic_half. I appreciate reviewers' attention, thanks.
2025-10-22 07:01:48 -07:00
Xin Jin
79d98433cc Fix release call in AHB image read test (#2548)
Ensure clEnqueueReleaseExternalMemObjectsKHR targets imported_image
instead of the non-external opencl_image, matching the prior acquire
call.

Signed-off-by: Xin Jin <xin.jin@arm.com>
2025-10-21 18:40:35 +01:00
Ahmed
a1d8c3e419 Remove spir half vloada_half tests as this builtin does not exist in OpenCL (#2552)
The test was using vloada_half which does not exist for scalars.

Also removed the files test.vloada_half_*.* from half.zip.

For test.vloada_half3_global, changed the OpenCL kernel to use
vload_half instead of vloada_half.

Build failures will return a proper failure now, before, the test was
passing in this case.

More Info: https://github.com/KhronosGroup/OpenCL-Docs/issues/648
2025-10-21 09:59:13 -07:00
Marcin Hajder
940c8bb973 Added support for cl_ext_float_atomics in CBasicTestFetchMin/Max with atomic_half (#2357)
Related to #2142, according to the work plan, extending
CBasicTestFetchMin/CBasicTestFetchMax with support for atomic_half.
2025-10-21 08:43:05 -07:00
Kévin Petit
34745bd936 Disable {svm_,}atomic_fence tests (#2545)
As agreed in 2025/10/14 teleconference. See #2544.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2025-10-14 09:58:40 -07:00
Ewan Crawford
bfa96c77d8 CTS updates for reworked simultaneous use (#2477)
Actions test plan from
https://github.com/KhronosGroup/OpenCL-CTS/issues/2473 to update CTS
tests to reflect changes from cl_khr_command_buffer PR
https://github.com/KhronosGroup/OpenCL-Docs/pull/1411

* Adds new test in`command_buffer_pipelined_enqueue.cpp` for multiple
enqueues without blocking in-between, but serialized execution.
* Removed test for `CL_COMMAND_BUFFER_STATE_PENDING_KHR` state query.
* Remove negative test for `clEnqueueCommandBuffer` pending state error.
* Simplify `cl_khr_command_buffer` tests that stress simultaneous-use by
testing multiple serialized enqueues of the same command-buffer, which
doesn't now require the device imultaneous-use capability
* Remove simultaneous-use command-buffer creation in base class to off,
and require tests do it themselves if they require it.
* Rewrite mutable dispatch simultaneous test to test updating both
pipelined enqueues, and updating the new definition of simultaneous-use

---------

Co-authored-by: Ewan Crawford <ewan@codeplay.com>
2025-10-14 09:15:20 -07:00
Ahmed
eded89cdd6 add cl_khr_command_buffer_mutable_memory_commands to the list of known extensions (#2531) 2025-10-14 08:50:55 -07:00
Karol Herbst
a0e32ea64f Fix listing tests in gl testing (#2530) 2025-10-14 08:50:10 -07: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
Yilong Guo
3871149208 commonfns: Fix max_error initialization and improve test output (#2500)
Before this change, `max_error` was initialized to `0.0f`, which caused
issues
when the actual maximum `error` was also `0.0f`. In such cases,
`max_val` would
never be updated, leading to misleading test output showing `NaN`
values:

```
  degrees: Max error 0.000000 ulps at 0: *nan vs 0x1.9802318e8abefp+21
```

This fix initializes `max_error` to `-INFINITY` to ensure `max_val` is
always
updated at least once. Additionally, the log output now includes the
input
value for better debugging:

```
  degrees: Max error 0.000000 ulps at 0, input 0x1.c7bffcp+15: *0x1.9802318e8abefp+21 vs 0x1.9802318e8abefp+21
```

This makes the test output more informative and eliminates confusing
`NaN` values in the summary.
2025-10-14 08:47:59 -07:00
Grzegorz Wawiorko
d733c2b802 c11_atomics: Fix verification loop (#2543)
Looks like bug. @shajder Could you look at this fix? Thanks
2025-10-14 08:39:54 -07:00
Marcin Hajder
51445f3743 Added support for cl_ext_float_atomics in CBaseTestFetchAdd with atomic_double (#2347)
Related to https://github.com/KhronosGroup/OpenCL-CTS/issues/2142,
according to the work plan, extending CBasicTestFetchAdd with support
for atomic_double.
2025-10-07 08:42:02 -07:00