KhronosGroup / KhronosGroup/OpenCL-Docs

Creating Memory Objects from Offset SVM Pointers

Open
#1,369 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cl_khr_unified_svm
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.