KhronosGroup / KhronosGroup/OpenCL-Docs

Device Pointers for Memory Objects Created from SVM Allocations

Open
#1,368 2 comments 0 reactions 0 assignees View on GitHub
cl_khr_unified_svm
Dominant language
Python
Stars
420
Forks
131
Avg merge
5d 13h
Merged PRs (30d)
11

Description

Found while considering memory objects created from SVM allocations for the unified SVM extension:

The `cl_ext_buffer_device_address` extension added a requirement for memory objects (specifically, buffers) created from SVM allocations:

[CL_MEM_DEVICE_PRIVATE_ADDRESS_EXT](https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#CL_MEM_DEVICE_PRIVATE_ADDRESS_EXT):

> If the device supports SVM and [clCreateBufferWithProperties](https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#clCreateBufferWithProperties) is called with a pointer returned by [clSVMAlloc](https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#clSVMAlloc) as its host_ptr argument, and [CL_MEM_USE_HOST_PTR](https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#CL_MEM_USE_HOST_PTR) is set in its flags argument, the device-side address is guaranteed to match the host_ptr.

Is this a requirement in general for a memory object that was created from an SVM allocation, even without the buffer device address extension? Specifically, if a memory object is created from an SVM allocation on the host, and then the memory object (note: the memory object, not the SVM pointer!) is set as a kernel argument, is the value of the pointer on the device guaranteed to have the same value as the SVM allocation on the host, or may it have a different value?

There is a CTS test that maps the memory object and ensures that the mapped pointer has the same value as the SVM allocation, but this is subtly different, because this is checking the value of the mapped pointer on the host rather than the value of the pointer on the device.

https://github.com/KhronosGroup/OpenCL-CTS/blob/9fc0d23b4cfccd84be8927363a77107dc554de30/test_conformance/SVM/test_allocate_shared_buffer.cpp#L99

I did not find any other existing CTS tests checking for anything similar.

Contributor guide

Open the contributing guide

Research direction

Start by reading the CL_MEM_DEVICE_PRIVATE_ADDRESS_EXT, clCreateBufferWithProperties, and clSVMAlloc sections linked in the issue, then inspect test_conformance/SVM/test_allocate_shared_buffer.cpp around line 99. Compare the existing mapped-pointer check with the device-side kernel-argument question; done means the specification requirement is resolved and any needed CTS coverage is identified.

Written by the indexing model from the issue text.

Assessment

Domain
documentation, testing
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.