KhronosGroup / KhronosGroup/OpenCL-Docs
clEnqueueSVMMigrateMem for system SVM allocations
- Dominant language
- Python
- Stars
- 420
- Forks
- 131
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 11
Description
Hi everybody,
While working on the implementation of `clEnqueueSVMMigrateMem` in mesa we hit the issue that apparently it's not allowed to use this function for system SVM allocations.
The most likely reason for that is, that omitting the size for an allocation could lead to weird side effects and might not even be something a runtime could reliably implement.
But we were wondering if the spec could be rewritten in a way that it's legal to call it for SVM pointers not generated by `clSvmAlloc` by requiring a size for such pointers.
To allow this the following changes to the specifications are proposed.
Any thoughts?
```asciidoc
=== Modifications to Section 5.6.1 - "SVM sharing granularity: coarse- and fine- grained sharing"
Replace the _svm_pointers_ and _sizes_ descriptions of `clEnqueueSVMMigrateMem`
with the following:
* _svm_pointers_ is a pointer to an array of pointers.
* _sizes_ is an array of sizes.
The pair _svm_pointers_[i] and _sizes_[i] together define the starting
address and number of bytes in a range to be migrated.
_sizes_ may be `NULL` if all _svm_pointers_[i] are within allocations
produced by a call to {clSVMAlloc} indicating that every allocation
containing any _svm_pointers_[i] is to be migrated.
Also, if _svm_pointers_[i] is within an allocation produced by
{clSVMAlloc}, _sizes_[i] may be zero to migrate the entire allocation
containing _svm_pointers_[i].
Changes to the error conditions to `clEnqueueSVMMigrateMem`:
Add
* {CL_INVALID_VALUE} if _sizes_ is `NULL` and any _svm_pointers_[i] is not
within an allocation produced by a call to {clSVMAlloc}.
* {CL_INVALID_VALUE} if _sizes_[i] is zero and _svm_pointers_[i] is not
within an allocation produced by a call to {clSVMAlloc}.
Replace
* {CL_INVALID_VALUE} if _sizes_[i] is non-zero range [_svm_pointers_[i],
_svm_pointers_[i]+_sizes_[i]) is not contained within an existing
{clSVMAlloc} allocation.
with
* {CL_INVALID_VALUE} if _sizes_[i] is non-zero range [_svm_pointers_[i],
_svm_pointers_[i]+_sizes_[i]) is crossing boundaries of existing
{clSVMAlloc} allocations.
```
Contributor guide
Research direction
Locate the source for Section 5.6.1 and the clEnqueueSVMMigrateMem specification, then compare the current pointer, size, and error-condition text with this proposal. Done means the specification changes have been reviewed and the agreed wording is reflected in the project’s spec source.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100