|
| 1 | +cl_intel_mem_alloc_buffer_location |
| 2 | +================================== |
| 3 | + |
| 4 | +// This section needs to be after the document title. |
| 5 | +:doctype: book |
| 6 | +:toc2: |
| 7 | +:toc: left |
| 8 | +:encoding: utf-8 |
| 9 | +:lang: en |
| 10 | + |
| 11 | +:blank: pass:[ +] |
| 12 | + |
| 13 | +// Set the default source code type in this document to C++, |
| 14 | +// for syntax highlighting purposes. This is needed because |
| 15 | +// docbook uses c++ and html5 uses cpp. |
| 16 | +:language: {basebackend@docbook:c++:cpp} |
| 17 | + |
| 18 | +Name Strings |
| 19 | +------------ |
| 20 | + |
| 21 | ++cl_intel_mem_alloc_buffer_location+ |
| 22 | + |
| 23 | +Contact |
| 24 | +------- |
| 25 | + |
| 26 | +Peter Colberg, Intel (peter 'dot' colberg 'at' intel 'dot' com) |
| 27 | + |
| 28 | +Contributors |
| 29 | +------------ |
| 30 | + |
| 31 | +* Sherry Yuan, Intel |
| 32 | +* Michael Kinsner, Intel |
| 33 | +* Joseph Garvey, Intel |
| 34 | +* Ben Ashbaugh, Intel |
| 35 | +* Aditi Kumaraswamy, Intel |
| 36 | +* Peter Colberg, Intel |
| 37 | +* Tanner Young-Schultz, Intel |
| 38 | +* Zibai Wang, Intel |
| 39 | +
|
| 40 | +Notice |
| 41 | +------ |
| 42 | + |
| 43 | +Copyright (c) 2020-2021 Intel Corporation. All rights reserved. |
| 44 | + |
| 45 | +Status |
| 46 | +------ |
| 47 | + |
| 48 | +Final Draft |
| 49 | + |
| 50 | +Version |
| 51 | +------- |
| 52 | + |
| 53 | +[width="40%",cols="25,25"] |
| 54 | +|======================================== |
| 55 | +| Last Modified | 2021-12-01 |
| 56 | +| Revision | 1 |
| 57 | +|======================================== |
| 58 | + |
| 59 | +Dependencies |
| 60 | +------------ |
| 61 | + |
| 62 | +This extension is written against the OpenCL Specification Version 1.0, Revision 48. |
| 63 | + |
| 64 | +This extension requires OpenCL 3.0 or later, and/or the cl_intel_create_buffer_with_properties extension if user wish to use this property via extension functions. |
| 65 | + |
| 66 | +Overview |
| 67 | +-------- |
| 68 | + |
| 69 | +On some devices, global memory may be partitioned into disjoint regions. This may be to enable control over specific characteristics such as available bandwidths on memory interfaces, or performance on types of access patterns. |
| 70 | + |
| 71 | +This extension allows a user to explicitly specify the partition/region of global memory in which an allocation should reside, by passing an implementation defined numerical ID that identifies the region to the allocation function. |
| 72 | + |
| 73 | +*Example Usage* |
| 74 | + |
| 75 | +To pass the property into a buffer allocation: |
| 76 | + |
| 77 | +[source,c] |
| 78 | +---- |
| 79 | +cl_mem_properties_intel props[] = {CL_MEM_ALLOC_BUFFER_LOCATION_INTEL, 2, 0}; |
| 80 | +
|
| 81 | +cl_mem test_mem = clCreateBufferWithPropertiesINTEL( |
| 82 | + context, props, flags, |
| 83 | + size, NULL, |
| 84 | + &status); |
| 85 | +---- |
| 86 | + |
| 87 | +To pass the property into a usm allocation: |
| 88 | + |
| 89 | +[source,c] |
| 90 | +---- |
| 91 | +cl_mem_properties_intel property[3] = { |
| 92 | + CL_MEM_ALLOC_BUFFER_LOCATION_INTEL, 2, |
| 93 | + 0}; |
| 94 | +void *ptr = clDeviceMemAllocINTEL(context, device, property, size, alignment, &status); |
| 95 | +---- |
| 96 | + |
| 97 | +User can query the buffer location of the usm allocation by passing it into *clGetMemAllocInfoINTEL* |
| 98 | + |
| 99 | +[source,c] |
| 100 | +---- |
| 101 | +// Should return 2 given the previous allocation. |
| 102 | +clGetMemAllocInfoINTEL(context, ptr, CL_MEM_ALLOC_BUFFER_LOCATION_INTEL, sizeof(cl_uint), param_value, param_value_ret) |
| 103 | +---- |
| 104 | + |
| 105 | + |
| 106 | +New API Functions |
| 107 | +----------------- |
| 108 | + |
| 109 | +None. |
| 110 | + |
| 111 | +New API Enums |
| 112 | +------------- |
| 113 | + |
| 114 | +Accepted property for the _properties_ parameter to *clCreateBufferWithPropertiesINTEL*, *clCreateBufferWithProperties*, *clDeviceMemAllocINTEL*, *clSharedMemAllocINTEL*, *clHostMemAllocINTEL* to specify requested global memory type ID. |
| 115 | + |
| 116 | +It can be passed into *clGetMemAllocInfoINTEL* to get the buffer location of allocated usm memory, as well as *clGetMemObjectInfo* to get buffer location of the buffer. If no property was specified, then the ID corresponding to default global memory is returned. |
| 117 | + |
| 118 | +[source,c] |
| 119 | +---- |
| 120 | +#define CL_MEM_ALLOC_BUFFER_LOCATION_INTEL 0x419E |
| 121 | +---- |
| 122 | + |
| 123 | +Modifications to the OpenCL API Specification |
| 124 | +--------------------------------------------- |
| 125 | + |
| 126 | +(Add Table 5.X: *List of supported properties by clCreateBufferWithPropertiesINTEL* to the cl_intel_create_buffer_with_properties extension) :: |
| 127 | ++ |
| 128 | + |
| 129 | +[cols="1,1,4",options="header",width = "90%"] |
| 130 | +|==== |
| 131 | +| cl_mem_properties_intel enum |
| 132 | +| Property value |
| 133 | +| Description |
| 134 | + |
| 135 | +| +CL_MEM_ALLOC_BUFFER_LOCATION_INTEL+ |
| 136 | +| +cl_uint+ |
| 137 | +| Identifies the ID of global memory partition to which the memory should be allocated. The range of legal values is implementation defined. If the value is not valid, or the implementation is unable to allocate memory in the requested memory type, an `CL_INVALID_PROPERTY` error will be emitted. |
| 138 | +|==== |
| 139 | + |
| 140 | +[[cl_mem_info_intel]] |
| 141 | +.List of supported param_names by clGetMemAllocInfoINTEL |
| 142 | +[width="100%",cols="<34%,<33%,<33%",options="header"] |
| 143 | +|==== |
| 144 | +| *cl_mem_info_intel* | Return type | Info. returned in _param_value_ |
| 145 | +| `CL_MEM_ALLOC_BUFFER_LOCATION_INTEL` |
| 146 | + | cl_uint |
| 147 | + | Returns buffer location for the Unified Shared Memory allocation. |
| 148 | + |
| 149 | + Return the ID of default global memory if no buffer location property were specified. |
| 150 | +|==== |
| 151 | + |
| 152 | +Interactions with Other Extensions |
| 153 | +---------------------------------- |
| 154 | +
|
| 155 | +If `cl_intel_unified_shared_memory` is supported then *clDeviceMemAllocINTEL*, *clSharedMemAllocINTEL*, *clHostMemAllocINTEL*, *clGetMemAllocInfoINTEL* also |
| 156 | +accepts `CL_MEM_ALLOC_BUFFER_LOCATION_INTEL` for _cl_mem_properties_intel_. |
| 157 | +
|
| 158 | +If `cl_intel_create_buffer_with_properties` is supported then *clCreateBufferWithPropertiesINTEL* also |
| 159 | +accepts `CL_MEM_ALLOC_BUFFER_LOCATION_INTEL` for _cl_mem_properties_intel_. |
| 160 | +
|
| 161 | +Issues |
| 162 | +------ |
| 163 | + |
| 164 | +None. |
| 165 | + |
| 166 | +Revision History |
| 167 | +---------------- |
| 168 | +
|
| 169 | +[cols="5,15,15,70"] |
| 170 | +[grid="rows"] |
| 171 | +[options="header"] |
| 172 | +|======================================== |
| 173 | +|Rev|Date|Author|Changes |
| 174 | +|1|2021-12-01|Sherry Yuan|*Initial public release* |
| 175 | +|======================================== |
0 commit comments