KhronosGroup / KhronosGroup/OpenCL-Docs
Creating Memory Objects from Offset SVM Pointers
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 421
- Forks
- 132
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 11
Description
Found while considering memory objects created from SVM allocations for the unified SVM extension:
When a memory object is created from an SVM allocation and CL_MEM_USE_HOST_PTR, must the passed-in host_ptr be the exact pointer returned by clSVMAlloc, or may the passed-in host pointer be offset from the pointer returned by clSVMAlloc?
Note, unlike creating a sub-buffer, there are no documented alignment requirements when creating a memory object from an SVM allocation.
There are also no documented alignment requirements when creating a memory object from an ordinary host allocation with CL_MEM_USE_HOST_PTR, though in this case the implementation may make a copy of the data and only keep the host pointer up-to-date when the memory object is mapped. It is not clear that a copy is supported similarly when the memory object is created from an SVM allocation.
If the host_ptr must be the exact pointer returned by clSVMAlloc, what should the behavior be if the passed-in host pointer points into an SVM allocation but is offset from a the pointer returned by clSVMAlloc? Is this an error, or undefined behavior, or something else?
The only CTS tests that I found that create a memory object from an SVM allocation create the memory object from the exact pointer returned by clSVMAlloc, and not a pointer offset from the pointer returned by clSVMAlloc.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the OpenCL specification language for memory objects created from SVM allocations with CL_MEM_USE_HOST_PTR, then compare the existing CTS tests that use the exact clSVMAlloc pointer. Done means resolving the offset-pointer, alignment, and error or undefined-behavior semantics and documenting the decision in the relevant specification text.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100