|
94 | 94 | // info query.
|
95 | 95 | // 12.32 Removed backwards compatibility of piextQueueCreateWithNativeHandle and
|
96 | 96 | // piextQueueGetNativeHandle
|
97 |
| - |
| 97 | +// 12.33 Added command-buffer extension methods |
98 | 98 | #define _PI_H_VERSION_MAJOR 13
|
99 |
| -#define _PI_H_VERSION_MINOR 32 |
| 99 | +#define _PI_H_VERSION_MINOR 33 |
100 | 100 |
|
101 | 101 | #define _PI_STRING_HELPER(a) #a
|
102 | 102 | #define _PI_CONCAT(a, b) _PI_STRING_HELPER(a.b)
|
@@ -474,6 +474,7 @@ typedef enum {
|
474 | 474 | PI_COMMAND_TYPE_SVM_MEMFILL = 0x120B,
|
475 | 475 | PI_COMMAND_TYPE_SVM_MAP = 0x120C,
|
476 | 476 | PI_COMMAND_TYPE_SVM_UNMAP = 0x120D,
|
| 477 | + PI_COMMAND_TYPE_EXT_COMMAND_BUFFER = 0x12A8, |
477 | 478 | PI_COMMAND_TYPE_DEVICE_GLOBAL_VARIABLE_READ = 0x418E,
|
478 | 479 | PI_COMMAND_TYPE_DEVICE_GLOBAL_VARIABLE_WRITE = 0x418F
|
479 | 480 | } _pi_command_type;
|
@@ -2100,6 +2101,144 @@ __SYCL_EXPORT pi_result piGetDeviceAndHostTimer(pi_device Device,
|
2100 | 2101 | uint64_t *DeviceTime,
|
2101 | 2102 | uint64_t *HostTime);
|
2102 | 2103 |
|
| 2104 | +/// Command buffer extension |
| 2105 | +struct _pi_ext_command_buffer; |
| 2106 | +struct _pi_ext_sync_point; |
| 2107 | +using pi_ext_command_buffer = _pi_ext_command_buffer *; |
| 2108 | +using pi_ext_sync_point = pi_uint32; |
| 2109 | + |
| 2110 | +typedef enum { |
| 2111 | + PI_EXT_STRUCTURE_TYPE_COMMAND_BUFFER_DESC = 0 |
| 2112 | +} pi_ext_structure_type; |
| 2113 | + |
| 2114 | +struct pi_ext_command_buffer_desc final { |
| 2115 | + pi_ext_structure_type stype; |
| 2116 | + const void *pNext; |
| 2117 | + pi_queue_properties *properties; |
| 2118 | +}; |
| 2119 | + |
| 2120 | +/// API to create a command-buffer. |
| 2121 | +/// \param context The context to associate the command-buffer with. |
| 2122 | +/// \param device The device to associate the command-buffer with. |
| 2123 | +/// \param desc Descriptor for the new command-buffer. |
| 2124 | +/// \param ret_command_buffer Pointer to fill with the address of the new |
| 2125 | +/// command-buffer. |
| 2126 | +__SYCL_EXPORT pi_result |
| 2127 | +piextCommandBufferCreate(pi_context context, pi_device device, |
| 2128 | + const pi_ext_command_buffer_desc *desc, |
| 2129 | + pi_ext_command_buffer *ret_command_buffer); |
| 2130 | + |
| 2131 | +/// API to increment the reference count of the command-buffer |
| 2132 | +/// \param command_buffer The command_buffer to retain. |
| 2133 | +__SYCL_EXPORT pi_result |
| 2134 | +piextCommandBufferRetain(pi_ext_command_buffer command_buffer); |
| 2135 | + |
| 2136 | +/// API to decrement the reference count of the command-buffer. After the |
| 2137 | +/// command_buffer reference count becomes zero and has finished execution, the |
| 2138 | +/// command-buffer is deleted. \param command_buffer The command_buffer to |
| 2139 | +/// release. |
| 2140 | +__SYCL_EXPORT pi_result |
| 2141 | +piextCommandBufferRelease(pi_ext_command_buffer command_buffer); |
| 2142 | + |
| 2143 | +/// API to stop command-buffer recording such that no more commands can be |
| 2144 | +/// appended, and makes the command-buffer ready to enqueue on a command-queue. |
| 2145 | +/// \param command_buffer The command_buffer to finalize. |
| 2146 | +__SYCL_EXPORT pi_result |
| 2147 | +piextCommandBufferFinalize(pi_ext_command_buffer command_buffer); |
| 2148 | + |
| 2149 | +/// API to append a kernel execution command to the command-buffer. |
| 2150 | +/// \param command_buffer The command-buffer to append onto. |
| 2151 | +/// \param kernel The kernel to append. |
| 2152 | +/// \param work_dim Dimension of the kernel execution. |
| 2153 | +/// \param global_work_offset Offset to use when executing kernel. |
| 2154 | +/// \param global_work_size Global work size to use when executing kernel. |
| 2155 | +/// \param local_work_size Local work size to use when executing kernel. |
| 2156 | +/// \param num_sync_points_in_wait_list The number of sync points in the |
| 2157 | +/// provided wait list. |
| 2158 | +/// \param sync_point_wait_list A list of sync points that this command must |
| 2159 | +/// wait on. |
| 2160 | +/// \param sync_point The sync_point associated with this kernel execution. |
| 2161 | +__SYCL_EXPORT pi_result piextCommandBufferNDRangeKernel( |
| 2162 | + pi_ext_command_buffer command_buffer, pi_kernel kernel, pi_uint32 work_dim, |
| 2163 | + const size_t *global_work_offset, const size_t *global_work_size, |
| 2164 | + const size_t *local_work_size, pi_uint32 num_sync_points_in_wait_list, |
| 2165 | + const pi_ext_sync_point *sync_point_wait_list, |
| 2166 | + pi_ext_sync_point *sync_point); |
| 2167 | + |
| 2168 | +/// API to append a USM memcpy command to the command-buffer. |
| 2169 | +/// \param command_buffer The command-buffer to append onto. |
| 2170 | +/// \param dst_ptr is the location the data will be copied |
| 2171 | +/// \param src_ptr is the data to be copied |
| 2172 | +/// \param size is number of bytes to copy |
| 2173 | +/// \param num_sync_points_in_wait_list The number of sync points in the |
| 2174 | +/// provided wait list. |
| 2175 | +/// \param sync_point_wait_list A list of sync points that this command must |
| 2176 | +/// wait on. |
| 2177 | +/// \param sync_point The sync_point associated with this memory operation. |
| 2178 | +__SYCL_EXPORT pi_result piextCommandBufferMemcpyUSM( |
| 2179 | + pi_ext_command_buffer command_buffer, void *dst_ptr, const void *src_ptr, |
| 2180 | + size_t size, pi_uint32 num_sync_points_in_wait_list, |
| 2181 | + const pi_ext_sync_point *sync_point_wait_list, |
| 2182 | + pi_ext_sync_point *sync_point); |
| 2183 | + |
| 2184 | +/// API to append a mem buffer copy command to the command-buffer. |
| 2185 | +/// \param command_buffer The command-buffer to append onto. |
| 2186 | +/// \param src_buffer is the data to be copied |
| 2187 | +/// \param dst_buffer is the location the data will be copied |
| 2188 | +/// \param src_offset offset into \p src_buffer |
| 2189 | +/// \param dst_offset offset into \p dst_buffer |
| 2190 | +/// \param size is number of bytes to copy |
| 2191 | +/// \param num_sync_points_in_wait_list The number of sync points in the |
| 2192 | +/// provided wait list. |
| 2193 | +/// \param sync_point_wait_list A list of sync points that this command must |
| 2194 | +/// wait on. |
| 2195 | +/// \param sync_point The sync_point associated with this memory operation. |
| 2196 | +__SYCL_EXPORT pi_result piextCommandBufferMemBufferCopy( |
| 2197 | + pi_ext_command_buffer command_buffer, pi_mem src_buffer, pi_mem dst_buffer, |
| 2198 | + size_t src_offset, size_t dst_offset, size_t size, |
| 2199 | + pi_uint32 num_sync_points_in_wait_list, |
| 2200 | + const pi_ext_sync_point *sync_point_wait_list, |
| 2201 | + pi_ext_sync_point *sync_point); |
| 2202 | + |
| 2203 | +/// API to append a rectangular mem buffer copy command to the command-buffer. |
| 2204 | +/// \param command_buffer The command-buffer to append onto. |
| 2205 | +/// \param src_buffer is the data to be copied |
| 2206 | +/// \param dst_buffer is the location the data will be copied |
| 2207 | +/// \param src_origin offset for the start of the region to copy in src_buffer |
| 2208 | +/// \param dst_origin offset for the start of the region to copy in dst_buffer |
| 2209 | +/// \param region The size of the region to be copied |
| 2210 | +/// \param src_row_pitch Row pitch for the src data |
| 2211 | +/// \param src_slice_pitch Slice pitch for the src data |
| 2212 | +/// \param dst_row_pitch Row pitch for the dst data |
| 2213 | +/// \param dst_slice_pitch Slice pitch for the dst data |
| 2214 | +/// \param num_sync_points_in_wait_list The number of sync points in the |
| 2215 | +/// provided wait list. |
| 2216 | +/// \param sync_point_wait_list A list of sync points that this command must |
| 2217 | +/// wait on. |
| 2218 | +/// \param sync_point The sync_point associated with this memory operation. |
| 2219 | +__SYCL_EXPORT pi_result piextCommandBufferMemBufferCopyRect( |
| 2220 | + pi_ext_command_buffer command_buffer, pi_mem src_buffer, pi_mem dst_buffer, |
| 2221 | + pi_buff_rect_offset src_origin, pi_buff_rect_offset dst_origin, |
| 2222 | + pi_buff_rect_region region, size_t src_row_pitch, size_t src_slice_pitch, |
| 2223 | + size_t dst_row_pitch, size_t dst_slice_pitch, |
| 2224 | + pi_uint32 num_sync_points_in_wait_list, |
| 2225 | + const pi_ext_sync_point *sync_point_wait_list, |
| 2226 | + pi_ext_sync_point *sync_point); |
| 2227 | + |
| 2228 | +/// API to submit the command-buffer to queue for execution, returns an error if |
| 2229 | +/// command-buffer not finalized or another instance of same command-buffer |
| 2230 | +/// currently executing. |
| 2231 | +/// \param command_buffer The command-buffer to be submitted. |
| 2232 | +/// \param queue The PI queue to submit on. |
| 2233 | +/// \param num_events_in_wait_list The number of events that this execution |
| 2234 | +/// depends on. |
| 2235 | +/// \param event_wait_list List of pi_events to wait on. |
| 2236 | +/// \param event The pi_event associated with this enqueue. |
| 2237 | +__SYCL_EXPORT pi_result |
| 2238 | +piextEnqueueCommandBuffer(pi_ext_command_buffer command_buffer, pi_queue queue, |
| 2239 | + pi_uint32 num_events_in_wait_list, |
| 2240 | + const pi_event *event_wait_list, pi_event *event); |
| 2241 | + |
2103 | 2242 | struct _pi_plugin {
|
2104 | 2243 | // PI version supported by host passed to the plugin. The Plugin
|
2105 | 2244 | // checks and writes the appropriate Function Pointers in
|
|
0 commit comments