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
@@ -472,11 +473,7 @@ Otherwise, `NULL` will be returned, and _errcode_ret_ will be set to one of the
472
473
** if no devices in _context_ support the SVM type specified by _svm_type_index_
473
474
** if a device associated with the SVM allocation does not support the SVM type specified by _svm_type_index_
474
475
* {CL_INVALID_VALUE}
475
-
** if _svm_type_index_ is greater than the number of SVM types supported the devices in _context_
476
-
* {CL_INVALID_BUFFER_SIZE}
477
-
// TODO: update depending on the updated queries for available SVM sizes:
478
-
** if _size_ is greater than {CL_DEVICE_MAX_MEM_ALLOC_SIZE} for any OpenCL device in _context_ that supports the specified SVM type
479
-
** if _size_ is greater than {CL_DEVICE_MAX_MEM_ALLOC_SIZE} for a device associated with the SVM allocation
476
+
** if _svm_type_index_ is greater than the number of SVM types supported by the devices in _context_
480
477
* {CL_OUT_OF_RESOURCES}
481
478
** if there is a failure to allocate resources required by the OpenCL
482
479
implementation on the device
@@ -486,6 +483,14 @@ Otherwise, `NULL` will be returned, and _errcode_ret_ will be set to one of the
486
483
487
484
TODO: Do we want to document any specific error conditions for invalid property values?
488
485
486
+
[NOTE]
487
+
====
488
+
When _context_ includes a device that supports {cl_khr_unified_svm_EXT}, _size_ may be zero and may exceed {CL_DEVICE_MAX_MEM_ALLOC_SIZE} for the device, for both {clSVMAlloc} and {clSVMAllocWithPropertiesKHR}.
489
+
490
+
When _size_ is zero, {clSVMAlloc} and {clSVMAllocWithPropertiesKHR} must return a `NULL` pointer and must not generate an error.
491
+
When _size_ exceeds {CL_DEVICE_MAX_MEM_ALLOC_SIZE}, the allocation may succeed and return a non-`NULL` pointer, or the allocation may fail and return a `NULL` pointer and an implementation-defined error code.
492
+
====
493
+
489
494
[[svm-alloc-properties-table]]
490
495
[caption="Table X. "]
491
496
.List of supported SVM allocation properties by {clSVMAllocWithPropertiesKHR}
@@ -1047,19 +1052,16 @@ Note that standard SYCL does not include a "rect" memcpy, though the https://git
1047
1052
If so, what should the upper limit be?
1048
1053
+
1049
1054
--
1050
-
*UNRESOLVED*:
1051
-
The upper limit is currently defined by {CL_DEVICE_MAX_MEM_ALLOC_SIZE} and if the allocation size exceeds this value then the error code {CL_INVALID_BUFFER_SIZE} is returned.
1052
-
1053
-
This behavior is consistent with {clSVMAlloc} (although {clSVMAlloc} does not return an error code it is specified to return a `NULL` pointer in this case) and {clCreateBuffer}.
1054
-
However, for host allocations, some implementations are able to support larger allocation sizes.
1055
+
`RESOLVED`:
1056
+
This extension will not define an upper limit on the size of an SVM allocation.
1057
+
Applications may discover the largest SVM allocation size experimentally or use implementation-defined mechanisms to determine the largest SVM allocation size.
1058
+
This is consistent with `malloc`, which also has no defined upper or lower bound on the amount of memory that may be allocated, although this is different than both the non-extended {clSVMAlloc} and {clCreateBuffer}, where the upper limit is defined by {CL_DEVICE_MAX_MEM_ALLOC_SIZE}.
1055
1059
1056
-
Possible resolutions:
1060
+
By defining no limit on the size of an SVM allocation, we leave the door open for future mechanisms to query the largest SVM allocation size.
1061
+
For example, we may add queries for the maximum device-owned or host-owned memory allocation sizes, or queries for each SVM type, or other more sophisticated queries.
1062
+
We also do not constrain the maximum SVM allocation size to {CL_DEVICE_MAX_MEM_ALLOC_SIZE}, especially for implementations that are able to support larger allocation sizes from host memory.
1057
1063
1058
-
* Add a new query representing the maximum device-owned and host-owned memory allocation sizes supported by the device, e.g. `CL_DEVICE_MAX_DEVICE_OWNED_MEM_ALLOC_SIZE_KHR` and `CL_DEVICE_MAX_HOST_OWNED_MEM_ALLOC_SIZE_KHR`.
1059
-
For some devices, these queries will return the same value as {CL_DEVICE_MAX_MEM_ALLOC_SIZE}, but for other devices the queries will return a larger value.
1060
-
For SVM memory types that are not device-owned or host-owned, the existing limits will continue to apply.
1061
-
* Relax the error behavior so implementations may return {CL_INVALID_BUFFER_SIZE}, but they would not be required to return an error if they support larger allocation sizes.
1062
-
* Do nothing and keep the existing error behavior.
1064
+
Note that for the non-extended {clSVMAlloc} and {clCreateBuffer}, {CL_DEVICE_MAX_MEM_ALLOC_SIZE} only defines an upper bound on the amount of memory that _may_ be allocated, and there is no guarantee that an allocation of this size will succeed, say due to prior memory allocations, or memory fragmentation, or any other reason.
0 commit comments