Skip to content

Commit

Permalink
cl_ext_buffer_device_address updates
Browse files Browse the repository at this point in the history
Changed the CL_MEM_DEVICE_ADDRESS_EXT wording for multi-device
cases "all", not "any", covering a case where not all devices
can ensure the same address across the context. In that case
CL_INVALID_VALUE can be returned.  Defined sub-buffer address
computation to be 'base_addr + origin'. Added error conditions
for clSetKernelExecInfo when the device doesn't support
device pointers.
  • Loading branch information
pjaaskel committed Sep 24, 2024
1 parent 6ae7260 commit 6ec48c4
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions extensions/cl_ext_buffer_device_address.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Draft.
== Version

Built On: {docdate} +
Revision: 0.1.0
Revision: 0.2.0

== Dependencies

Expand Down Expand Up @@ -147,7 +147,7 @@ Add new allocation flags <<clCreateBuffer, List of supported memory flag values
include::{generated}/api/version-notes/CL_MEM_DEVICE_ADDRESS_EXT.asciidoc[]
| This flag specifies that the buffer must have a single fixed address
for its lifetime and the address should be unique at least across the devices
of the context, but not necessarily withing the host (virtual) memory.
of the context, but not necessarily within the host (virtual) memory.

The flag might imply that the buffer will be "pinned" permanently to
a device's memory, but might not be necessarily so, as long as the address
Expand All @@ -158,18 +158,28 @@ include::{generated}/api/version-notes/CL_MEM_DEVICE_ADDRESS_EXT.asciidoc[]

The device-specific buffer content updates are still performed by
implicit or explicit buffer migrations performed by the runtime or the
client code. If any of the devices in the context does not support
client code. If all of the devices in the context do not support
this type of allocations, an error (CL_INVALID_VALUE) is returned.

The device addresses of sub-buffers derived from CL_MEM_DEVICE_ADDRESS_EXT
allocated buffers can be computed by adding the sub-buffer origin to the
start address.

| {CL_MEM_DEVICE_PRIVATE_EXT_anchor}

include::{generated}/api/version-notes/CL_MEM_DEVICE_PRIVATE_EXT.asciidoc[]
| If this flag is combined with CL_MEM_DEVICE_ADDRESS_EXT, each device in
the context can have their own (fixed) device-side address and copy of
the context can have their own (fixed) device-side address and a copy of
the created buffer which are synchronized implicitly by the runtime.
The main difference to a default cl_mem allocation in that case is then
that the addresses are queriable with CL_MEM_DEVICE_PTRS_EXT and the
per-device address is guaranteed to be the same for the entire lifetime
of the cl_mem.

The device addresses of sub-buffers derived from CL_MEM_DEVICE_PRIVATE_EXT
allocated buffers can be computed by adding the sub-buffer origin to the
device-specific start address.

|====

// refError
Expand Down Expand Up @@ -218,7 +228,7 @@ include::{generated}/api/version-notes/clSetKernelArgDevicePointerEXT.asciidoc[]
argument specified by _arg_index_.
The device pointer specified is the value used by all API calls that enqueue
_kernel_ ({clEnqueueNDRangeKernel} and {clEnqueueTask}) until the argument
value is changed by a call to {clSetKernelArgSVMPointer} for _kernel_.
value is changed by a call to {clSetKernelArgDevicePointer} for _kernel_.
The device pointer can only be used for arguments that are declared to be a
pointer to `global` memory allocated with clCreateBuffer() with the
CL_MEM_DEVICE_ADDRESS_EXT flag. The pointer value specified as the argument value
Expand Down Expand Up @@ -260,6 +270,14 @@ include::{generated}/api/version-notes/CL_KERNEL_EXEC_INFO_DEVICE_PTRS_EXT.ascii

// refError

Change the descriptions for when returning CL_INVALID_OPERATION from {clSetKernelExecInfo}
as follows:

* {CL_INVALID_OPERATION} if passing {CL_KERNEL_EXEC_INFO_SVM_PTRS} or
{CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM} with _param_value_ set to CL_TRUE
and no device in the context associated with _kernel_ support SVM.
* {CL_INVALID_OPERATION} if passing {CL_KERNEL_EXEC_INFO_DEVICE_PTRS_EXT} and no
device in the context associated with _kernel_ support device pointers.

== Interactions with Other Extensions

Expand All @@ -280,7 +298,15 @@ None.
[grid="rows"]
[options="header"]
|====
| *Version* | *Date* | *Author* | *Changes*
| *Version* | *Date* | *Author* | *Changes*
| 0.2.0 | 2024-09-09 | Pekka Jääskeläinen, Karol Herbst |
Changed the CL_MEM_DEVICE_ADDRESS_EXT wording for multi-device
cases "all", not "any", covering a case where not all devices
can ensure the same address across the context. In that case
CL_INVALID_VALUE can be returned. Defined sub-buffer address
computation to be 'base_addr + origin'. Added error conditions
for clSetKernelExecInfo when the device doesn't support
device pointers.
| 0.1.0 | 2024-05-07 | Pekka Jääskeläinen | First draft text for feedback.
This version describes the first API version that was prototyped
in PoCL and RustiCL using temporary placeholder flag/enum values.
Expand Down

0 comments on commit 6ec48c4

Please sign in to comment.