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.
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
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.
* 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>
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.
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.
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.
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.
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.
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>
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.
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>
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.
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>
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
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>
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>
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>
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>
`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>
* 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>
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>
* 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.
* 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
They are duplicate functions
Fixes#709
Change-Id: I8f7d6b8254047adb9e09ede4951dedc3ec5c1099
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>