Commit Graph

1506 Commits

Author SHA1 Message Date
Ahmed Hesham
671ea7b286 Migrate computeinfo suite to the new test registration framework (#2320)
Contributes to #2181.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-03-11 21:52:28 +00:00
Kévin Petit
13b82d1833 Migrate non_uniform_work_group suite to the new test registration framework (#2317)
Contributes to #2181

Signed-off-by: Kévin Petit <kpet@free.fr>
2025-03-11 21:48:14 +00:00
Kévin Petit
132ba21a3c Migrate mem_host_flags suite to the new test registration framework (#2314)
Contributes to #2181

Signed-off-by: Kévin Petit <kpet@free.fr>
2025-03-11 21:47:58 +00:00
Kévin Petit
c4179d0f6a Migrate thread_dimensions suite to the new test registration framework (#2309)
Contributes to #2181

Signed-off-by: Kévin Petit <kpet@free.fr>
2025-03-11 21:46:38 +00:00
Kévin Petit
3a275fe81b Always enable beta extensions (#2330)
`CL_ENABLE_BETA_EXTENSIONS` was just introduced in
https://github.com/KhronosGroup/OpenCL-Headers/pull/276
to guard provisional and other experimental extensions. The CTS
currently assumes
all definitions are always present.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2025-03-11 11:40:29 -07:00
Kévin Petit
30f9a5eb21 Remove .gitattributes (#2310)
We don't use git lfs. We have no .7z files in the repo.

Signed-off-by: Kévin Petit <kpet@free.fr>
2025-03-10 22:16:21 -07:00
Ahmed Hesham
2d0fda0179 Migrate c11_atomics suite the new test registration framework (#2318)
Contributes to #2181.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-03-10 09:55:24 +00:00
Ahmed Hesham
fbeebac9d5 Migrate buffers suite to the new test registration framework (#2315)
Contributes to #2181.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-03-09 09:59:01 +00:00
Ahmed Hesham
3f7774b089 Migrate subgroups suite to the new test registration framework (#2313)
Contributes to #2181.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-03-09 09:53:47 +00:00
Ahmed Hesham
aed6c3a214 Migrate relationals suite to the new test registration framework (#2312)
Contributes to #2181.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-03-09 09:49:24 +00:00
Ahmed Hesham
6eb1aa1d0a Migrate printf suite to the new test registration framework (#2311)
Contributes to #2181.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-03-09 09:44:59 +00:00
Ahmed Hesham
5b47d4b19f Migrate pipes suite to the new test registration framework (#2302)
Contributes to #2181

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-03-09 09:42:10 +00:00
Ahmed Hesham
521d067083 Migrate device_partition suite to the new test registration framework (#2301)
Contributes to #2181
2025-03-08 22:37:04 +00: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
Ben Ashbaugh
637deb0011 add missing Float16 capability (#2304)
A recent improvement to the SPIR-V validator added checks to ensure the
**Float16** capability is declared when directly operating on fp16
values, which identified issues in one of our SPIR-V test files. This PR
fixes the SPIR-V files to add the missing capability.
2025-03-07 10:08:58 -08:00
Ben Ashbaugh
6a36bd9d5c add SPIR-V 1.6 testing for UniformDecoration decorations (#2254)
Adds a basic test for the SPIR-V 1.6 UniformDecoration decorations.
Specifically:

* Tests both the Uniform and UniformId decorations.
* Tests the decorations on constants, function parameters, and
variables.
2025-03-05 08:29:26 -08:00
Michael Rizkalla
9a5041a25b Fix inconsistent variable name in REGISTER_TEST and REQUIRE_EXTENSION (#2296)
Both `REGISTER_TEST` and `REQUIRE_EXTENSION` expect cl_device_id
variable but the variable name is inconsistent which makes both macros
unusable together.

This change renames `deviceID` in `REQUIRE_EXTENSION` to `device` to be
consistent with `REGISTER_TEST`.

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2025-03-04 16:53:50 -08:00
Sven van Haastregt
733cc78c39 spirv_new: ensure int64 printf test uses 64 bits (#2295)
The `extinst_printf_operands_scalar_int64` test could fail on 32-bit
platforms with `CL_INVALID_ARG_SIZE`, because the helper function was
not guaranteed to be instantiated using a 64-bit integer template type.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2025-03-04 16:53:25 -08:00
Sven van Haastregt
7feb93cdd7 math_brute_force: treat reciprocal as unary function (#2281)
Treat reciprocal as a unary function, instead of handling it through the
binary function testing mechanism and special-casing it there.

This addresses two shortcomings of the previous implementation:

- Testing took significantly longer as the entire input domain was
tested many times (e.g. fp16 reciprocal has only 2^16 possible input
values, but binary function testing iterates over 2^16 * 2^16 input
values).

- The reciprocal test kernel was identical to the divide kernel. Thus
the device compiler would see a regular divide operation instead of a
reciprocal operation and would be unlikely to emit a specialized
reciprocal sequence.

This reverts all of the changes in binary_operator*.cpp made by
bcfa1f7c2 ("Added corrections to re-enable reciprocal test in
math_brute_force suite for relaxed math mode (#2221)", 2025-02-04).

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2025-03-04 16:52:28 -08:00
Michael Rizkalla
5167d7202b Fix signalling and waiting on semaphore from two queues (#2271)
`semaphores_ooo_ops_cross_queue` uses two OOO command queues to run the
test. In one queue, a semaphore is signalled and the semahpore is waited
on in the other queue.

The CL specification requires the application to synchronize the queues
if objects are shared.

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2025-03-04 16:51:18 -08:00
Ahmed Hesham
5a65278613 Fix compilation failure caused by DMA heaps (#2292)
Project fails to build on systems with a kernel version older than 5.6.0
because of `-Wunused-function` combined with `-Werror`.

Expand the conditional compilation guard to include the offending code.
2025-02-27 07:30:08 -08:00
Marcin Hajder
a7c4d7f4c7 Added test to verify program queries after rebuilding (#2253)
Fixes #2163 according to issue description
2025-02-26 09:55:38 -08:00
Ahmed Hesham
9ba6f062d4 Add support for allocating DMA buffers (#2170)
This adds support for allocating DMA buffers on systems that support it,
i.e. Linux and Android.

On mainline Linux, starting version 5.6 (equivalent to Android 12),
there is a new kernel module framework available called [DMA-BUF
Heaps](https://github.com/torvalds/linux/blob/master/drivers/dma-buf/dma-heap.c).
The goal of this framework is to provide a standardised way for user
applications to allocate and share memory buffers between different
devices, subsystems, etc. The main feature of interest is that the
framework provides device-agnostic allocation; it abstracts away the
underlying hardware, and provides a single IOCTL,
`DMA_HEAP_IOCTL_ALLOC`. Mainline implementation provides two heaps that
act as character devices that can allocate DMA buffers; system, which
uses the buddy allocator, and cma, which uses the
[CMA](https://developer.toradex.com/software/linux-resources/linux-features/contiguous-memory-allocator-cma-linux/)
(Contiguous Memory Allocator). Both of these are [kernel configuration
options](https://github.com/torvalds/linux/blob/master/drivers/dma-buf/heaps/Kconfig)
that need to be enabled when building the Linux kernel. Generally, any
kernel module implementing this framework is made available under
/dev/dma_heaps/<heap_name>, e.g. /dev/dma_heaps/system.

The implementation currently only supports one type of DMA heaps;
`system`, the default device path for which is `/dev/dma_heap/system`.
The path can be overridden at runtime using an environment variable,
`OCL_CTS_DMA_HEAP_PATH_SYSTEM`, if needed. Extending this in the future
should be trivial (subject to platform support), by adding an entry to
the enum `dma_buf_heap_type`, and an appropriate default path and
overriding environment variable name.

The proposed implementation will conditionally compile if the conditions
are met (i.e. building for Linux or Android, using kernel headers >=
5.6.0), and will provide a compile-time warning otherwise, and return
`-1` as the DMA handle in runtime if not.

To demonstrate the functionality, a new test is added for the
`cl_khr_external_memory_dma_buf` extension. If the extension is
supported by the device, a DMA buffer will be allocated and used to
create a CL buffer, that is then used by a simple kernel.

This should provide a way forward for adding more tests that depend on
DMA buffers.

---------

Signed-off-by: Gorazd Sumkovski <gorazd.sumkovski@arm.com>
Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
Co-authored-by: Gorazd Sumkovski <gorazd.sumkovski@arm.com>
2025-02-26 09:51:22 -08:00
Sreelakshmi Haridas Maruthur
6419744d76 printf: Fix the format specifier for %A to add the decimal point (#2290) 2025-02-25 12:54:53 -08:00
Ahmed
803e665683 Correct reference for fma for RTZ devices for half (#2269)
The reference was always being calculated using round to nearest even
for fma when testing half precision.

Fixes https://github.com/KhronosGroup/OpenCL-CTS/issues/2224
2025-02-25 12:54:26 -08:00
Marcin Hajder
c84b712366 Added object comparability verification for program devices query (#2237)
Fixes #1485 according to work plan from issue description.
2025-02-25 08:48:05 -08:00
Marcin Hajder
a90a8194bc Added object comparability verification for program devices query (#2237)
Fixes #1485 according to work plan from issue description.
2025-02-25 08:43:12 -08: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
Sreelakshmi Haridas Maruthur
32361e1d89 bruteforce: Check both input values for nan (#2270) 2025-02-18 20:51:36 -08: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
Michael Rizkalla
6d3d199b42 Deduplicate create_image from Copy/Fill image tests (#2262)
1. Remove duplicate `create_image` code that is in both clFillImage and
clCopyImage test directories.
2. Unify how pitch buffer's memory is deallocated; The buffer can be
allocated with either `malloc` or `align_malloc` and the free function
is pre-set in `pitch_buffe_data`'s member variable `free_fn` and used
when the buffer is deallocated. With this, the change removes
`is_aligned` conditional variable that was used to select the
appropriate free function.

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2025-02-18 20:50:43 -08:00
Romaric Jodin
84fd99da76 fix profiling execute_multipass (#2239)
- fix clGetDeviceInfo(CL_DEVICE_MAX_WORK_ITEM_SIZES) by using the proper
size

- clamp localThreads[2] as for localThreads[0] and localThreads[2]

- clamp all localThreads elements in regard of CL_MAX_WORK_GROUP_SIZE

- fix the size using to create/read the output buffer

Fix #2238
v2025-02-19-00
2025-02-18 20:49:12 -08:00
Sreelakshmi Haridas Maruthur
8c298b1c3b printf: Fix printf 'mixed_format_random' (#2236)
%a or %A with printf on MSVC platforms have a default precision of 13,
which is in contrast to OpenCL C specification for printf which only
allows for exact digits required if precision is not specified.
2025-02-18 20:48:26 -08:00
Ahmed Hesham
485964d87c Add CMake installation rules (#2184)
Add installation rules for all the binary targets.

Targets are installed under `<CMAKE_INSTALL_PREFIX>/bin/<CONFIG>` where
`<CONFIG>` is `CMAKE_BUILD_TYPE` for single-config generators, e.g. Unix
Makefiles and Ninja, or the build configuration for multi-config
generators, e.g. Ninja Multi-Config and Visual Studio.

This creates the target `install` on Unix and `INSTALL` on Windows.
2025-02-18 20:47:56 -08:00
Kévin Petit
9216c81855 Migrate test_vulkan to the new registration framework (#2278)
Signed-off-by: Kévin Petit <kpet@free.fr>
2025-02-19 00:24:03 +05:30
Kévin Petit
24597e0145 Report external sharing tests as skipped instead of failed when not supported (#2277)
Throwing an exception in the constructor for VulkanTestBase was always
reported as an error.

Signed-off-by: Kévin Petit <kpet@free.fr>
2025-02-19 00:22:44 +05:30
Sven van Haastregt
46dcf18a18 spirv_new: print build log in get_program_with_il (#2274)
Print the build log when building the program in `get_program_with_il`
fails, to make it easier to investigate spirv_new test failures.

Factor out a global helper function `OutputBuildLog` for printing the
build log for a single device.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2025-02-18 09:13:01 -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
Ben Ashbaugh
9c5999bc1d add SPIR-V 1.6 testing for Nontemporal Image Operand (#2249)
Adds a basic test for reading from and writing to an image with the
optional Nontemporal image operand.
2025-02-18 09:10:09 -08:00
Ben Ashbaugh
9b247c06be fix several compile issues with Visual Studio toolchains (#2219)
Fixes several compile issues I am seeing for my version of Visual Studio
related to an ambiguous call to `fpclassify`, which is called by `isnan`
and other similar functions, specifically for the `cl_half` type:

```
19>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(401,1): error C2668: 'fpclassify': ambiguous call to overloaded function
19>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(298,31): message : could be 'int fpclassify(long double) throw()'
19>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(293,31): message : or       'int fpclassify(double) throw()'
19>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(288,31): message : or       'int fpclassify(float) throw()'
19>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(401,1): message : while trying to match the argument list '(_Ty)'
```

Some of these issues seem like differences in compiler behavior, but at
least one appears to have identified a legitimate bug.

Specifically, this change:

* Removes the special-case checks for finite half numbers for commonfns,
since this is already handled by `UlpFn`. (test with: `test_commonfns
degrees radians`)
* Assigns to temporary variables to eliminate the ambiguous function
call for relationals. (test with: `test_relationals relational*`)
* Properly converts from half to float when checking for NaNs for
select. This is the one that seems like a legitimate bug. (test with:
`test_select select_half_ushort select_half_short`)
* Uses `std::enable_if` to disambiguate a function call for spirv_new.
(test with: `test_spirv_new decorate_saturated*`)

If it's helpful, my specific Visual Studio version is:

```
Microsoft Visual Studio Professional 2019
Version 16.11.20
VisualStudio.16.Release/16.11.20+32929.386
```

I also have the Windows Software Development Kit 10.0.19041.685
installed.
2025-02-18 09:09:17 -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
xinjin01
3618402c3a Remove unsupported raw10/raw12 tests (#2232)
Images with a `CL_UNSIGNED_INT_RAW10_EXT` and
`CL_UNSIGNED_INT_RAW12_EXT` data type are unnormalised, so the
normalised tests with theses images are invalid and will be skipped.

Signed-off-by: Gorazd Sumkovski <gorazd.sumkovski@arm.com>
Signed-off-by: Xin Jin <xin.jin@arm.com>
Co-authored-by: Gorazd Sumkovski <gorazd.sumkovski@arm.com>
2025-02-11 10:35:56 -08:00
Marcin Hajder
be130c9b1c Removed vulkan sub-tests overlapping with semaphore negative tests (#2250)
Fixes #2153 according to issue description.
2025-02-11 10:34:29 -08:00
Ben Ashbaugh
a61feea656 adds SPIR-V tests for scalar printf operands (#2211)
Adds targeted SPIR-V tests for printf with scalar operands.  See:

* https://github.com/KhronosGroup/OpenCL-Docs/issues/1211
* https://github.com/KhronosGroup/OpenCL-Docs/pull/1236

The fp32 test is likely to be the most interesting, especially on
devices that support fp64, because printf with scalar fp32 operands is
not generated by default in this case with Clang and the SPIR-V LLVM
Translator.
2025-02-11 08:55:39 -08:00
Ahmed
0bfe516318 Add the half ulps values for embedded profile (#2265)
This change adds the half ulps values for embedded profile.


https://github.com/KhronosGroup/OpenCL-CTS/issues/1685
2025-02-11 08:54:47 -08:00
Ben Ashbaugh
d7cb6b006b fix negative_create_command_buffer_not_supported_properties test (#2248)
fixes #2247 

* For the `negative_create_command_buffer_not_supported_properties`
test, the only property we can check for is simultaneous use. All other
properties are part of other extensions and hence will generate
`CL_INVALID_VALUE`, not `CL_INVALID_PROPERTY`.
* Checks whether the `cl_khr_command_buffer_multi_device` extension is
supported when using `CL_COMMAND_BUFFER_DEVICE_SIDE_SYNC_KHR`, instead
of `device_side_enqueue_support`.
* If the `cl_khr_command_buffer_multi_device` extension is NOT supported
and the `CL_COMMAND_BUFFER_DEVICE_SIDE_SYNC_KHR` command buffer creation
flag is used, the expected error code is `CL_INVALID_VALUE`, not
`CL_INVALID_PROPERTY`.
2025-02-11 08:52:53 -08:00
Sreelakshmi Haridas Maruthur
7188c4b29b allocations: Make buffer kernel more efficient for multiple allocations (#2235)
- Fix malloc for 'access_string' and 'kernel_string'.
- Fix typo in 'number_of_work_itmes'.

Co-authored-by: Sreelakshmi Haridas Maruthur <sharidas@quicinc.com>
2025-02-11 08:49:34 -08:00
Ewan Crawford
044ec98f66 Command-buffer queue compatibility test update (#2230)
Update cl_khr_command_buffer tests to reflect changes from
https://github.com/KhronosGroup/OpenCL-Docs/pull/1292

* Moves negative test for
`CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR` from
command-buffer creation to enqueue.
* Moves negative test for
`CL_DEVICE_COMMAND_BUFFER_REQUIRED_QUEUE_PROPERTIES_KHR` from
command-buffer creation to enqueue.
* Introduces a negative test for `CL_INVALID_DEVICE` on command-buffer
enqueue for new error condition in spec. Although it requires a context
to be contain more than 1 device, which I'm not sure if possible in
current test framework.
* Introduces a new test that created a command-buffer using a queue
without the profiling property set, then enqueues the command-buffer to
a queue with the profiling property set.
* Introduces a new test that creates a command-buffer with an in-order
queue, enqueued on an out-of-order queue.
* Introduces a new test that creates a command-buffer with an
out-of-order queue, enqueued on an in-order queue.
2025-02-11 08:47:15 -08:00
Chuang-Yu Cheng
54afc2e7a5 printf: Fix floating-point rounding consistency for RTZ devices (#2202)
1. In vector test, prepare RTZ answer for RTZ rounding.

2. In mixed_format_random test, for a given float 'arg', the test
previously used 'arg' directly to generate ref_str:
   ```
     ref_str << str_sprintf(format, arg);
   ```

   This approach incorrectly assumes:
   ```
     (float) arg == to_fp(to_str(arg));
   ```

   However, this assumption fails under RTZ rounding. For example: 
   ```
     arg = 0xC642549C 
     to_str(arg) = -12437.152343f 
     to_fp_rtz(-12437.152343f) = 0xC642549B (-0X1.84A936P+13) 
     to_fp_rte(-12437.152343f) = 0xC642549C (-0X1.84A938P+13)
   ```

To address this, the reference result is now computed based on the
literal float string rather than the original 'arg' value.
2025-02-11 08:46:23 -08:00
Ahmed Hesham
ecd012737f Generate the SPIR-V shaders automatically at build time (#2200)
Add custom commands and targets to automatically assemble and validate
the SPIR-V shaders used by the test.

Automatic assembly depends on finding `python3`, `spirv-as` and
`spirv-val`. `SPIRV_TOOLS_DIR` can be defined by the user during
configuration to provide an override path. Default behaviour assumes
that the binaries exist in `PATH`.

---------

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-02-11 08:43:37 -08:00