Commit Graph

1246 Commits

Author SHA1 Message Date
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
Ahmed Hesham
2316c6343f Migrate allocations suite to the new test registration framework (#2191)
Contributes to #2181
2024-12-18 11:42:12 +00:00
Sven van Haastregt
9bb8a89bbd semaphore: fix Wformat warning (#2194)
`i` is an `int`, so shouldn't use the `%zu` specifier for printing.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-12-17 23:41:36 +05:30
Katarzyna Cencelewska
e17e6eef7b add option to bruteforce test to force count of worker threads (#2188)
- to be able to have deterministic results it is useful to have a
mechanism
  to force the same count of workers
- this commit doesn't change the default settings but expands
  functionality

Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>

Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
2024-12-17 09:58:03 -08:00
Kévin Petit
57a91b7ffe [NFC] Migrate profiling suite to new registration framework (#2187)
Contributes to #2181

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2024-12-17 09:57:27 -08:00
Sven van Haastregt
7693ffe0a5 Fix more 32-bit Wformat warnings (#2185)
This fixes occurrences where the previous wrong specifier appears to
work in a typical 64-bit build, but causes a Wformat warning in 32-bit
builds.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-12-17 09:55:37 -08:00
Kévin Petit
be1278d5b2 Add utility macro to skip test when an extension is not supported (#2178)
Use in cl_khr_external_semaphore suite as an example.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2024-12-17 09:54:51 -08:00
Michael Rizkalla
09e4d03e46 Fix clCopyImage 1D buffer images tests with use_pitches flag (#2167)
This change fixes the following issues when running `clCopyImage` test
with `use_pitches` flag for 1D buffer images.

1. Query device CL version using `get_device_cl_version` rather than
using `CL_DEVICE_VERSION`. Previously, using `char` may not be enough to
store the return value.
2. Pass `host_ptr` to `clCreateBuffer` when creating the buffer for the
1D image. `host_ptr` may not be `nullptr` if use_pitches flag is used.
Also, `buffer_flags` will contain `CL_MEM_USE_HOST_PTR` which requires a
host pointer to be passed.
3. Conditionally use the `host_ptr` when calling `clCreateImage`, it
will not be used with 1D image buffer. This is made to align with the
spec, in which if `mem_flags` has `CL_MEM_USE_HOST_PTR` a host pointer
must be present, but if the memory flag is not present, host pointer
must be `nullptr`.
4. Use the correct free function `free` and `align_free` based on the
allocation function that was used.

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2024-12-17 09:53:56 -08: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
Kamil-Goras-Mobica
2df00c65a1 Added unique_ptrs and MTdataHolder to test_atomics.cpp (#2169)
Fixes https://github.com/KhronosGroup/OpenCL-CTS/issues/1793 according
to description
2024-12-17 08:44:27 -08:00
Michael Rizkalla
e61da21cd6 Fix using incorrect free function in arrayimagecopy and imagearraycopy basic tests' unique_ptr (#2177)
This change addresses a free function mis-match issue where `delete` is
used to free memory allocated via `malloc` within `create_random_data`
and in the test function.

The change involves the following tests:
1. arrayimagecopy
2. arrayimagecopy3d
3. imagearraycopy
4. imagearraycopy3d

This should address #2173

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
2024-12-17 09:30:48 +01:00
Ahmed Hesham
7d9ecaaf73 Migrate vectors suite to the new test registration framework (#2190)
Contributes to #2181
2024-12-13 16:47:01 +00:00
Ahmed Hesham
2fe382ec8a Migrate atomics suite to the new test registration framework (#2189)
Contributes to #2181
2024-12-13 16:33:56 +00:00
Kévin Petit
5b7af4b36d [NFC] Change the name of the default device provided by the new registration framework (#2186)
The code base uses a mix of 'device' and 'deviceID'. I suggest we
standardise on 'device' which is shorter and slightly more prevalent.

Contributes to #2181

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2024-12-12 13:24:04 -08:00
Sven van Haastregt
56d383b2e9 Fix more Wformat warnings related to size_t (#2166)
Printing of a `size_t` requires the `%zu` specifier.

This fixes occurrences where the previous wrong specifier appears to
work in a typical 64-bit build, but causes a Wformat warning in 32-bit
builds.

---------

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-12-10 09:13:58 -08:00
Ben Ashbaugh
d99b302f90 switch SVM tests to the new test registration framework (#2168)
Switches the SVM tests to the new test registration framework.

The first commit is the best to review and contains the actual changes.
The second commit purely has formatting changes.

Note that several of these changes were a bit more than mechanical
because many of the SVM tests create a new context vs. using the context
provided by the harness and passed to each test function. The previous
code named the context provided by the harness differently, and hence
could use the name "context" in each test function, but with the new
test registration framework this is no longer possible. Instead, I am
creating the new context using the name "contextWrapper" and then
assigning it to the "context" passed to the test function, which seems
like the best way to avoid using the wrong context unintentionally. I am
open to suggestions to do this differently.

I have verified that the same calls are made before and after these
changes, and specifically that there are no context leaks.
2024-12-03 14:51:23 -08:00
Sreelakshmi Haridas Maruthur
3bdd2f99b5 cl_fill_image: Use CL_DEVICE_VERSION instead of CL_DEVICE_NUMERIC_VER… (#2043)
…SION

CL_DEVICE_NUMERIC_VERSION is only available from OpenCL 3.0 Use
CL_DEVICE_VERSION instead.
2024-12-03 08:55:37 -08:00
Kévin Petit
0a1456d8f9 [RFC] Move logic for test registration to the test harness (#2151)
And use in device_timer suite.

Signed-off-by: Kévin Petit <kpet@free.fr>
2024-11-26 09:55:09 -08:00
Ahmed Hesham
5d85fb3e3b Use cl_uint in some SPIR-V tests to avoid UB (#2159)
The following tests under `spirv_new`:
* `op_branch_conditional`
* `op_phi`
* `op_selection_merge`

were using randomly generated `cl_int` values, and storing the
difference between them as a `cl_int`. If one of the generated values is
negative and large enough, while the other is positive and large enough,
the difference then becomes a larger value that cannot be represented
using `cl_int`.

Switch the tests to use `cl_uint` instead, and update the relevant
spvasm{32,64} files to use `OpULessThan` instead of `OpSLessThan`.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
2024-11-26 09:29:27 -08:00
gorazd-sumkovski-arm
96e3d7e669 Command buffer test adjustments (#2141)
Signed-off-by: Gorazd Sumkovski <gorazd.sumkovski@arm.com>
Co-authored-by: Ewan Crawford <ewan.cr@gmail.com>
2024-11-26 09:26:04 -08:00
Sven van Haastregt
e360d2de5b Fix various Wformat warnings (#2135)
test_copy_1D.cpp: num_mip_levels is a cl_uint, so don't cast and just
print using `%u`.

test_pipe_info.cpp: arg_type_qualifier is a 64-bit wide bitfield, so
print in hexadecimal format using the correct length modifier.

test_device_partition.cpp: it is not clear what the bit width of
`cl_device_partition_property` should be, so cast the operands to align
with the format specifiers.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-11-26 09:25:38 -08:00
Kamil-Goras-Mobica
feca4c6354 Removed usage of half types in CTS gl tests (#2147)
see #1982
2024-11-26 08:39:42 -08:00
Ben Ashbaugh
e9a248f555 add SPIR-V 1.4 testing for OpCopyLogical (#2136)
This PR adds targeted testing for the SPIR-V 1.4 instruction
OpCopyLogical.
2024-11-25 07:35:50 -08:00