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
<td>This API is available starting with revision 2 of this specification.
349
+
350
+
Construct a SYCL buffer instance from a pointer to a Level Zero memory allocation. The pointer must be the value returned from a previous call to <code>zeMemAllocShared()</code>, <code>zeMemAllocDevice()</code>, or <code>zeMemAllocHost()</code>. The input SYCL context <code>Context</code> must be associated with a single device, matching the device used at the prior allocation.
351
+
The <code>Context</code> argument must be a valid SYCL context encapsulating a Level-Zero context, and the Level-Zero memory must be allocated on the same context. Created SYCL buffer can be accessed in another contexts, not only in the provided input context.
352
+
The <code>Ownership</code> input structure member specifies if the SYCL runtime should take ownership of the passed native handle. The default behavior is to transfer the ownership to the SYCL runtime. See section 4.4 for details. If the behavior is "transfer" then the runtime is going to free the input Level-Zero memory allocation.
353
+
Synchronization rules for a buffer that is created with this API are described in Section 4.5</td>
<td>This API is available starting with revision 2 of this specification.
365
+
366
+
Construct a SYCL buffer instance from a pointer to a Level Zero memory allocation. Please refer to <code>make_buffer</code>
367
+
description above for semantics and restrictions.
368
+
The additional <code>AvailableEvent</code> argument must be a valid SYCL event. The instance of the SYCL buffer class template being constructed must wait for the SYCL event parameter to signal that the memory native handle is ready to be used.
297
369
</tr>
298
370
</table>
299
371
@@ -349,6 +421,15 @@ Applications must make sure that the Level-Zero handles themselves aren't used s
349
421
Practically speaking, and taking into account that SYCL runtime takes ownership of the Level-Zero handles,
350
422
the application should not attempt further direct use of those handles.
A SYCL buffer that is constructed with this interop API uses the Level Zero memory allocation for its full lifetime, and the contents of the Level Zero memory allocation are unspecified for the lifetime of the SYCL buffer. If the application modifies the contents of that Level Zero memory allocation during the lifetime of the SYCL buffer, the behavior is undefined. The initial contents of the SYCL buffer will be the initial contents of the Level Zero memory allocation at the time of the SYCL buffer's construction.
427
+
428
+
The behavior of the SYCL buffer destructor depends on the Ownership flag. As with other SYCL buffers, this behavior is triggered only when the last reference count to the buffer is dropped, as described in the core SYCL specification section 4.7.2.3, "Buffer synchronization rules".
429
+
430
+
* If the ownership is keep (i.e. the application retains ownership of the Level Zero memory allocation), then the SYCL buffer destructor blocks until all work in queues on the buffer have completed. The buffer's contents is not copied back to the Level Zero memory allocation.
431
+
* If the ownership is transfer (i.e. the SYCL runtime has ownership of the Level Zero memory allocation), then the SYCL buffer destructor does not need to block even if work on the buffer has not completed. The SYCL runtime frees the Level Zero memory allocation asynchronously when it is no longer in use in queues.
432
+
352
433
## 5 Level-Zero additional functionality
353
434
354
435
### 5.1 Device Information Descriptors
@@ -403,3 +484,4 @@ struct free_memory {
403
484
|5|2021-07-25|Sergey Maslov|Introduced SYCL interop for events
404
485
|6|2021-08-30|Dmitry Vodopyanov|Updated according to SYCL 2020 reqs for extensions
405
486
|7|2021-09-13|Sergey Maslov|Updated according to SYCL 2020 standard
487
+
|8|2022-01-06|Artur Gainullin|Introduced make_buffer() API
0 commit comments