You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fine-grain control over ownership and accessibility of OpenCL allocations, to optimally choose between performance and programmer convenience.
77
77
* A simpler programming model, by automatically migrating some allocations between OpenCL devices and the host.
78
78
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
+
79
98
== New API Functions
80
99
81
100
[source]
@@ -107,6 +126,10 @@ cl_int clMemFreeINTEL(
107
126
cl_context context,
108
127
void* ptr);
109
128
129
+
cl_int clMemBlockingFreeINTEL(
130
+
cl_context context,
131
+
void* ptr);
132
+
110
133
cl_int clGetMemAllocInfoINTEL(
111
134
cl_context context,
112
135
const void* ptr,
@@ -570,28 +593,34 @@ Otherwise, `NULL` will be returned, and _errcode_ret_ will be set to one of the
570
593
571
594
===== Freeing Allocations
572
595
573
-
The function
596
+
The functions
574
597
575
598
[source]
576
599
----
577
600
cl_int clMemFreeINTEL(
578
601
cl_context context,
579
602
void* ptr);
603
+
604
+
cl_int clMemBlockingFreeINTEL(
605
+
cl_context context,
606
+
void* ptr);
580
607
----
581
608
582
-
frees a Unified Shared Memory allocation.
609
+
free a Unified Shared Memory allocation.
583
610
584
611
_context_ is a valid OpenCL context used to free the Unified Shared Memory allocation.
585
612
586
613
_ptr_ is the Unified Shared Memory allocation to free.
587
614
It must be a value returned by *clHostMemAllocINTEL*, *clDeviceMemAllocINTEL*, or *clSharedMemAllocINTEL*, or a `NULL` pointer.
588
615
If _ptr_ is `NULL` then no action occurs.
589
616
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_.
591
618
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.
592
621
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:
595
624
596
625
* `CL_INVALID_CONTEXT` if _context_ is not a valid context.
597
626
* `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:
986
1015
* `CL_INVALID_COMMAND_QUEUE` if _command_queue_ is not a valid host command-queue.
987
1016
* `CL_INVALID_CONTEXT` if the context associated with _command_queue_ and events in _event_wait_list_ are not the same.
988
1017
* `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_.
990
1019
* `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.
991
1020
* `CL_OUT_OF_RESOURCES` if there is a failure to allocate resources required by the OpenCL implementation on the device.
992
1021
* `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`.
1220
1249
|M|2020-01-17|Ben Ashbaugh|Minor name changes, removed const from memfree API.
0 commit comments