Skip to content

Commit 4ae5ab5

Browse files
authored
cl_intel_unified_shared_memory version 1.1 (#905)
* relax error behavior for clSetKernelArgMemPointerINTEL * also relax error behavior for clSetKernelExecInfo(USM_PTRS) * add a new issue regarding sub-device accessibility * a few more wordsmithing fixes * further clarify what is meant by a valid pointer value * update XML version to 1.1
1 parent c59823c commit 4ae5ab5

File tree

2 files changed

+39
-28
lines changed

2 files changed

+39
-28
lines changed

extensions/cl_intel_unified_shared_memory.asciidoc

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Shipping
5252
== Version
5353

5454
Built On: {docdate} +
55-
Revision: 1.0.0
55+
Revision: 1.1.0
5656

5757
== Dependencies
5858

@@ -743,9 +743,19 @@ Arguments to the kernel are referred to by indices that go from 0 for the leftmo
743743

744744
_arg_value_ is the pointer value that should be used as the argument specified by _arg_index_.
745745
The pointer value will be used as the argument by all API calls that enqueue a kernel until the argument value is set to a different pointer value by a subsequent call.
746-
A pointer into Unified Shared Memory allocation may only be set as an argument value for an argument declared to be a pointer to `global` or `constant` memory.
746+
A pointer may only be set as an argument value for an argument declared to be a pointer to `global` or `constant` memory.
747+
748+
[[valid-usm-pointer-argument-definition]]
749+
The definition of a valid pointer value was changed in extension version 1.1.0:
750+
751+
* For extension versions prior to version 1.1.0:
747752
For devices supporting shared system allocations, any pointer value is valid.
748753
Otherwise, the pointer value must be `NULL` or must point into a Unified Shared Memory allocation returned by *clHostMemAllocINTEL*, *clDeviceMemAllocINTEL*, or *clSharedMemAllocINTEL*.
754+
* For extension versions 1.1.0 and newer:
755+
For all devices, any pointer value is valid and may be set as an argument to a kernel.
756+
757+
In this definition, a valid pointer value means that the function will not return an error.
758+
It still may not be valid to dereference the pointer inside of a kernel if the memory that the pointer points to is not accessible on the device.
749759

750760
*clSetKernelArgMemPointerINTEL* returns `CL_SUCCESS` if the function is executed successfully.
751761
Otherwise, it will return one of the following errors:
@@ -795,6 +805,8 @@ The following errors may be returned by *clSetKernelExecInfo* for these new _par
795805
* `CL_INVALID_OPERATION` if _param_name_ is `CL_KERNEL_EXEC_INFO_INDIRECT_DEVICE_ACCESS_INTEL` and no devices in the context associated with _kernel_ support device Unified Shared Memory allocations.
796806
* `CL_INVALID_OPERATION` if _param_name_ is `CL_KERNEL_EXEC_INFO_INDIRECT_SHARED_ACCESS_INTEL` and no devices in the context associated with _kernel_ support shared Unified Shared Memory allocations.
797807

808+
The <<valid-usm-pointer-argument-definition,definition of a valid pointer value>> specified using `CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL` was changed in extension version 1.1.0.
809+
798810
==== Filling and Copying Unified Shared Memory
799811

800812
The function
@@ -1243,21 +1255,27 @@ Note that some flags will not be valid, such as `CL_MEM_USE_HOST_PTR`.
12431255
. Should it be an error to set an unknown pointer as a kernel argument using *clSetKernelArgMemPointerINTEL* if no devices support shared system allocations?
12441256
+
12451257
--
1246-
*UNRESOLVED*:
1247-
Returning an error for an unknown pointer is helpful to identify and diagnose possible programming errors sooner, but passing a pointer to arbitrary memory to a function on the host is not an error until the pointer is dereferenced.
1258+
`RESOLVED`:
1259+
The behavior of *clSetKernelArgMemPointerINTEL* was changed in version 1.1.0 of this extension.
1260+
1261+
Prior to version 1.1.0, it was considered an error to set an arbitrary pointer value as an argument to a kernel if no devices support system USM.
1262+
This was helpful to identify possible programming errors, however it did not match the behavior of passing a pointer to a function on the host, where it is only a programming error if an invalid pointer is dereferenced.
1263+
To provide a similar programming experience, the error condition was relaxed in version 1.1.0, and any arbitrary pointer value may be passed to a kernel.
12481264

1249-
If we relax the error condition for *clSetKernelArgMemPointerINTEL* then we could also consider relaxing the error condition for *clSetKernelExecInfo*(`CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL`) similarly.
1265+
The behavior was also changed for *clSetKernelExecInfo*(`CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL`), similarly.
12501266

1251-
Note that if the error condition is removed we can still check for possible programming errors via optional USM checking layers, such as the https://github.com/intel/opencl-intercept-layer/blob/master/docs/controls.md#usmchecking-bool[USMChecking] functionality in the https://github.com/intel/opencl-intercept-layer[OpenCL Intercept Layer].
1267+
If desired, additional checks to identify possible programming errors may still be provided via optional USM checking layers, such as the https://github.com/intel/opencl-intercept-layer/blob/master/docs/controls.md#usmchecking-bool[USMChecking] functionality in the https://github.com/intel/opencl-intercept-layer[OpenCL Intercept Layer].
12521268
--
12531269

1254-
. Should we support a "rect" memcpy similar to *clEnqueueCopyBufferRect*?
1270+
. Should we support a 2D "rect" memcpy similar to *clEnqueueCopyBufferRect*?
12551271
+
12561272
--
12571273
*UNRESOLVED*:
12581274
This would be a fairly straightforward addition if it is useful.
12591275

1260-
Note that there is no similar SVM "rect" memcpy.
1276+
Note that there is no similar 2D "rect" memcpy for SVM.
1277+
1278+
We could also support a 2D "rect" fill or memset, though there are no similar functions for `cl_mem` buffers or SVM.
12611279
--
12621280

12631281
. Should there be an upper limit on the size of an allocation using *clHostMemAllocINTEL*?
@@ -1301,35 +1319,28 @@ Possible resolutions:
13011319
* Do nothing and keep the existing error behavior.
13021320
--
13031321

1322+
. Can a device USM allocation for a parent device be accessed by its sub-devices?
1323+
Can a single device shared USM allocation associated with a parent device be accessed by its sub-devices?
1324+
+
1325+
--
1326+
*UNRESOLVED*:
1327+
Since a sub-device is a partition of a parent device a USM allocation against a parent device should be accessible by its sub-devices.
1328+
We could document this expectation explicitly in this extension if it is not already covered by the main OpenCL specification.
1329+
1330+
Note that a USM allocation against a sub-device need not be accessible by its parent device or by other sibling sub-devices, though some implementations may support this, just like some implementations optionally support access to USM allocations from other devices.
1331+
--
1332+
13041333
== Revision History
13051334

13061335
[cols="5,15,15,70"]
13071336
[grid="rows"]
13081337
[options="header"]
13091338
|========================================
13101339
|Rev|Date|Author|Changes
1311-
|A|2019-01-18|Ben Ashbaugh|*Initial revision*
1312-
|B|2019-03-25|Ben Ashbaugh|Minor name changes.
1313-
|C|2019-06-18|Ben Ashbaugh|Moved flags argument into properties.
1314-
|D|2019-07-19|Ben Ashbaugh|Editorial fixes.
1315-
|E|2019-07-22|Ben Ashbaugh|Allocation properties should be const.
1316-
|F|2019-07-26|Ben Ashbaugh|Removed DEFAULT mem alloc flag.
1317-
|G|2019-08-23|Ben Ashbaugh|Added mem alloc query for associated device.
1318-
|H|2019-10-11|Ben Ashbaugh|Added initial list and description of error codes.
1319-
|I|2019-11-14|Ben Ashbaugh|Switched from a memset to a memfill API.
1320-
|J|2019-11-18|Ben Ashbaugh|Updated a few more error conditions.
1321-
|K|2019-12-18|Krzysztof Gibala|Updated write combine description.
1322-
|L|2020-01-15|Ben Ashbaugh|Added invalid arg case to setkernelarg API.
1323-
|M|2020-01-17|Ben Ashbaugh|Minor name changes, removed const from memfree API.
1324-
|N|2020-01-22|Ben Ashbaugh|Updated write combine description.
1325-
|O|2020-01-23|Ben Ashbaugh|Added aliases for USM migration flags.
1326-
|P|2020-02-28|Ben Ashbaugh|Added blocking memfree API.
1327-
|Q|2020-03-12|Ben Ashbaugh|Name tweak for blocking memfree API, added comparison to SVM, allow zero memory advice.
1328-
|R|2020-08-21|Ben Ashbaugh|Fixed enum name typo in table.
1329-
|S|2020-08-26|Maciej Dziuban|Added initial placement flags for shared allocations.
13301340
|1.0.0|2021-11-07|Ben Ashbaugh|Added version and other minor updates prior to posting on the OpenCL registry.
13311341
|1.0.0|2022-11-08|Ben Ashbaugh|Added new issues regarding error behavior for clSetKernelArgMemPointerINTEL and rect copies.
13321342
|1.0.1|2023-08-28|Ben Ashbaugh|Documented error conditions for clSetKernelExecInfo.
1343+
|1.1.0|2024-07-30|Ben Ashbaugh|Modified error behavior for clSetKernelArgMemPointerINTEL and clSetKernelExecInfo.
13331344
|========================================
13341345

13351346
//************************************************************************

xml/cl.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6696,7 +6696,7 @@ server's OpenCL/api-docs repository.
66966696
<command name="clCreateFromGLTexture3D"/>
66976697
</require>
66986698
</extension>
6699-
<extension name="cl_intel_unified_shared_memory" revision="0.0.0" comment="in sync with rev 1.0.0" supported="opencl">
6699+
<extension name="cl_intel_unified_shared_memory" revision="1.1.0" supported="opencl">
67006700
<require>
67016701
<type name="cl_device_unified_shared_memory_capabilities_intel"/>
67026702
<type name="cl_mem_properties_intel"/>

0 commit comments

Comments
 (0)