Commit Graph

66 Commits

Author SHA1 Message Date
Ben Ashbaugh
2d538182ff SVM tests where the size is zero (#2431)
Here are some tests to check how SVM APIs behave when the size is zero,
see:

* https://github.com/KhronosGroup/OpenCL-Docs/issues/1403

These tests don't fail right now if some of the calls are unsuccessful.
This ensures that all sub-tests run on a given implementation.
2025-11-18 10:20:37 -08:00
Ben Ashbaugh
54008fbf84 Merge branch 'main' into cl_khr_unified_svm 2025-11-06 14:34:30 -08:00
Jose Lopez
16cd0afe4f Add case for clSetKernelExecInfo with empty set (#2551)
Adds a special case to ensure that calling `clSetKernelExecInfo` with
`CL_KERNEL_EXEC_INFO_SVM_PTRS` and an empty set of pointers is valid
2025-10-28 08:54:41 -07:00
Ben Ashbaugh
089e02cdf7 add system SVM testing via clSVMAllocWithProperties (#2516)
This PR adds system SVM testing both using driver APIs
(`clSVMAllocWithPropertiesKHR`) and the system allocator directly (e.g.
`malloc`). This is done by finding all of the SVM capabilities that are
"system allocated" and duplicating them with a special "use system
allocator" pseudo-capability. When the "use system allocator"
pseudo-capability is not present, the system SVM type is treated the
same as all other unified SVM types and is tested using driver APIs.
When the "use system allocator" pseudo-capability is present, the system
SVM type is allocated using the system allocator directly, though this
also adds some limitations, for example the properties of the allocation
may not be queried using `clGetSVMPointerInfoKHR`.

See discussion in:
https://github.com/KhronosGroup/OpenCL-Docs/issues/1446
2025-10-14 10:07:32 -07:00
Ben Ashbaugh
56802afb17 clean up unified SVM memory fill test (#2518)
Removes unused code from the unified SVM memory fill test.

Adds an informational message when a unified SVM capability combination
is skipped for memcpy and memfill.
2025-09-16 11:37:49 -07:00
John Kesapides
704ffd012e Unified SVM Memcpy and check_for_common_memory_type (#2524)
* Refactor check_for_common_memory_type to only check for device access.
* rename check_for_common_memory_type to caps_compatibility_check
* Update test_unified_svm_mem_cpy and test_unified_svm_mem_fill.

fixes #2517

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2025-09-15 10:08:56 -07:00
Ben Ashbaugh
b63ef2d8f6 add tests for unified SVM corner cases (#2436)
This PR adds tests for a number of interesting unified SVM corner cases.

Not all of these may be valid tests! If we decide that some of these
tests are invalid, I will remove them.

Added tests include:

* Calling clSVMAllocWithPropertiesKHR to allocate zero bytes for each
unified SVM type.
* Calling clSVMFreeWithPropertiesKHR to free a NULL pointer.
* Calling clEnqueueSVMFree to asynchronously free an empty set of SVM
pointers.
* Calling clEnqueueSVMFree to asynchronously free a NULL pointer.
* Calling clSetKernelArgSVMPointer to set a NULL pointer kernel
argument.
* Calling clSetKernelArgSVMPointer to set a bogus pointer kernel
argument.
* Calling clSetKernelExecInfo with CL_KERNEL_EXEC_INFO_SVM_PTRS with an
empty set of SVM pointers.
* Calling clSetKernelExecInfo with CL_KERNEL_EXEC_INFO_SVM_PTRS with a
NULL pointer.
* Calling clSetKernelExecInfo with CL_KERNEL_EXEC_INFO_SVM_PTRS with a
bogus pointer.
* Calling clEnqueueSVMMemcpy with a size of zero and a NULL source or
destination pointer.
* Calling clEnqueueSVMMemcpy with a size of zero and a bogus source or
destination pointer.
* Calling clEnqueueSVMMemcpy with a size of zero and a valid source or
destination pointer.
* Calling clEnqueueSVMMemFill with a size of zero and a NULL destination
pointer.
* Calling clEnqueueSVMMemFill with a size of zero and a bogus
destination pointer.
* Calling clEnqueueSVMMemFill with a size of zero and a valid
destination pointer.
* Calling clEnqueueSVMMigrateMem with a size of zero and a NULL pointer.
* Calling clEnqueueSVMMigrateMem with a size of zero and a valid
pointer.
2025-08-05 10:17:00 -07:00
John Kesapides
b646ba5cae Testing Existing SVM APIs remaining APIs tests (#2441)
Tests for the following APIs:
* clEnqueueSVMMemcpy
* clEnqueueSVMMemFill
* clEnqueueSVMMap/clEnqueueSVMUnMap
* clEnqueueSVMMigrateMem
* clEnqueueSVMMemFree
* clSetKernelArgSVMPointer
* clSetKernelExecInfo

---------

Signed-off-by: John Kesapides <john.kesapides@arm.com>
2025-07-22 10:19:20 -07:00
Ben Ashbaugh
ca6efa1f3e add tests for clGetSVMSuggestedTypeIndexKHR (#2338)
Note, this PR is setup to merge to the `cl_khr_unified_svm` branch.

Adds tests for getting a suggested SVM type index. This is the next item
on the `cl_khr_unified_svm` test plan.
2025-03-18 12:15:32 -07:00
Ben Ashbaugh
3f15fcab9e add tests for clGetSVMPointerInfoKHR with a non-USVM pointer (#2280)
Note, this PR is setup to merge to the `cl_khr_unified_svm` branch.

Querying a non-USVM pointer should return default values and should not
return an error. This is the next item on the `cl_khr_unified_svm` test
plan.
2025-03-18 10:51:39 -07:00
Ben Ashbaugh
d08eea3b1e Merge branch 'main' into cl_khr_unified_svm 2025-02-11 13:14:23 -08:00
Ben Ashbaugh
ca082ed48e add initial unified SVM API tests (#2261)
This PR includes tests for `clSVMAllocWithPropertiesKHR` and
`clGetSVMPointerInfoKHR` for valid pointers, as per the unified SVM test
plan. These tests are passing on many devices with the unified SVM
emulation layer.

Note, these tests use the same test fixture and unified SVM wrapper as
the unified SVM capability tests in #2210.
2025-02-11 11:59:11 -08:00
Ben Ashbaugh
1da0f4f8d7 add initial unified SVM capability tests (#2210)
These tests are passing on many devices using the unified SVM emulation
layer.

Specifically, adds tests for:

* CL_SVM_CAPABILITY_SINGLE_ADDRESS_SPACE_KHR
* CL_SVM_CAPABILITY_DEVICE_UNASSOCIATED_KHR
* CL_SVM_CAPABILITY_HOST_READ_KHR
* CL_SVM_CAPABILITY_HOST_WRITE_KHR
* CL_SVM_CAPABILITY_HOST_MAP_KHR
* CL_SVM_CAPABILITY_DEVICE_READ_KHR
* CL_SVM_CAPABILITY_DEVICE_WRITE_KHR
* CL_SVM_CAPABILITY_DEVICE_ATOMIC_ACCESS_KHR
* CL_SVM_CAPABILITY_INDIRECT_ACCESS_KHR

Still TODO:

* CL_SVM_CAPABILITY_SYSTEM_ALLOCATED_KHR
* CL_SVM_CAPABILITY_DEVICE_OWNED_KHR
* CL_SVM_CAPABILITY_CONTEXT_ACCESS_KHR
* CL_SVM_CAPABILITY_HOST_OWNED_KHR
* CL_SVM_CAPABILITY_CONCURRENT_ACCESS_KHR
* CL_SVM_CAPABILITY_CONCURRENT_ATOMIC_ACCESS_KHR
2025-02-11 11:42:32 -08:00
Ben Ashbaugh
9123b05c1f add a unified SVM consistency check test (#2174)
Adds a unified SVM consistency check test, as per the description in
#2150.

Note that the target branch for this PR is the cl_khr_unified_svm
branch, not the main branch.
2025-02-11 10:40:19 -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
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
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
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
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
niranjanjoshi121
a406b34091 Fix error return and TEST_PASS for negative SVM tests (#2027)
Fix error return and TEST_PASS for negative SVM tests
Fix review comments from #1802 

Fixes #1964
2024-08-06 22:50:21 +05:30
niranjanjoshi121
0353c0bdbe Add negative test for test_svm size check (#1802)
Isuue #875 clarified that CL_INVALID_BUFFER_SIZE should be returned if
clCreateBuffer is passed a pointer returned by clSVMAlloc as its
host_ptr and the size of the buffer exceeds the size of the SVM
allocation.

Add a new negative test to ensure CL_INVALID_BUFFER_SIZE is returned
when the size of buffer exceeds the size of the SVM allocation.

Fixes #1701
2024-05-21 08:43:55 -07:00
Sven van Haastregt
e0a31a03fc Fix -Wformat warnings in various tests (#1868)
All of these warnings stem from printing `size_t` types, which should
be done using the `z` length modifier.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-02-27 09:59:39 -08:00
Haonan Yang
a73f2b38fb Fix windows stack overflow. (#1839) 2023-12-12 09:33:09 -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
ce17549812 cmake: do not suppress -Wsometimes-uninitialized globally (#1741)
Fix an instance of this warning in mem_host_flags.

Only disable `-Wsometimes-uninitialized` for the SVM test, which does
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-06-02 10:57:10 +01:00
Sven van Haastregt
a70fa56003 Fix some Wunused-but-set warnings (#1666)
To the best of my understanding, these occurrences of the
`-Wunused-but-set` warnings do not reveal any underlying issues, so we
can safely remove these variables.  There are more occurrences of this
warning in other places (not touched by this commit) that require
further analysis.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2023-03-30 09:34:00 +01:00
Sven van Haastregt
a61fa63054 [NFC] cmake: Remove redundant CMAKE_CXX_STANDARD (#1558)
`CMAKE_CXX_STANDARD` is already set in the top-level CMakeLists.txt
file, so there is no need to have it repeated for individual modules.

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

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2022-11-04 08:53:42 -07:00
Sreelakshmi Haridas Maruthur
30500fba06 SVM: Fix memory allocation size. (#1514)
* SVM: Fix memory allocation size.

9ad48998 generally made memory allocation and mapping consistent with a
size of size_t. Apply that fix to the final two allocations.

* check-format fixes

Co-authored-by: spauls <spauls@qti.qualcomm.com>
2022-09-27 09:28:57 -07:00
niranjanjoshi121
d928ac059c Use correct size for memory allocation in SVM test (#1496)
Memory is allocated for cl_int, but mapped as size_t.

Use size_t instead of cl_int during allocation and mapping for consistency.
2022-09-12 12:42:06 +01:00
Sven van Haastregt
6554c49018 [NFCI] Remove unused variables and enable -Wunused-variable (#1483)
Remove unused variables throughout the code base and enable the
`-Wunused-variable` warning flag globally to prevent new unused
variable issues being introduced in the future.

This is mostly a non-functional change, with one exception:

 - In `test_conformance/api/test_kernel_arg_info.cpp`, an error check
   of the clGetDeviceInfo return value was added.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2022-09-08 12:54:36 +01:00
niranjanjoshi121
9ad4899862 Use size_t instead of cl_int (#1414)
* Use size_t instead of cl_int

Memory is allocated for cl_int,
but mapped as size_t.
Use size_t instead of cl_int during
allocation and mapping for consistency.

* Use size_t instead of cl_int

Memory is allocated for cl_int,
but mapped as size_t.
Use size_t instead of cl_int during
allocation and mapping for consistency.

* Use size_t instead of cl_int

Memory is allocated for cl_int,
but mapped as size_t.
Use size_t instead of cl_int during
allocation and mapping for consistency.

* Remove test_half changes.

Remove test_half changes from other fix
that got included in this commit.

* Final formatting fix.
2022-08-31 22:58:13 -07:00
Grzegorz Wawiorko
216455842d Change arg type to unsigned int from signed int (#1078)
* Change arg type to unsigned int from signed int

* Fix formatting issues
2021-02-02 16:43:37 +00:00
Grzegorz Wawiorko
2597027737 Use highest OpenCL C version (#1081)
* Set the highest supported OpenCL C version.

* Remove gDeviceLt20 variable - not used anymore.

* Fix formatting issues
2021-01-11 13:54:19 +00:00
Ben Ashbaugh
d3eba8571a add OpenCL 3.0 test for CL_COMMAND_SVM_MIGRATE_MEM (#856) 2020-07-31 13:10:05 +01:00
Grzegorz Wawiorko
450f583800 Fix code format errors vs.2 2020-07-23 17:21:07 +01: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
Kévin Petit
5e2f5b857e Accept OpenCL 3.0 in version parsing code and use where appropriate (#752)
* Accept OpenCL 3.0 in version parsing code and use where appropriate

There were a number of tests against 2.2 that are clearer against 3.0.

Fixes #751

Signed-off-by: Kévin Petit <kpet@free.fr>

* Remove CL_EXPERIMENTAL guards

Signed-off-by: Kévin Petit <kpet@free.fr>

* formatting

* Configure the headers for OpenCL 3.0

* more format fixes
2020-04-30 11:51:06 +01:00
ellnor01
3b79ecdb87 Replace get_device_version with get_cl_device_version (#733)
They are duplicate functions

Fixes #709

Change-Id: I8f7d6b8254047adb9e09ede4951dedc3ec5c1099
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
2020-04-15 14:31:22 +01:00
Grzegorz Wawiorko
78fc283069 Fix test skip handling while test initialization (#670) 2020-03-11 18:14:29 +00:00
Grzegorz Wawiorko
8a00f4eced Test SVM: Fix - do not use unmapped pointer. (#661)
* Fix - do not use unmapped pointer.

* Exchanging variable names to more readable.
2020-03-11 10:10:51 +00:00
Radek Szymanski
80c3a27a6a Remove unused parameter (#630)
The imageSupportRequired param is not needed in runTestHarnessWithCheck,
so just remove it.

Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
2020-02-27 15:36:28 +00:00
Kévin Petit
3f11868e11 Fix warnings reported by -Wconversion-null (#603)
Fix error reporting in clFillImage as a result.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2020-02-21 12:21:53 +00:00
boazo
fa6b9e671e Svm optional (#580)
* svm test optional

* make svm test suite execution optional
2020-02-20 19:39:40 +00:00
Grzegorz Wawiorko
1ca9d9dca7 test_svm - enqueue_api - lack of synchronization points (#571)
* Fixes #570 - test_svm - enqueue_api - lack of synchronization points

* Review fixes - use variable, use CL_MAP_READ

* Review fix - use nullptr instead of 0
2020-02-03 13:47:50 +00:00
Kévin Petit
d7e8e5040a Mark SVM and pipes tests as requiring OpenCL 2.0 (#475)
Signed-off-by: Kévin Petit <kpet@free.fr>
2019-11-14 17:26:32 +00:00
Grzegorz Wawiorko
d6e1e7c870 Fix Issue 462 - test_svm crash (#463) 2019-10-02 11:57:40 +01:00
Kévin Petit
da0f375226 Add host/host test for clEnqueueSVMMemcpy (#460)
This was the only combination that was not exercised.

Fixes #419

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2019-09-26 11:56:34 +01:00
Grzegorz Wawiorko
f4682a9181 Fix compilation issues (#448) 2019-09-12 13:05:46 +01:00
Grzegorz Wawiorko
e880869559 Fix verification if atomics 64bit extensions supported by device (#441) 2019-08-23 10:24:02 +01:00