Commit Graph

1268 Commits

Author SHA1 Message Date
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
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
Sven van Haastregt
a8b32b2720 math_brute_force: remove LogBuildError (#2233)
`LogBuildError` was only ever called after `clSetKernelArg`, but setting
a kernel argument has no impact on the program build log. Printing of
the actual build log in case of a build failure is already handled via
`create_single_kernel_helper`.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2025-02-06 10:43:00 -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
bcfa1f7c26 Added corrections to re-enable reciprocal test in math_brute_force suite for relaxed math mode (#2221)
fixes #2145

As suggested by @svenvh reciprocal has different precision requirements
than divide. This PR introduces special path for reciprocal for
binar_float_operator to test reciprocal with relaxed math. If this PR
will get approvals, invalidate PR #2162
2025-02-04 08:45:20 -08:00
Julia Jiang
cc9e61652f Fix profiling execute_multipass failure with segmentation fault (#2256)
The buffer size input to the test function clEnqueueReadBuffer was
incorrect, which cause segmentation fault. And it didn't match the size
for the host allocation outptr
2025-02-03 13:46:52 +01:00
Chuang-Yu Cheng
5749818906 math_brute_force: fix fdim to use device's rounding when converting result back to half. (#2223)
In the half-precision `fdim` test, the original code used `CL_HALF_RTE`
to convert the float result back to half, causing a mismatch in
computation results when the hardware uses RTZ. Some of the examples:
```
  fdim(0x365f, 0xdc63) = fdim( 0.398193f,  -280.75f)     =   281.148193f (RTE=0x5c65, RTZ=0x5c64)
  fdim(0xa4a3, 0xf0e9) = fdim(-0.018112f, 10056.0f)      = 10055.981445f (RTE=0x70e9, RTZ=0x70e8)
  fdim(0x1904, 0x9ab7) = fdim( 0.002449f,    -0.003279f) =     0.005728f (RTE=0x1dde, RTZ=0x1ddd)
```

Fixed this by using the hardware's default rounding mode when converting
the result back to half.
2025-01-28 12:33:00 -08:00
Ahmed Hesham
73dd3b9af8 Fix errors in test_vulkan (#2183)
This fixes three problems in `test_vulkan`:

1. One negative test is violating the OpenCL specification. A call to
`clEnqueue{Wait,Signal}SemaphoresKHR` with an invalid semaphore should
return `CL_INVALID_SEMAPHORE_KHR` and not `CL_INVALID_VALUE`.
>
[CL_INVALID_SEMAPHORE_KHR](https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#CL_INVALID_SEMAPHORE_KHR)
if any of the semaphore objects specified by sema_objects is not valid.

2. When populating the list of supported external memory handle types
for Vulkan, the types are unconditionally added to the list, without
checking if the device supports it or not, this fix is namely for
`VULKAN_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD`.

3. If a device does not support an optional extension (that is required
for a test), the test should skip, not throw an exception and fail. A
test failure should be reserved for the cases where a device claims
support for an extension but then fails to execute the test correctly.

---------

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-01-28 10:08:24 -08: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
Sreelakshmi Haridas Maruthur
5b3518096c bruteforce: Update ULP for half-precision divide to 1.0f (#2214)
CTS test update to match proposed spec update
https://github.com/KhronosGroup/OpenCL-Docs/issues/1278
2025-01-21 09:44:47 -08: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
Ewan Crawford
2ff5cdaf7d Command-buffer query for supported queue properties (#2101)
CTS test update to match OpenCL-Doc & OpenCL-Header PRs:
* https://github.com/KhronosGroup/OpenCL-Headers/pull/265
* https://github.com/KhronosGroup/OpenCL-Docs/pull/850

Tested with https://github.com/bashbaug/SimpleOpenCLSamples/pull/126
locally using a checkout of the linked OpenCL-Headers branch
2025-01-14 12:37:38 -08:00
joshqti
a7db9a49f9 vulkan: Choose where Shaders are generated (#2226)
- generate spv files into VULKAN_TEST_RESOURCES directory
- works with change that generates spv at build time

Co-authored-by: dcrawley <dcrawley@qti.qualcomm.com>
2025-01-14 10:12:02 -08:00
Kévin Petit
f6611ec912 Migrate commonfns suite to new test registration framework (#2197)
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2025-01-14 09:11:31 -08:00
Sven van Haastregt
a2d6cadec1 relationals: fix -Wformat warnings (#2218)
Avoid a
```
  ‘%zu’ directive writing between 1 and 20 bytes into a region of size 16
```
warning by using `std::string` for `generate_shuffle_mask`.

As this fixes the last remaining Wformat warning in the relationals
suite, drop the local `-Wno-format` compiler option.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2025-01-14 09:08:32 -08:00
Ewan Crawford
bc5b0215ee Fix derived command-buffer Skip() checks (#2217)
It was noticed during another PR review
https://github.com/KhronosGroup/OpenCL-CTS/pull/2207/files#r1903921283
that there
was a case where the return value of a `Skip()` check was ignored, this
is fixed in this PR.

I've also tracking down occurrences of derived class overriding the
`Skip()` test fixture method, but not calling the parents class `Skip()`
check inside of the method. I believe omitting this parent skip check
wasn't intentional, it's clearer to explicitly respect the parent
classes skip conditions, even if we've got away with not needing too due
to the way the derived class skip conditions have been defined.
2025-01-14 09:07:41 -08:00
Ewan Crawford
98d52d0d56 Check command-buffer extension version for equality (#2215)
As described in Issue
https://github.com/KhronosGroup/OpenCL-CTS/issues/2152 we currently
check the provisional extension version supported by a vendor is the
same or older than a test specified version. However, it was discussed
in the WG that this should be a check for equality to avoid hitting
issues when a implementation tests against an older version of the CTS
using a lower extension version, with API breaking changes having
occurred since.

The tests for the command-buffer family of extensions are the only
provisional KHR tests using this versioning check, so this PR updates
all those cases to equality.
2025-01-14 09:06:30 -08:00
Ben Ashbaugh
4fd42150bc add testing for SPIR-V 1.5 (#2208)
fixes #2140 

Adds testing for SPIR-V 1.5 features:

* Adds a test for bitcasts between pointers and vectors of integers.
Note, SPIR-V 1.5 only supports bitcasts to vectors of two 32-bit
integers. Therefore, the SPIR-V 1.5 behavior will only be exercised on
devices with 64-bit pointers. The test will run on devices with 32-bit
pointers, but will instead bitcast to scalars.
* Adds a test for OpGroupNonUniformBroadcast with a dynamic index. Note,
this is not an exhaustive test, and only unsigned integer types are
tested, to avoid duplicating testing for cl_khr_subgroup_ballot.
2025-01-14 09:05:47 -08:00
Marcin Hajder
d058dfdeef Corrected test_vulkan to use specific platform/device from harness (#2154)
Fixes #1926 according to task description
2025-01-07 23:39:38 +05:30
Marcin Hajder
4c70fecad7 Moved sub-test external_semaphores_import_export_fd to test_external_semaphore executable (#2110)
Fixes #1989 according to task description. Moreover, fixes #1876 as
well.
2025-01-07 10:06:20 -08:00
Kévin Petit
6fc3870728 Delete read_array_half and write_array_half tests (#2212)
These tests are broken, have been disabled for the longest time, and
don't add significant value.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2025-01-07 10:00:12 -08:00
Karol Herbst
34feb6e008 svm: finish all queues in svm_pointer_passing (#2209)
The `svm_pointer_passing` test has unflushed buffer unmap commands
queued, which a runtime might process after the `clSVMFree` calls at the
end of the test (through implicit flushing when destroying the queues at
e.g. program exit handlers).

This is only an issue when running the test with multiple devices.

However I think this was caused by a simple typo given the `clFinish`
was simply in the wrong block.
2025-01-07 09:35:46 -08:00
Romaric Jodin
86e0c236a1 fix negative_create_command_buffer_device_does_not_support_out_of_ord… (#2207)
…er_queue

Test should be skipped if device does not support out of order queue or
if device supports out of order command buffer.

Fix #2204
2025-01-07 09:33:29 -08:00
Romaric Jodin
435db66a3a fix negative_command_buffer_enqueue_with_different_context (#2206)
negative_command_buffer_enqueue_with_different_context does not need to
use CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE

Fix #2205
2025-01-07 09:32:36 -08:00
Ahmed Hesham
4486241540 Generate the Vulkan shaders at build time (#2199)
Use `add_custom_command` and `add_custom_target` instead of
`execute_process` so the generation of the Vulkan shader is done at
build time and not configuration time.

Use `configure_file` instead of string replacement.

Fixes #2179

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2025-01-07 09:30:27 -08:00
Kamil-Goras-Mobica
28da01788d Removed checking for supporting half (#2175)
Fixes https://github.com/KhronosGroup/OpenCL-CTS/issues/1982 according
to description
2025-01-07 09:29: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
Ahmed Hesham
baed156699 Migrate the select suite to the new test registration framework (#2198)
Contirbutes to #2181

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2024-12-18 20:29:16 +00: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