Commit Graph

59 Commits

Author SHA1 Message Date
Marcin Hajder
6506421614 Added support for cl_ext_float_atomics in CBasicTestFetchMinSpecialFloats with atomic_float (#2391)
Related to #2142, according to the work plan, extending
CBasicTestFetchMinSpecialFloats with support for atomic_float.
2026-03-10 08:41:40 -07:00
Marcin Hajder
a56e8ee92b Added corrections due to clean up harness helper functions for programs and kernels (#2626)
Related to #2597
2026-03-10 08:40:03 -07:00
Marcin Hajder
5673883005 Added support for cl_ext_float_atomics in CBasicTestFetchAddSpecialFloats with atomic_double (#2388)
Related to #2142, according to the work plan, extending
CBasicTestFetchAddSpecialFloats with support for atomic_double.
2026-02-24 08:37:29 -08:00
Marcin Hajder
9d3ae4c734 Added support for cl_ext_float_atomics in CBasicTestFetchAddSpecialFloats with atomic_float (#2371)
Related to #2142, according to the work plan, extending
CBasicTestFetchAddSpecialFloats with support for atomic_float.
2026-02-17 08:41:46 -08:00
Marcin Hajder
6f38c799c1 Added support for cl_ext_float_atomics in CBasicTestFetchAddSpecialFloats with atomic_half (#2386)
Related to #2142, according to the work plan, extending
CBasicTestFetchAddSpecialFloats with support for atomic_half.
2026-01-27 08:46:57 -08:00
Grzegorz Wawiorko
e076b4a9e9 Fix test_atomics - wrong HostDataType taken for comparing (#2601)
We see compiler errors on Intel GPU without this fix.
2026-01-13 09:51:17 -08: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
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
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
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
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
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
Marcin Hajder
df61cad39f Added support for cl_ext_float_atomics in CBasicTestFetchMin/Max with atomic_float (#2353)
Related to #2142, according to the work plan, extending
`CBasicTestFetchMin`/`CBasicTestFetchMax` with support for atomic_float.
2025-09-09 08:45:35 -07:00
Marcin Hajder
1aeca1360b Added support for cl_ext_float_atomics in CBasicTestFetchSub with atomic_half (#2366)
Related to #2142, according to the work plan, extending
CBasicTestFetchSub with support for atomic_half.

I wasn't able to test that PR entirely 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-09-09 08:40:50 -07:00
Marcin Hajder
fbba22770d Added support for cl_ext_float_atomics in CBasicTestFetchAdd with atomic_float (#2345)
Related to #2142, according to the work plan, extending
CBasicTestFetchAdd with support for atomic_float.
2025-09-02 08:38:56 -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
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
dec5644112 Added support for cl_ext_float_atomics in c11_atomics store test along with atomic_half type (#2293)
Related to #2142, according to the work plan extended `CBasicTestStore`
with support for `atomic_half`.

Optimization remark: in tests related to `CBasicTestStore` kernel source
code is mostly composed with arguments following similar pattern:

`__kernel void test_atomic_kernel(uint threadCount, uint numDestItems,
__global int *finalDest, __global int *oldValues, volatile __local
atomic_int *destMemory)`

`oldValues` buffer is initialized with a host pointer, after kernel
execution it is read back to the host pointer but it is unused in
neither of the kernels I verified.
2025-05-27 08:51:36 -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
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
Sreelakshmi Haridas Maruthur
c8ebba8699 c11_atomics: Reduce the loopcounter for sequential consistency tests (#1853)
Reduce the loop from 1000000 to 500000 since the former value
makes the test run too long and cause system issues on certain
platforms
2023-12-12 09:38:14 -08:00
Sven van Haastregt
ea6e536ed3 c11_atomics: align signedness of host types (#1816)
Some `HOST_` types were declared with signedness different from the
`HOST_ATOMIC_` counterparts, leading to sign-compare warnings when
comparing between types.  Fix by aligning the signedness.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-11-14 09:09:45 -08:00
Sven van Haastregt
42434d04d0 c11_atomics: fix uninitialized member accesses (#1819)
Initialize the `_memoryOrder` and `_memoryScope` members to avoid
`CBasicTestMemOrderScope::MaxHostThreads()` accessing uninitialized
data.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-11-07 09:32:16 -08:00
Sven van Haastregt
aa953aaa51 [NFC] cmake: do not suppress -Wsign-compare globally (#1810)
Only disable `-Wsign-compare` for tests that do not compile cleanly
with this warning enabled.  Re-enable the warning for the other tests,
so that it can catch any new occurrences.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-09-20 15:48:25 +01:00
Sven van Haastregt
d7f24a7986 Fix more -Wsign-compare warnings (#1779)
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-09-14 11:00:30 +01:00
Sven van Haastregt
475a37abbf [NFC] Do not use reserved names for include guards (#1737)
Names that begin with an underscore followed by an uppercase letter
are reserved for the C++ implementation.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-06-09 11:25:20 +01:00
Finlay
691a45d605 c11 atomic fence: relaxed requirements for an auxiliary atomic_store (#1603) 2023-01-31 09:47:47 -08:00
Sven van Haastregt
8bb69ef665 Fix -Wformat-extra-args warnings (#1533)
Fix a few instances where an incorrect number of arguments was
supplied when calling (v)log_error.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2022-11-01 13:09:48 -07:00
Ahmed
388944c01c Minimum 2 non atomic variables per thread for the c11 atomic fence test for embedded profile devices. (#1452)
* Minimum 2 Non atomic variables per thread for an embedded profile device - https://github.com/KhronosGroup/OpenCL-CTS/issues/1274

* Formatting
2022-09-06 09:53:12 -07:00
paulfradgley
c2aca7d8e6 Fix local memory out of bounds issue in atomic_fence (replaces PR #1285) (#1437)
* Fix local memory out of bounds in atomic_fence

In the error condition, the atomic_fence kernel can illegally access local memory addresses.

In this snippet, localValues is in the local address space and provided as a kernel argument. Its size is effectively get_local_size(0) * sizeof(int). The stores to localValues lead to OoB accesses.

  size_t myId = get_local_id(0);

  ...

  if(hisAtomicValue != hisValue)
  { // fail
    atomic_store(&destMemory[myId], myValue-1);
    hisId = (hisId+get_local_size(0)-1)%get_local_size(0);
    if(myValue+1 < 1)
      localValues[myId*1+myValue+1] = hisId;
    if(myValue+2 < 1)
      localValues[myId*1+myValue+2] = hisAtomicValue;
    if(myValue+3 < 1)
      localValues[myId*1+myValue+3] = hisValue;
  }

* Fix formatting

* Fix formatting again

* Formatting
2022-06-14 08:47:06 -07:00
Jeremy Kemp
5d6ca3e9d1 Change memory order and scope for atomics that gate final results being stored. (#1377)
* Change memory order and scope for atomics that gate final results being stored.

memory_order_acq_rel with memory_scope_device is now used to guarantee that the correct memory consistency is observed before final results are stored.

Previously it was possible for kernels to be generated that all used relaxed memory ordering, which could lead to false-positive failures.

Fixes #1370

* Disable atomics tests with global, in-program atomics.

If the device does not support `memory_order_relaxed` or `memory_scope_device`, disable atomics tests that declare their atomics in-program with global memory.

There is now an implicit requirement to support `memory_order_relaxed` and `memory_scope_device` for these tests.

* Fix misplaced parentheses.

* Change memory scope for atomic fetch and load calls in kernel

Change the memory scope from memory_scope_work_group to
memory_scope_device so the ordering applies across all work items

Co-authored-by: Sreelakshmi Haridas <sharidas@quicinc.com>
2022-04-28 15:34:08 -07:00
Jeremy Kemp
1f26e1d8ba Fix memory model issue in atomic_flag. (#1283)
* Fix memory model issue in atomic_flag.

In atomic_flag sub-tests that modify local memory, compilers may re-order memory accesses between the local and global address spaces which can lead to incorrect test failures.

This commit ensures that both local and global memory operations are fenced to prevent this re-ordering from occurring.

Fixes #134.

* Clang format changes.

* Added missing global acquire which is necessary for the corresponding global release.

Thanks to @jlewis-austin for spotting.

* Clang format changes.

* Match the condition for applying acquire/release fences.
2021-09-07 12:47:44 +01:00
Grzegorz Wawiorko
6da9c6b68f Fix double free in c11_atomics tests for SVM allocations (#1286)
* Only Clang format changes

* Fix double free object for SVM allocations

* Fix double free - review fixes
2021-08-11 18:06:10 +01:00
Grzegorz Wawiorko
8fa24b8a72 Change arg type to unsigned int from signed int (#1031) 2020-11-06 11:31:56 +00:00
Alastair Murray
8894e7f046 Add memory_scope_all_devices testing (#999)
* Add memory_scope_all_devices testing

This duplicats memory_scope_all_svm_devices testing, but it seems pretty quick
so I don't think it hurts.

Fixes #990

* Address clang-format failures

* Address a further clang-format failure
2020-10-30 15:01:48 +00:00
ellnor01
a6809710ea Remove unnecessary cl_mem_flags casts (#1018)
* api, atomics: remove unnecessary cl_mem_flags casts

Instances in api, atomics, buffers and c11_atomics suites

Contributes #759

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* basic: remove unnecessary cl_mem_flags casts

Contributes #759

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* spir, thread_dimensions: remove unnecessary cl_mem_flags casts

Instances in spir, thread_dimensions and workgroups tests

Contributes #759

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* profiling, relationals: remove unnecessary cl_mem_flags casts

Includes relationals, profiling, muliple_device_context, integer_ops
tests

Contributes #759

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* clcpp: remove unnecessary cl_mem_flags casts

Contibutes #759

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* events, geometrics: remove unnecessary cl_mem_flags casts

Includes events, geometrics, gl and images tests

Contributes #759

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* commonfs, compiler: remove unnecessary cl_mem_flags casts

Includes cast removal in commonfs, compiler and device_partition tests

Fixes #759

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

* Fix up formatting

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2020-10-19 13:56:02 +01:00
Jeremy Kemp
10a30afeb2 Fix kernel compilation issue in c11 atomics. (#973) 2020-09-23 17:16:26 +01:00
Jack Frankland
61cfb505ae Skip atomic_flag Test on for OpenCL-3.0 not Supporting Device Scope (#954)
* The `atomic_flag` test assumes support for the `atomic_scope_device`
scope in the global scope test case. Since `atomic_scope_device` is
optional on an OpenCL-3.0 driver, this test should check for support and
skip otherwise.
2020-09-22 09:26:05 -07:00
Sreelakshmi Haridas Maruthur
60b731ce15 c11_atomics: Fix to iteratively reduce workgroup size (#939) (#941)
The generator function for atomic_fence uses the current workgroup
size to determine the number of non atomic variables per thread
in the kernel. The kernel should hence be regenerated when the
workgroup size changes.

However regenerating the kernel can itself change the workgroup
size. This change introduces an iterative loop that reduces the
workgroup sizes by 2 each time re-generating the kernel until
we find one that works (or exit at groupsize == 1)

Change-Id: Ic32fe967e32de6643e01c6775f4bddbcad0a299a
2020-09-22 09:15:09 -07:00
Jack Frankland
9178524d02 Change Behaviour of C11 Atomic Tests for OpenCL-3.0 (#944)
* Change setup code in `KernelCode()` to use `_explicit` builtin
variants that are common to both OpenCL-2.X and OpenCL-3.0.

* Only test optional supported builtin variants (`_explicit` signature
 memory_order/scope) for OpenCL-3.0.

* Disable program scope global variable and generic address space tests
for a OpenCL-3.0 driver which does not optionally support these
features.
2020-09-22 09:08:32 -07:00
Jeremy Kemp
1e411b888f Memory consistency model optionality (#907)
* Test minimum memory consistency capabilities for a device reporting >= 3.0.

Skip tests where unsupported memory consistency capabilities are being requested.

* Pass nullptr as program build option.

Allows the CTS framework to select an appropriate CL C version.

* Removed redundant braces.
2020-08-31 15:12:10 -07:00
Grzegorz Wawiorko
44a240367e Fix code format errors 2020-07-23 17:21:07 +01:00
Grzegorz Wawiorko
d643dc5399 Add API name to version_expected_info function 2020-07-23 17:21:07 +01:00
Ankit Goyal
4fbcd96e7f Remove "C" linkages (#781)
* Remove extern C linkages

* Update crc32 to cpp and remove extern C linkage
2020-05-20 14:16:19 +01:00
Jeremy Kemp
a83f7c3ed8 c11_atomics: do not overallocate local memory for embedded devices #690. (#691)
The spec states that the minimum amount of local memory for embedded devices is 1KB. This change clamps work group sizes to 1024 for embedded devices, and sets the number of local variables per thread to 1.

Fixes #690.
2020-03-26 17:56:26 +00:00
Grzegorz Wawiorko
0c5da9c777 Fix - add TEST_PASS test status in group of tests (#686) 2020-03-18 15:35:34 +00:00