Commit Graph

1601 Commits

Author SHA1 Message Date
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
Ahmed Hesham
3fd572dec4 Fix compilation errors cl_khr_external_memory_ahb (#2475)
Update the test to use
`CL_EXTERNAL_MEMORY_HANDLE_ANDROID_HARDWARE_BUFFER_KHR` instead of
`CL_EXTERNAL_MEMORY_HANDLE_AHB_KHR` to match the headers.

Handle missing format in switch statement.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-08-07 20:49:06 +01:00
Ahmed Hesham
b8f9581e89 Update the GitHub workflow for Android (#2476)
Use the latest stable LTS version of the NDK (r28c) and add
`ANDROID_PLATFORM` to the CMake configuration options, set to 29, so
that Android Hardware Buffer tests can be compiled.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-08-07 20:48:34 +01:00
Ahmed Hesham
ac63117231 Fix compiler warnings in test_vulkan (#2474)
Use the correct print format specifiers for `uint64_t` and fix loop
index type to address sign warning.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-08-07 15:12:27 +01: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
dcrawleyqti
086a6c67fb cl_khr_external_memory_ahb test (#2413)
Android AHardwareBuffer test. Initial testing for buffers and image.

---------

Co-authored-by: joselope <joselope@qti.qualcomm.com>
2025-08-05 17:32:02 +01:00
Ahmed
4c54ecbd1f Fix printf vector for RTZ devices (#2459)
The failure is :

7)testing printf("%.1v4hla",(0.25f,0.5f,1.f,1.5f))
verifyOutputBuffer failed with kernel:
__kernel void test14(void)
{
float4 tmp = (float4)(0.25f,0.5f,1.f,1.5f); printf("%.1v4hla\n",tmp);}
 expected: 0x1p-2,0x1p-1,0x1p+0,0x1.8p+0
 got: 0x1.0p-2,0x1.0p-1,0x1.0p+0,0x1.8p+0

%.1 requires 1 decimal.
2025-08-05 09:19:37 -07:00
Ewan Crawford
9809cc931a Test for mutable-dispatch original work-dim (#2438)
New test following on from OpenCL-Docs Issues discussion
https://github.com/KhronosGroup/OpenCL-Docs/issues/1390#issuecomment-3023818903

Noting that we have no test coverage for using the original value of
`work_dim` during command-buffer update. All of our current CTS testing
uses `0` for the `work_dim` to signify no update from the original
value, however this test explicitly uses the original value.
2025-08-05 09:15:04 -07:00
Yilong Guo
466049474c Fix buffer size for mutable dispatch command buffer test (#2437) 2025-08-05 09:14:35 -07:00
Yilong Guo
e7e753f1a9 Fix data race in mutable command buffer simultaneous execution test (#2434)
Prior to this change, both `clEnqueueReadBuffer` calls before and after
updating the command buffer were writing to the same `output_buffer`,
causing a data race condition and the first call's result to be
overwritten. This commit introduces separate destination vectors
(`output_buffer` and `updated_output_buffer`) for these operations and
verifies both results independently to ensure test integrity.
2025-08-05 09:13:05 -07:00
Yilong Guo
dacb944cf3 Retain output memory objects for simultaneous command buffer tests (#2429)
Memory objects created in `EnqueueSimultaneousPass()` are used by
kernels
that don't execute until the user event is signaled. Without retaining
these objects, they would be destroyed before the deferred kernel
execution occurs.
2025-08-05 09:12:25 -07:00
Yilong Guo
da1008c5da Fix interger overflow for work-group size calculation (#2455) 2025-08-05 09:11:07 -07:00
Karol Herbst
678ad78233 Remove semaphores_simple_2 and external_semaphores_simple_2 tests (#2447)
While the cl_khr_semaphore extension spec does state that are no
implicit dependencies between already enqueued commands and the
clEnqueueSignalSemaphoresKHR, it's nothing special as this is already
true for any other event that's not a barrier or marker.

Also, the CTS can't reliably assume implementations to reorder events
even in an out of order queue as this is highly implementation defined
behavior and implementations may or may not choose to reorder events in
a specific order.

I don't see a reason why this should be tested for semaphores, but not
for any other commands, especially as it imposes a restriction on how to
implement out of order queues that wasn't enforced before.

Closes: https://github.com/KhronosGroup/OpenCL-CTS/issues/2439
2025-08-05 09:10:00 -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
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
9ca0126c54 Fix warnings treated as errors in Vulkan tests. (#2461)
Unused variables and mismatched sign comparisons.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-08-04 11:06:18 +01:00
Ben Ashbaugh
2507f7de84 add cl_khr_spirv_queries to list of known extensions (#2463)
While #2409 is under review, could we please add "cl_khr_spirv_queries"
to the list of known extensions? This will prevent test "failures" for
implementations that support the extension.
2025-08-01 21:37:16 +01:00
Ahmed Hesham
430727cc8d Enable -Wnarrowing in Vulkan test suite (#2469) 2025-07-31 12:24:51 +01:00
Ahmed Hesham
dae998ff9d Enable -Wnarrowing in spirv_new test suite (#2468) 2025-07-31 12:24:30 +01: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
Ahmed Hesham
77a987d547 Enable -Wnarrowing in integer_ops test suite (#2465)
Fixes #1158

---------

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-07-30 18:51:54 +01:00
Ahmed Hesham
7c530dafa6 Enable -Wnarrowing for conversions test suite (#2466)
No code changes required.

Fixes #1157

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-07-30 18:51:05 +01:00
Ahmed Hesham
16dfa2217c Enable -Wnarrowing in non_uniform_work_group test suite. (#2464)
Modify the prime numbers generator function to return `size_t` instead
of `int` and use `0` as a sentinal value instead of hardcoded negative
ones. `0` is not a prime number, so it is suitable to use to indicate an
error.

Fixes #1159

---------

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-07-30 18:49:38 +01:00
Ahmed Hesham
82508f709a Fix test_spir not checking for the required extension (#2454)
`clGetDeviceInfo` should fail with `CL_INVALID_VALUE` when queried for
`CL_DEVICE_SPIR_VERSIONS` on devices that do not claim to support the
extension that provides it, `cl_khr_spir`.

Following this change, the test is skipped instead of failing on devices
that do not support `cl_khr_spir`.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-07-24 10:43:03 -07:00
Romaric Jodin
d918b41657 clean unused variables (#2446)
Do not remove calls to `sample_image_pixel_float_offset` as it is using
the `verbose` mode.
2025-07-15 16:36:49 -07:00
Kévin Petit
2fdefbdf34 test_vulkan: fix build flags and warnings (#2443)
- Do not override parent-provided value for CMAKE_CXX_FLAGS
- Stop building with -fpermissive (not required/bad practice)
- Delete unused variables
- Remove unnecessary casts

Signed-off-by: Kévin Petit <kpet@free.fr>
2025-07-15 16:33:37 -07:00
Ben Ashbaugh
8d4a870059 fix correctly rounded behavior for math bruteforce tests (#2397)
fixes #2387 

Corrects the "correctly rounded" behavior for the math bruteforce tests.
Specifically:

* Only applies the `-cl-fp32-correctly-rounded-divide-sqrt` build option
for the `divide_cr` and `sqrt_cr` tests. The other tests do not receive
this build option. This means that there is a difference in the behavior
of the `divide` and `divide_cr` tests and the `sqrt` and `sqrt_cr`
tests, and the "correctly rounded" build option is not applied to the
fp16 or fp64 tests.
* Removes the build option to toggle testing the correctly rounded
divide and square root tests since it no longer needed. Instead, the
test names can be used to choose whether to test the correctly rounded
functions or the non-correctly rounded functions.

Additionally:

* Relaxes the fp16 sqrt accuracy requirements to 1 ULP. This is needed
to pass this test on some of our devices. This part is still under
discussion, so I will keep this PR as a draft until it is settled.
2025-07-15 09:01:19 -07:00
Ben Ashbaugh
933874f070 allow specifying CL_DEVICE_TYPE_ALL as the harness device type (#2421)
Currently, selecting a different device in a platform to test is rather
cumbersome, for two reasons:

1. The default device type tested is the "default" device and there is
at most one default device in a platform. This means that, by itself,
choosing any non-zero device index is by definition out-of-range:

```sh
$ CL_PLATFORM_INDEX=1 CL_DEVICE_INDEX=1 ./test_conformance/basic/test_basic 
 Initializing random seed to 0.
Requesting Default device based on command line for platform index 1 and device index 1
device index out of range -- choosen_device_index (1) >= num_devices (1)
```

2. To choose a non-default device type you therefore need to explicitly
specify another device type also, but "all" is not a valid device type
in the harness. This means that you need to know both the device type
and the index of the device within that device type to choose the device
to test.

```sh
$ CL_DEVICE_TYPE=all CL_PLATFORM_INDEX=1 CL_DEVICE_INDEX=1 ./test_conformance/basic/test_basic 
Unknown CL_DEVICE_TYPE env variable setting: all.
Aborting...
Aborted (core dumped)
```

This PR aims to fix (2), by allowing "all" as a device type. In the
future, we could consider making the default device type "all" vs.
"default", which would fix (1) also, but that will likely need more
discussion and should be done in a separate PR.
2025-07-15 09:00:20 -07:00
Ahmed
08738a6954 Add cl_khr_unified_svm to the list of known extensions in the compiler defines for extension test. (#2433)
Adds cl_khr_unified_svm to the list of known extensions in the compiler
defines for extension test.
v2025-07-11-00
2025-07-08 09:59:47 -07:00
Harald van Dijk
09f43ca916 Avoid some undefined behavior in test_bruteforce. (#2400)
* Ulp_Error*: ilogb(reference) - 1 may overflow if reference is zero.
* binary_i_double Test: DoubleFromUInt32's result is a cl_double and the
attempt is to store it as a cl_double, but p was defined as a pointer to
cl_ulong, resulting in an unintended implicit conversion that is not
valid for out-of-range doubles.
* exp2, tanpi: ensure early exit for NaN.
* shift_right_sticky_128: avoid out-of-range shift if shift value is
exactly 64.
* scalbn: e += n may overflow if n is large, move it after the check for
large n.
2025-07-08 09:59:08 -07:00
Ewan Crawford
5997a00b2f Test releasing a command-buffer after submission but before execution has finished (#2414)
Add cl_khr_command_buffer test that is it valid to release a
command-buffer after it has been enqueued but before execution is
finished.

This stresses the semantics from
[clReleaseCommandBufferKHR](https://registry.khronos.org/OpenCL/sdk/3.0/docs/man/html/clReleaseCommandBufferKHR.html#_description)
that: "After the command_buffer reference count becomes zero **and has
finished execution**, the command-buffer is deleted"
2025-07-07 16:35:20 -07:00
Oskar Hubert Weber
3065a62f77 Fix memory leaks in test_profiling execute_multipass (#2390)
- Fixed leaks caused by missing clRelease calls
- Improved error handling readability

Signed-off-by: Oskar Hubert Weber
[oskar.hubert.weber@intel.com](mailto:oskar.hubert.weber@intel.com)

---------

Signed-off-by: Oskar Hubert Weber <oskar.hubert.weber@intel.com>
2025-07-07 16:34:44 -07:00
Neoming
c4b16940e4 test_subgroups: Update local workgroup size to generate desired input and verify result (#2382)
The `local_workgroup_size` is changed by
`get_max_common_work_group_size`. But the input data still use the
original `local_workgroup_size`, which will cause the check logic to
failed.
2025-07-07 16:34:05 -07: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
cc
9fead88d81 Fix program leaks in test_spir compile_and_link (#2423)
Fixed program leaks caused by missing clRelease calls
2025-07-01 13:01:01 -07:00
Harald van Dijk
73f22aa23f Allow building with cmake --compile-no-warning-as-error. (#2401)
In CMake 3.24+, there is built-in support for adding -Werror that does
not require adding -Werror explicitly, and allows it to be downgraded to
a warning if the user wants that. Use this, to account for warnings that
have false positives.
2025-07-01 13:00:34 -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
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
Ben Ashbaugh
3345ea5af3 fixes test_opencl_c_versions logic error (#2377)
Found while developing #2376.

Parts of "test_opencl_c_versions" were intending to build programs for
different OpenCL C versions, but unfortunately the helper function the
test was calling only created the program and did not build it. Switch
to a helper function that builds the program, instead.
2025-06-24 15:26:34 -07:00
Marcin Hajder
550b14cd25 Added support for cl_ext_float_atomics in c11_atomics exchange test along with atomic_half type (#2337)
Related to #2142, according to the work plan, extending
CBasicTestExchange with support for atomic_half.
2025-06-24 08:37:50 -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
joshqti
e622512301 test_vulkan: switch defaults on device local memory (#2365)
Switch the test_vulkan default to use device local memory
2025-06-17 10:17:26 -07:00
Ben Ashbaugh
26f8b3a7e8 add missing image support checks to a few SPIR-V tests (#2411)
The tests for new image operands should not run on devices that do not
support images.
2025-06-11 09:46:31 -07:00
Marcin Hajder
b79a8a2f42 Added support for cl_ext_float_atomics in c11_atomics load test along with atomic_half type (#2297)
Related to #2142, according to the work plan, extending CBasicTestLoad
with support for atomic_half.
2025-06-10 08:43:02 -07:00
Marcin Hajder
3233d2089f Added comparability verification for GL associated devices query (#2231)
Fixes #1485 according to work plan from issue description.
2025-06-10 08:41:20 -07:00
Ahmed
f209922722 Add cl_khr_external_memory_android_hardware_buffer to the list of known compiler test extensions (#2407)
Fixes compiler_defines_for_extensions failure when the extension is
supported.
2025-06-03 14:38:39 -07:00
Sven van Haastregt
2d165eee74 conversions: remove timing functionality (#2394)
Remove the test timing functionality from the conversions test, because
it

 - is not advertised in the help,

- is not supported on all platforms, triggering warnings during the
build,

 - goes beyond the core purpose of the conformance test suite.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2025-05-30 23:50:17 +01:00
Marcin Hajder
f30a191978 Corrected procedure to collect proper size of image from VkImageCreateInfo (#2289)
Fixes #2155 according to issue description

Additional remark: The image size was previously calculated based on the
memory size, which seems unusual. Due to Vulkan's configuration
capabilities, the size of memory allocated for a specific texture may
differ from what would be expected based on the texture dimensions.
Thus, calculating the image dimensions back from the memory size of a
Vulkan texture can be challenging.
2025-05-27 10:17:14 -07:00
Ahmed Hesham
3ab4d8aab2 Test image formats of cl_ext_image_unsigned_10x6_12x4_14x2 (#2375)
This change add the following image formats to the supported image
formats:
1. CL_UNSIGNED_INT10X6_EXT
2. CL_UNSIGNED_INT12X4_EXT
3. CL_UNSIGNED_INT14X2_EXT
4. CL_UNORM_INT10X6_EXT
5. CL_UNORM_INT12X4_EXT
6. CL_UNORM_INT14X2_EXT

For reference, the specification for
`cl_ext_image_unsigned_10x6_12x4_14x2` can be found here:
https://github.com/KhronosGroup/OpenCL-Docs/pull/1352

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
Co-authored-by: Michael Rizkalla <michael.rizkalla@arm.com>
2025-05-27 08:57:34 -07:00