Repository navigation
initial test plan for cl_khr_unified_svm #2150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bashbaug
wants to merge
9
commits into
KhronosGroup:cl_khr_unified_svm
Choose a base branch
from
bashbaug:cl_khr_unified_svm-test-plan
base: cl_khr_unified_svm
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4623357
initial test plan for cl_khr_unified_svm
bashbaug 01e6b58
update the test for SVM combinations reported by the platform
bashbaug 5daaa46
mark test plan items complete for consistency checks
bashbaug 74597de
mark some test plan items complete for capability checks
bashbaug 930f19d
mark some test plan tasks complete for API tests
bashbaug 03b0fa0
mark testing for clSVMFreeWithPropertiesKHR as complete
bashbaug cf6613f
mark test plan items complete for clGetSVMPointerInfoKHR and clGetSVM…
bashbaug 44fecb1
mark test plan items complete for existing SVM APIs
bashbaug 826a15d
mark test plan items complete for SVM corner cases
bashbaug File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,215 @@ | ||
| # cl_khr_unified_svm | ||
|
|
||
| This document describe the test plan for the [`cl_khr_unified_svm`](https://github.com/KhronosGroup/OpenCL-Docs/pull/1282) extension, which may currently be found here: | ||
|
|
||
| https://github.com/KhronosGroup/OpenCL-Docs/pull/1282 | ||
|
|
||
| ## Prior Work | ||
|
|
||
| Existing OpenCL 2.0 SVM CTS tests may be found here: | ||
|
|
||
| https://github.com/KhronosGroup/OpenCL-CTS/tree/main/test_conformance/SVM | ||
|
|
||
| Some prior tests for the Intel USM extension [`cl_intel_unified_shared_memory`](https://registry.khronos.org/OpenCL/extensions/intel/cl_intel_unified_shared_memory.html) may be found here: | ||
|
|
||
| https://github.com/intel/compute-samples/tree/master/compute_samples/tests/test_cl_unified_shared_memory | ||
|
|
||
| ## Test Plan | ||
|
|
||
| ### Consistency Check | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the addition of the concurrent access atom size query, we should add a few more consistency checks:
|
||
|
|
||
| As an initial test, perform a consistency check to ensure that the platform and the test device enumerate a consistent set of SVM capabilities: | ||
|
|
||
| * [X] For each device in the platform, check that the platform and device report the same number of SVM capability combinations. | ||
| * [X] For each SVM capability combination reported by the platform, check that the reported platform capabilities at an index are the intersection of all non-zero device capabilities at the same index. | ||
| * [X] For each SVM capability combination reported by the test device, check that the device SVM capabilities are either a super-set of the platform SVM capabilities or are zero, indicating that this SVM type is not supported. | ||
|
|
||
| NOTE: Added by https://github.com/KhronosGroup/OpenCL-CTS/pull/2174. | ||
|
|
||
| ### Testing SVM Capabilities | ||
|
|
||
| * [X] `CL_SVM_CAPABILITY_SINGLE_ADDRESS_SPACE_KHR` | ||
| * Testing options: | ||
| 1. Pass a pointer-to-a-pointer as a kernel argument. | ||
| Read the pointer from the kernel argument and write to it. | ||
| Ensure the correct value was written on the host. | ||
| 2. Pass the pointer as a kernel argument. | ||
| Write the kernel argument to another allocation, which could even be an OpenCL buffer memory object. | ||
| Ensure the value written on the device matches the value on the host. | ||
| * [X] `CL_SVM_CAPABILITY_SYSTEM_ALLOCATED_KHR` | ||
| * [X] When allocating memory to test, use the system `malloc` rather than `clSVMAllocWithPropertiesKHR`. | ||
| * [ ] `CL_SVM_CAPABILITY_DEVICE_OWNED_KHR` | ||
| * TBD | ||
| * [X] `CL_SVM_CAPABILITY_DEVICE_UNASSOCIATED_KHR` | ||
| * [X] When allocating memory to test, do not pass the test device via a `CL_SVM_ALLOC_ASSOCIATED_DEVICE_HANDLE_KHR` property. | ||
| * [X] Include at least one targeted test that passes the `CL_SVM_ALLOC_ASSOCIATED_DEVICE_HANDLE_KHR` property anyhow. | ||
| * [ ] `CL_SVM_CAPABILITY_CONTEXT_ACCESS_KHR` | ||
| * TBD: Create a multi-device context, use the allocation on all of the devices in the context? | ||
| * [ ] `CL_SVM_CAPABILITY_HOST_OWNED_KHR` | ||
| * TBD | ||
| * [X] `CL_SVM_CAPABILITY_HOST_READ_KHR` | ||
| * [X] When verifying test results, read from the allocation directly on the host, without mapping or copying explicitly. | ||
| * [X] For devices that also support `CL_SVM_CAPABILITY_DEVICE_WRITE_KHR`, also include a targeted test that writes on the device and reads the results on the host without mapping or copying explicitly. | ||
| * [X] `CL_SVM_CAPABILITY_HOST_WRITE_KHR` | ||
| * [X] When initializing test data, write to the allocation directly from the host, without mapping or copying explicitly. | ||
| * [X] For devices that also support `CL_SVM_CAPABILITY_DEVICE_READ_KHR`, also include a targeted test that writes on the host without mapping or copying explicitly, then read the results on the device and writes it to an an OpenCL buffer memory object. | ||
| * [X] `CL_SVM_CAPABILITY_HOST_MAP_KHR` | ||
| * [X] When initializing test data or verifying test results, map the allocation for access from the host, rather than copying explicitly. | ||
| * [X] For devices that also support `CL_SVM_CAPABILITY_DEVICE_WRITE_KHR`, also include a targeted test that writes on the device and reads the results on the host by mapping. | ||
| * [X] For devices that also support `CL_SVM_CAPABILITY_DEVICE_READ_KHR`, also include a targeted test that writes on the host by mapping, then reads the results on the device and writes it to an OpenCL buffer memory object. | ||
| * [X] `CL_SVM_CAPABILITY_DEVICE_READ_KHR` | ||
| * [X] Populate an allocation via direct access from the host, via mapping, or via device memcpy, depending on supported capabilities. | ||
| Then, read the value on the device and write it to an OpenCL buffer memory object. | ||
| * Mechanisms to read from the allocation on the device are: | ||
| * [X] Via a kernel that reads from the allocation as a kernel argument. | ||
| * [X] Via `clEnqueueSVMMemcpy`. | ||
| * [X] `CL_SVM_CAPABILITY_DEVICE_WRITE_KHR` | ||
| * [X] Populate an OpenCL buffer memory object with values. | ||
| Read the values from the OpenCL buffer memory object on the device and write them to the memory allocation. | ||
| Verify that the values were written correctly via direct access from the host, via mapping, or via memcpy, depending on supported capabilities. | ||
| * Mechanisms to write to the allocation on the device are: | ||
| * [X] Via a kernel that writes to the allocation as a kernel argument. | ||
| * [X] Via `clEnqueueSVMMemcpy`. | ||
| * [X] Via `clEnqueueSVMMemFill`. | ||
| * [X] `CL_SVM_CAPABILITY_DEVICE_ATOMIC_ACCESS_KHR` | ||
| * [X] Initialize a memory allocation with zero. | ||
| Atomically increment the memory allocation from the device. | ||
| Verify that the correct updates were made via direct access from the host, via mapping, or via memcpy, depending on supported capabilities. | ||
| * [ ] `CL_SVM_CAPABILITY_CONCURRENT_ACCESS_KHR` | ||
| * Note, as described, these tests will require `CL_SVM_CAPABILITY_HOST_READ_KHR`, `CL_SVM_CAPABILITY_HOST_WRITE_KHR`, `CL_SVM_CAPABILITY_DEVICE_READ_KHR`, and `CL_SVM_CAPABILITY_DEVICE_WRITE_KHR` also. | ||
| * Details TBD, but the rough idea will be: | ||
| 1. Allocate a small amount of memory, some which will be accessed via the host (or eventually, another device?), and some which will be accessed via the device. | ||
| 2. From the host, perform some number of read-modify-write accesses to the memory. | ||
| If just one host thread is accessing memory, these read-modify-write accesses may be done non-atomically. | ||
| 3. From the device, perform some number of read-modify-write accesses to the memory. | ||
| If just one work-item is accessing each memory location (but multiple work-items are accessing the allocation) these accesses may also be done non-atomically. | ||
| 4. Verify that the correct updates were made via direct access from the host, via mapping, or via memcpy, depending on supported capabilities. | ||
| * May want to test multiple iterations, or to take other steps to increase the likelihood that accesses are made concurrently. | ||
| * Are there any best practices we can borrow from fine-grain SVM testing? | ||
| * TODO: See document issue 1, regarding the minimum supported granularity for concurrent access. | ||
| * [ ] `CL_SVM_CAPABILITY_CONCURRENT_ATOMIC_ACCESS_KHR` | ||
| * Note, as described, these tests will require `CL_SVM_CAPABILITY_HOST_READ_KHR` and `CL_SVM_CAPABILITY_HOST_WRITE_KHR`, also. | ||
| * [ ] Initialize a memory allocation with zero. | ||
| Atomically increment the memory allocation from the device and the host (relaxed atomics, device scope). | ||
| Verify that the correct updates were made via direct access from the host, via mapping, or via memcpy, depending on supported capabilities. | ||
| * Note, requires `CL_DEVICE_ATOMIC_ORDER_RELAXED` and `CL_DEVICE_ATOMIC_SCOPE_ALL_DEVICES` capabilities to be included in `CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES`. | ||
| * [ ] Initialize a memory allocation. | ||
| Write values non-atomically to part of the allocation from the device, then write a flag to memory using a store-release, all svm devices atomic. | ||
| On the host, poll the flag value using a load-acquire atomic. | ||
| When the updated flag value is seen, read and verify the values that were written non-atomically. | ||
| Write updated values non-atomically to part of the allocation from the host, then write a flag to memory using a store-release atomic. | ||
| On the device, poll for the updated flag value using a load-acquire, all svm devices atomic. | ||
| When the updated flag value is seen, read and verify the values that were written non-atomically. | ||
| Repeat as needed. | ||
| * May want to test multiple iterations, or to take other steps to increase the likelihood that accesses are made concurrently. | ||
| * Are there any best practices we can borrow from fine-grain SVM testing? | ||
| * [X] `CL_SVM_CAPABILITY_INDIRECT_ACCESS_KHR` | ||
| * [X] For devices that support `CL_SVM_CAPABILITY_DEVICE_READ_KHR`, initialize a memory allocation with a known value. | ||
| On the host, embed the pointer to the allocation into an OpenCL buffer memory object. | ||
| On the device, read the pointer out of the OpenCL buffer memory object, then read a value from the pointer. | ||
| Store the value read to another OpenCL buffer memory object. | ||
| Back on the host, verify the known value was read. | ||
|
|
||
| NOTE: Added by https://github.com/KhronosGroup/OpenCL-CTS/pull/2210. | ||
|
|
||
| ### Testing New SVM APIs | ||
|
|
||
| * `clSVMAllocWithPropertiesKHR` | ||
| * [X] Test without a `CL_SVM_ALLOC_ALIGNMENT_KHR` property. | ||
| * [X] Test without a `CL_SVM_ALLOC_ACCESS_FLAGS_KHR` property. | ||
| * [X] For SVM types supporting `CL_SVM_CAPABILITY_DEVICE_UNASSOCIATED_KHR`, test without a `CL_SVM_ALLOC_ASSOCIATED_DEVICE_HANDLE_KHR` device. | ||
| * [X] Test with varying the `CL_SVM_ALLOC_ALIGNMENT_KHR` property - all powers of two from 1 to 128 inclusive? | ||
| * [X] Test with varying the `CL_SVM_ALLOC_ACCESS_FLAGS_KHR` property - all combinations? | ||
| * [X] Include at least one test with all properties: `CL_SVM_ALLOC_ASSOCIATED_DEVICE_HANDLE_KHR` plus `CL_SVM_ALLOC_ALIGNMENT_KHR` plus `CL_SVM_ALLOC_ACCESS_FLAGS_KHR`. | ||
| * [X] Test zero-byte allocation. | ||
| * `clSVMFreeWithPropertiesKHR` | ||
| * Tested by the fixture; no flags or properties to test.. | ||
| * [X] Test freeing `NULL`. | ||
| * `clGetSVMPointerInfoKHR` | ||
| * After allocating, perform each of the queries, both with and without an explicit `device` parameter, for the base pointer returned by the `clSVMAllocWithPropertiesKHR` and a pointer computed from the base pointer. | ||
| * [X] `CL_SVM_INFO_TYPE_INDEX_KHR` - must match the index passed during allocation. | ||
| * [X] `CL_SVM_INFO_CAPABILITIES_KHR` - must match the device capabilities for the explicit `device` parameter, or be a super-set of the platform capabilities otherwise. | ||
| * [X] `CL_SVM_INFO_PROPERTIES_KHR` - must match the properties passed during allocation, unless the properties during allocation were `NULL`. | ||
| * [X] `CL_SVM_INFO_ACCESS_FLAGS_KHR` - must match the access flags passed during allocation, or be zero. | ||
| * [X] `CL_SVM_INFO_BASE_PTR_KHR` - must match the base of the allocation. | ||
| * [X] `CL_SVM_INFO_SIZE_KHR` - must match the size passed during allocation. | ||
| * [X] `CL_SVM_INFO_ASSOCIATED_DEVICE_HANDLE_KHR` - must match the associated device, or be `NULL`. | ||
| * Test each of the queries for a bogus pointer (both with and without an explicit `device` parameter?). | ||
| * [X] `CL_SVM_INFO_TYPE_INDEX_KHR` - must return `CL_UINT_MAX`. | ||
| * [X] `CL_SVM_INFO_CAPABILITIES_KHR` - must return `0`. | ||
| * [X] `CL_SVM_INFO_PROPERTIES_KHR` - must return size equal to `0`. | ||
| * [X] `CL_SVM_INFO_ACCESS_FLAGS_KHR` - must return `0`? See doc issue. | ||
| * [X] `CL_SVM_INFO_BASE_PTR_KHR` - must return `NULL`. | ||
| * [X] `CL_SVM_INFO_SIZE_KHR` - must return `0`. | ||
| * [X] `CL_SVM_INFO_ASSOCIATED_DEVICE_HANDLE_KHR` - must return `NULL`. | ||
| * `clGetSVMSuggestedTypeIndexKHR` | ||
| * [X] Pass each of the supported device capabilities as `required_capabilities` and verify that the capabilities at `suggested_type_index` satisfy the required capabilities. | ||
| * [X] Test without a `CL_SVM_ALLOC_ALIGNMENT_KHR` property. | ||
| * [X] Test without a `CL_SVM_ALLOC_ACCESS_FLAGS_KHR` property. | ||
| * [X] For SVM types supporting `CL_SVM_CAPABILITY_DEVICE_UNASSOCIATED_KHR`, test without a `CL_SVM_ALLOC_ASSOCIATED_DEVICE_HANDLE_KHR` device. | ||
| * [X] Test with varying the `CL_SVM_ALLOC_ALIGNMENT_KHR` property - all powers of two from 1 to 128? | ||
| * [X] Test with varying the `CL_SVM_ALLOC_ACCESS_FLAGS_KHR` property - all combinations? | ||
| * [X] Include at least one test with all properties: `CL_SVM_ALLOC_ASSOCIATED_DEVICE_HANDLE_KHR` plus `CL_SVM_ALLOC_ALIGNMENT_KHR` plus `CL_SVM_ALLOC_ACCESS_FLAGS_KHR`. | ||
|
|
||
| NOTE: Added by https://github.com/KhronosGroup/OpenCL-CTS/pull/2261. | ||
| NOTE: Added by https://github.com/KhronosGroup/OpenCL-CTS/pull/2280. | ||
| NOTE: Added by https://github.com/KhronosGroup/OpenCL-CTS/pull/2338. | ||
| NOTE: Added by https://github.com/KhronosGroup/OpenCL-CTS/pull/2436. | ||
|
|
||
| ### Testing Existing SVM APIs | ||
|
|
||
| * `clSetKernelExecInfo(CL_KERNEL_EXEC_INFO_SVM_PTRS)` | ||
| * [X] Follow similar methodology as `CL_SVM_CAPABILITY_INDIRECT_ACCESS_KHR`, except set the indirectly accessed allocation explicitly. | ||
| * [X] Test a pointer offset from the base pointer and verify that the entire allocation may be accessed indirectly. | ||
| * [X] Pass an empty set and verify that this is not an error. | ||
| * [X] Pass a `NULL` pointer verify that this is not an error. | ||
| * [X] Pass a bogus pointer verify that this is not an error. | ||
| * `clSetKernelArgSVMPointer` | ||
| * Generally do not need a targeted test, because this API will be exercised by any tests using SVM pointers in kernels. | ||
| * [X] Ensure at least one test for each SVM type passes a pointer offset from the base pointer and accesses it in a kernel. | ||
| * [X] Pass a `NULL` pointer, execute the kernel, and verify that no error occurs as long as the pointer is not dereferenced? | ||
| * [X] Pass a bogus pointer, execute the kernel, and verify that no error occurs as long as the pointer is not dereferenced? | ||
| * `clEnqueueSVMFree` (see: `test_enqueue_api.cpp`) | ||
| * [X] Include an event on the command and verify that the event type is `CL_COMMAND_SVM_FREE`. | ||
| * [X] Allocate memory for each type and verify that it can be freed asynchronously. | ||
| * [X] Pass an empty set and verify that this is not an error. | ||
| * [X] Pass a `NULL` pointer and verify that this is not an error. | ||
| * `clEnqueueSVMMemcpy` (see: `test_enqueue_api.cpp`) | ||
| * [X] Include an event on the command and verify that the event type is `CL_COMMAND_SVM_MEMCPY`. | ||
| * [X] Test all combinations of SVM pointer and host pointer sources and destinations. | ||
| * [X] Test a pointer offset from the base pointer as a memcpy source and destination. | ||
| * [ ] TODO: Check document issue 10 and consider copying to other devices or contexts. | ||
| * [X] Pass a `NULL` pointer and `size` equal to zero and verify that this is not an error, for both memcpy source and destination pointers. | ||
| * [X] Pass a bogus pointer and `size` equal to zero and verify that this is not an error, for both memcpy source and destination pointers. | ||
| * [X] For all SVM types, pass a valid pointer and `size` equal to zero and verify that this is not an error, for both memcpy source and destination pointers. | ||
| * `clEnqueueSVMMemFill` (see: `test_enqueue_api.cpp`) | ||
| * [X] Include an event on the command and verify that the event type is `CL_COMMAND_SVM_MEMCPY`. | ||
| * [X] Test multiple fill pattern sizes - all powers of two from 1 to 128 inclusive? | ||
| * [X] Test a pointer offset from the base pointer as a fill destination. | ||
| * [ ] TODO: Check document issue 9 and consider filling allocations for other devices or contexts. | ||
| * [X] Pass a `NULL` pointer and `size` equal to zero and verify that this is not an error. | ||
| * [X] Pass a bogus pointer and `size` equal to zero and verify that this is not an error. | ||
| * [X] For all SVM types, pass a valid pointer and `size` equal to zero and verify that this is not an error. | ||
| * `clEnqueueSVMMap` / `clEnqueueSVMUnmap` | ||
| * [X] Include an event on the command and verify that the event type is `CL_COMMAND_SVM_MAP` / `CL_COMMAND_SVM_UNMAP`. | ||
| * [X] Test all combinations of map flags: `CL_MAP_READ`, `CL_MAP_WRITE`, `CL_MAP_WRITE_INVALIDATE_REGION`, `CL_MAP_READ | CL_MAP_WRITE`. | ||
| * `clEnqueueSVMMigrateMem` | ||
| * [X] Include an event on the command and verify that the event type is `CL_COMMAND_SVM_MIGRATE_MEM`. | ||
| * [X] Test all combinations of migration flags: `0`, `CL_MIGRATE_MEM_OBJECT_HOST`, `CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED`, `CL_MIGRATE_MEM_OBJECT_HOST | CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED`. | ||
| * [X] Migrate an entire SVM allocation. | ||
| * [X] Migrate a subset of an SVM allocation, starting from the base pointer. | ||
| * [X] Migrate a subset of an SVM allocation, starting from a pointer offset from the base pointer. | ||
| * [X] Migrate a `NULL` pointer with `size` equal to zero and verify that this is not an error. | ||
| * [X] For all SVM types, migrate a valid pointer with `size` equal to zero and verify that this is not an error. | ||
|
|
||
| NOTE: Added by https://github.com/KhronosGroup/OpenCL-CTS/pull/2441. | ||
| NOTE: Added by https://github.com/KhronosGroup/OpenCL-CTS/pull/2436. | ||
|
|
||
| ### Non-Conventional Uses | ||
|
|
||
| Depending how these are resolved, they may create additional test items: | ||
|
|
||
| * [ ] TODO: `clCreateBuffer(CL_MEM_USE_HOST_PTR)`: Check document issue 20. | ||
| * [ ] TODO: `clCreateBuffer(CL_MEM_COPY_HOST_PTR)`: Check document issue 21. | ||
| * [ ] TODO: `clEnqueueReadBuffer` and `clEnqueueWriteBuffer` sources and destinations: Check document issue 22. | ||
| * [ ] TODO: `clEnqueueSVMMemFill`, etc. patterns: Check document issue 23. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't currently have any consistency checks for unified SVM capabilities and OpenCL 2.0 SVM capabilities (CL_DEVICE_SVM_CAPABILITIES). Should we add this? If so, do we want consistency checks in both directions, or in just one?
Regarding (1), an implementation could conceivably / theoretically want to expose OpenCL 2.0 SVM capabilities for backwards compatibility, but not support the same capabilities for newer code (that may only be checking for unified SVM capabilities). Is this a scenario we would want to support?
I cannot think of a reason an implementation would not want to do (2) off the top of my head.