Skip to content

Commit f7cf289

Browse files
authored
Update CL USM Extension from Rev O to Rev Q (#1315)
Signed-off-by: Ben Ashbaugh <[email protected]>
1 parent 82cb6d8 commit f7cf289

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ If you are interested in using this feature in your software product, please let
6060
== Version
6161

6262
Built On: {docdate} +
63-
Revision: O
63+
Revision: Q
6464

6565
== Dependencies
6666

@@ -76,6 +76,25 @@ Unified Shared Memory provides:
7676
* Fine-grain control over ownership and accessibility of OpenCL allocations, to optimally choose between performance and programmer convenience.
7777
* A simpler programming model, by automatically migrating some allocations between OpenCL devices and the host.
7878

79+
While Unified Shared Memory (USM) shares many features with Shared Virtual Memory (SVM), Unified Shared Memory provides a different mix of capabilities and control.
80+
Specifically:
81+
82+
* The matrix of USM capabilities supports combinations of features beyond the SVM capability queries.
83+
84+
* USM provides explicit control over memory placement and migration by supporting host allocations with wide visibility, devices allocations for best performance, and shared allocations that may migrate between devices and the host.
85+
86+
* USM allocations may be associated with both a device and a context.
87+
The USM allocation APIs support additional memory flags and optional properties to affect how memory is allocated and migrated.
88+
89+
* There is no need for APIs to map or unmap USM allocations, because host accessible USM allocations do not need to be mapped or unmapped to access the contents of a USM allocation on the host.
90+
91+
* An application may indicate that a kernel may access categories of USM allocations indirectly, without passing a set of all indirectly accessed USM allocations to the kernel, improving usability and reducing driver overhead for kernels that access many USM allocations.
92+
93+
* USM adds API functions to query properties of a USM allocation and to provide memory advice for an allocation.
94+
95+
Unified Shared Memory and Shared Virtual Memory can and will coexist for many implementations.
96+
All implementations that support Shared Virtual Memory may support at least some types of Unified Shared Memory.
97+
7998
== New API Functions
8099

81100
[source]
@@ -107,6 +126,10 @@ cl_int clMemFreeINTEL(
107126
cl_context context,
108127
void* ptr);
109128
129+
cl_int clMemBlockingFreeINTEL(
130+
cl_context context,
131+
void* ptr);
132+
110133
cl_int clGetMemAllocInfoINTEL(
111134
cl_context context,
112135
const void* ptr,
@@ -570,28 +593,34 @@ Otherwise, `NULL` will be returned, and _errcode_ret_ will be set to one of the
570593

571594
===== Freeing Allocations
572595

573-
The function
596+
The functions
574597

575598
[source]
576599
----
577600
cl_int clMemFreeINTEL(
578601
cl_context context,
579602
void* ptr);
603+
604+
cl_int clMemBlockingFreeINTEL(
605+
cl_context context,
606+
void* ptr);
580607
----
581608

582-
frees a Unified Shared Memory allocation.
609+
free a Unified Shared Memory allocation.
583610

584611
_context_ is a valid OpenCL context used to free the Unified Shared Memory allocation.
585612

586613
_ptr_ is the Unified Shared Memory allocation to free.
587614
It must be a value returned by *clHostMemAllocINTEL*, *clDeviceMemAllocINTEL*, or *clSharedMemAllocINTEL*, or a `NULL` pointer.
588615
If _ptr_ is `NULL` then no action occurs.
589616

590-
Note that *clMemFreeINTEL* does not wait for previously enqueued commands that may be using _ptr_ to finish before freeing _ptr_.
617+
Note that *clMemFreeINTEL* may not wait for previously enqueued commands that may be using _ptr_ to finish before freeing _ptr_.
591618
It is the responsibility of the application to make sure enqueued commands that use _ptr_ are complete before freeing _ptr_.
619+
Applications should take particular care freeing memory allocations with kernels that may access memory indirectly, since a kernel with indirect memory access counts as using all memory allocations of the specified type or types.
620+
To wait for previously enqueued commands to finish that may be using _ptr_ before freeing _ptr_, use the *clMemBlockingFreeINTEL* function instead.
592621

593-
*clMemFreeINTEL* will return `CL_SUCCESS` if the function executes successfully.
594-
Otherwise, it will return one of the following error values:
622+
*clMemFreeINTEL* and *clMemBlockingFreeINTEL* will return `CL_SUCCESS` if the function executes successfully.
623+
Otherwise, they will return one of the following error values:
595624

596625
* `CL_INVALID_CONTEXT` if _context_ is not a valid context.
597626
* `CL_INVALID_VALUE` if _ptr_ is not a value returned by *clHostMemAllocINTEL*, *clDeviceMemAllocINTEL*, *clSharedMemAllocINTEL*, or a `NULL` pointer.
@@ -986,7 +1015,7 @@ Otherwise, it will return one of the following errors:
9861015
* `CL_INVALID_COMMAND_QUEUE` if _command_queue_ is not a valid host command-queue.
9871016
* `CL_INVALID_CONTEXT` if the context associated with _command_queue_ and events in _event_wait_list_ are not the same.
9881017
* `CL_INVALID_VALUE` **TODO**, are any values of _ptr_ and _size_ considered invalid?
989-
* `CL_INVALID_VALUE` if _advice_ is zero or is not supported advice for the device associated with _command_queue_.
1018+
* `CL_INVALID_VALUE` if _advice_ is not supported advice for the device associated with _command_queue_.
9901019
* `CL_INVALID_EVENT_WAIT_LIST` if _event_wait_list_ is `NULL` and _num_events_in_wait_list_ is greater than zero, or if _event_wait_list_ is not `NULL` and _num_events_in_wait_list_ is zero, or if event objects in _event_wait_list_ are not valid events.
9911020
* `CL_OUT_OF_RESOURCES` if there is a failure to allocate resources required by the OpenCL implementation on the device.
9921021
* `CL_OUT_OF_HOST_MEMORY` if there is a failure to allocate resources required by the OpenCL implementation on the host.
@@ -1220,6 +1249,8 @@ Note that some flags will not be valid, such as `CL_MEM_USE_HOST_PTR`.
12201249
|M|2020-01-17|Ben Ashbaugh|Minor name changes, removed const from memfree API.
12211250
|N|2020-01-22|Ben Ashbaugh|Updated write combine description.
12221251
|O|2020-01-23|Ben Ashbaugh|Added aliases for USM migration flags.
1252+
|P|2020-02-28|Ben Ashbaugh|Added blocking memfree API.
1253+
|Q|2020-03-12|Ben Ashbaugh|Name tweak for blocking memfree API, added comparison to SVM, allow zero memory advice.
12231254
|========================================
12241255

12251256
//************************************************************************

0 commit comments

Comments
 (0)