Skip to content

Commit 6e76414

Browse files
jbrodmanbader
authored andcommitted
Update CL USM Extension from Rev E to Rev G and update header (#690)
Signed-off-by: James Brodman <james.brodman@intel.com>
1 parent 7f16aa3 commit 6e76414

File tree

2 files changed

+45
-22
lines changed

2 files changed

+45
-22
lines changed

sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ If you are interested in using this feature in your software product, please let
5858
== Version
5959

6060
Built On: {docdate} +
61-
Revision: E
61+
Revision: G
6262

6363
== Dependencies
6464

@@ -201,7 +201,6 @@ Bitfield type and bits describing optional allocation properties for a Unified S
201201
----
202202
typedef cl_bitfield cl_mem_alloc_flags_intel;
203203
204-
#define CL_MEM_ALLOC_DEFAULT_INTEL 0
205204
#define CL_MEM_ALLOC_WRITE_COMBINED_INTEL (1 << 0)
206205
----
207206

@@ -215,9 +214,10 @@ typedef cl_uint cl_mem_info_intel;
215214
#define CL_MEM_ALLOC_TYPE_INTEL 0x419A
216215
#define CL_MEM_ALLOC_BASE_PTR_INTEL 0x419B
217216
#define CL_MEM_ALLOC_SIZE_INTEL 0x419C
218-
#define CL_MEM_ALLOC_INFO_TBD0_INTEL 0x419D /* reserved for future */
219-
#define CL_MEM_ALLOC_INFO_TBD1_INTEL 0x419E /* reserved for future */
220-
#define CL_MEM_ALLOC_INFO_TBD2_INTEL 0x419F /* reserved for future */
217+
#define CL_MEM_ALLOC_INFO_DEVICE_INTEL 0x419D
218+
/* CL_MEM_ALLOC_FLAGS_INTEL - defined above */
219+
#define CL_MEM_ALLOC_INFO_TBD0_INTEL 0x419E /* reserved for future */
220+
#define CL_MEM_ALLOC_INFO_TBD1_INTEL 0x419F /* reserved for future */
221221
----
222222

223223
Enumeration type and values describing the type of Unified Shared Memory allocation. Returned by *clGetMemAllocInfoINTEL* when _param_name_ is `CL_MEM_ALLOC_TYPE_INTEL`:
@@ -506,11 +506,13 @@ void* clSharedMemAllocINTEL(
506506
----
507507

508508
allocates Unified Shared Memory with shared ownership between the host and the specified OpenCL device.
509-
If the specified OpenCL device supports cross-device access capabilities, the allocation is also accessible to other OpenCL devices in the context that have the same cross-device access capabilities.
509+
If the specified OpenCL device supports cross-device access capabilities, the allocation is also accessible by other OpenCL devices in the context that have the same cross-device access capabilities.
510510

511511
_context_ is a valid OpenCL context used to allocate the Unified Shared Memory.
512512

513-
_device_ is a valid OpenCL device ID to associate with the allocation.
513+
_device_ is an optional OpenCL device ID to associate with the allocation.
514+
If _device_ is `NULL` then the allocation is not associated with any device.
515+
Allocations with no associated device are accessible by the host and OpenCL devices in the context that have cross-device access capabilities.
514516

515517
_properties_ is an optional list of allocation properties and their corresponding values.
516518
The list is terminated with the special property `0`.
@@ -575,9 +577,6 @@ The table below describes allocation properties that may be passed to control al
575577
| Flags specifying allocation and usage information.
576578
This is a bitfield type that may be set to any combination of the following values:
577579

578-
`CL_MEM_ALLOC_DEFAULT_INTEL`:
579-
Use the default allocation behavior.
580-
581580
`CL_MEM_ALLOC_WRITE_COMBINED_INTEL`:
582581
Request write combined (WC) memory.
583582
Write combined memory may improve performance in some cases, however write combined memory must be used with care since it may hurt performance in other cases or use different coherency protocols than non-write combined memory.
@@ -605,7 +604,6 @@ _context_ is a valid OpenCL context to query for information about the Unified S
605604

606605
_ptr_ is a pointer into a Unified Shared Memory allocation to query.
607606
_ptr_ need not be a value returned by *clHostMemAllocINTEL*, *clDeviceMemAllocINTEL*, or *clSharedMemAllocINTEL*, but the query may be faster if it is.
608-
TBD: What if _ptr_ is `NULL` or is not a pointer into a Unified Shared Memory allocation?
609607

610608
_param_name_ specifies the information to query.
611609
The list of supported _param_name_ values and the information returned in _param_value_ is described in the <<cl_mem_info_intel,Unified Memory Allocation Queries>> table.
@@ -637,17 +635,28 @@ Otherwise, it will return one of the following error values:
637635
Returns `CL_MEM_TYPE_HOST_INTEL` for allocations made by *clHostMemAllocINTEL* .
638636
Returns `CL_MEM_TYPE_DEVICE_INTEL` for allocations made by *clDeviceMemAllocINTEL*.
639637
Returns `CL_MEM_TYPE_SHARED_INTEL` for allocations made by *clSharedMemAllocINTEL*.
640-
Returns `CL_MEM_TYPE_UNKNOWN_INTEL` if the type of the Unified Shared Memory allocation cannot be determined, or if _ptr_ does not point into a Unified Shared Memory Allocation.
641-
| `CL_MEM_ALLOC_FLAGS_INTEL`
642-
| cl_mem_alloc_flags_intel
643-
| Returns allocation flags for the Unified Shared Memory allocation.
638+
Returns `CL_MEM_TYPE_UNKNOWN_INTEL` if the type of the Unified Shared Memory allocation cannot be determined or if _ptr_ does not point into a Unified Shared Memory allocation.
644639
| `CL_MEM_ALLOC_BASE_PTR_INTEL`
645640
| void*
646641
| Returns the base address of the Unified Shared Memory allocation.
642+
643+
Returns `NULL` for `CL_MEM_TYPE_UNKNOWN_INTEL` allocations.
647644
| `CL_MEM_ALLOC_SIZE_INTEL`
648645
| size_t
649646
| Returns the size in bytes of the Unified Shared Memory allocation.
650647

648+
Returns `0` for `CL_MEM_TYPE_UNKNOWN_INTEL` allocations.
649+
| `CL_MEM_ALLOC_DEVICE_INTEL`
650+
| cl_device_id
651+
| Returns the device associated with the Unified Shared Memory allocation.
652+
653+
Returns `NULL` for `CL_MEM_TYPE_HOST_INTEL` allocations, for `CL_MEM_TYPE_SHARED_INTEL` allocations with no associated device, and for `CL_MEM_TYPE_UNKNOWN_INTEL` allocations.
654+
| `CL_MEM_ALLOC_FLAGS_INTEL`
655+
| cl_mem_alloc_flags_intel
656+
| Returns allocation flags for the Unified Shared Memory allocation.
657+
658+
Returns `0` if no allocation flags were specified for the Unified Shared Memory allocation and for `CL_MEM_TYPE_UNKNOWN_INTEL` allocations.
659+
651660
|====
652661

653662
==== Using Unified Shared Memory with Kernels
@@ -952,10 +961,8 @@ The _flags_ argument was folded into the _properties_ in revision C.
952961
. What should behavior be for `clGetMemAllocInfoINTEL` if the passed-in _ptr_ is `NULL` or doesn't point into a USM allocation?
953962
+
954963
--
955-
*UNRESOLVED*:
956-
This could be an error, either `CL_INVALID_MEM_OBJECT` or some new error code.
957-
This could be valid when querying for `CL_MEM_ALLOC_TYPE_INTEL` (returning `CL_MEM_TYPE_UNKNOWN_INTEL`), but an error for other queries.
958-
We could spec behavior for all queries, meaning this is not an error.
964+
`RESOLVED`:
965+
The behavior was defined for all queries for this case in revision G.
959966
--
960967

961968
. Do we want separate "memset" APIs to set to different sized "value", such as 8-bits, 16-bits?, 32-bits, or others? Do we want to go back to a "fill" API?
@@ -1010,14 +1017,27 @@ This depends how frequently the migrate APIs are called.
10101017
. Could the _device_ argument to *clSharedMemAllocINTEL* be `NULL` if there is no need to associate the shared allocation to a specific device?
10111018
+
10121019
--
1013-
*UNRESOLVED*:
1020+
`RESOLVED`:
1021+
Yes, this case is documented in revision G.
10141022
--
10151023

10161024
. Should we allow querying the associated device for a USM allocation using *clGetMemAllocInfoINTEL*?
10171025
+
10181026
--
1027+
`RESOLVED`:
1028+
This query was added in revision G.
1029+
--
1030+
1031+
. Should we add explicit mem alloc flags for `CACHED` and `UNCACHED`?
1032+
+
1033+
--
1034+
*UNRESOLVED*:
1035+
--
1036+
1037+
. At least for HOST and SHARED allocations, should have separate mem alloc flags for the host and the device?
1038+
+
1039+
--
10191040
*UNRESOLVED*:
1020-
If we added this we'd need to specify what happens for host allocations or shared allocations with no associated device.
10211041
--
10221042

10231043
== TODO
@@ -1040,6 +1060,8 @@ If we added this we'd need to specify what happens for host allocations or share
10401060
|C|2019-06-18|Ben Ashbaugh|Moved flags argument into properties.
10411061
|D|2019-07-19|Ben Ashbaugh|Editorial fixes.
10421062
|E|2019-07-22|Ben Ashbaugh|Allocation properties should be const.
1063+
|F|2019-07-26|Ben Ashbaugh|Removed DEFAULT mem alloc flag.
1064+
|G|2019-08-23|Ben Ashbaugh|Added mem alloc query for associated device.
10431065
|========================================
10441066
10451067
//************************************************************************

sycl/include/CL/cl_usm_ext.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ typedef cl_uint cl_mem_info_intel;
5252
#define CL_MEM_ALLOC_TYPE_INTEL 0x419A
5353
#define CL_MEM_ALLOC_BASE_PTR_INTEL 0x419B
5454
#define CL_MEM_ALLOC_SIZE_INTEL 0x419C
55-
#define CL_MEM_ALLOC_INFO_TBD0_INTEL 0x419D /* reserved for future */
55+
#define CL_MEM_ALLOC_INFO_DEVICE_INTEL 0x419D
56+
/* CL_MEM_ALLOC_FLAGS_INTEL - defined above */
5657
#define CL_MEM_ALLOC_INFO_TBD1_INTEL 0x419E /* reserved for future */
5758
#define CL_MEM_ALLOC_INFO_TBD2_INTEL 0x419F /* reserved for future */
5859

0 commit comments

Comments
 (0)