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
Copy file name to clipboardExpand all lines: sycl/doc/extensions/LevelZeroBackend/LevelZeroBackend.md
+26-11Lines changed: 26 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -87,7 +87,7 @@ a SYCL object that encapsulates a corresponding Level-Zero object:
87
87
|-------------|:------------|
88
88
|``` make<platform>(ze_driver_handle_t);```|Constructs a SYCL platform instance from a Level-Zero ```ze_driver_handle_t```.|
89
89
|``` make<device>(const platform &, ze_device_handle_t);```|Constructs a SYCL device instance from a Level-Zero ```ze_device_handle_t```. The platform argument gives a SYCL platform, encapsulating a Level-Zero driver supporting the passed Level-Zero device.|
90
-
|``` make<context>(const vector_class<device> &, ze_context_handle_t);```| Constructs a SYCL context instance from a Level-Zero ```ze_context_handle_t```. The context is created against the devices passed in. There must be at least one device given and all the devices must be from the same SYCL platform and thus from the same Level-Zero driver.|
90
+
|``` make<context>(const vector_class<device> &, ze_context_handle_t, ownership = transfer);```| Constructs a SYCL context instance from a Level-Zero ```ze_context_handle_t```. The context is created against the devices passed in. There must be at least one device given and all the devices must be from the same SYCL platform and thus from the same Level-Zero driver. The ```ownership``` argument specifies if SYCL RT should take ownership of the passed native handle. The default behavior is to transfer the ownership to SYCL RT. See section 4.4 for details.|
91
91
|``` make<queue>(const context &, ze_command_queue_handle_t);```| Constructs a SYCL queue instance from a Level-Zero ```ze_command_queue_handle_t```. The context argument must be a valid SYCL context encapsulating a Level-Zero context. The queue is attached to the first device in the passed SYCL context.|
92
92
|``` make<program>(const context &, ze_module_handle_t);```| Constructs a SYCL program instance from a Level-Zero ```ze_module_handle_t```. The context argument must be a valid SYCL context encapsulating a Level-Zero context. The Level-Zero module must be fully linked (i.e. not require further linking through [```zeModuleDynamicLink```](https://spec.oneapi.com/level-zero/latest/core/api.html?highlight=zemoduledynamiclink#_CPPv419zeModuleDynamicLink8uint32_tP18ze_module_handle_tP28ze_module_build_log_handle_t)), and thus the SYCL program is created in the "linked" state.|
93
93
@@ -96,23 +96,37 @@ NOTE: We shall consider adding other interoperability as needed, if possible.
96
96
### 4.4 Level-Zero handles' ownership and thread-safety
97
97
98
98
The Level-Zero runtime doesn't do reference-counting of its objects, so it is crucial to adhere to these
99
-
practices of how Level-Zero handles are manged.
99
+
practices of how Level-Zero handles are manged. By default, the ownership us transferred to SYCL RT, but
100
+
some interoparability API supports overriding this behavior and keep the ownership in the application.
101
+
Use this enumeration for explicit specification of the ownership:
102
+
``` C++
103
+
enum ownership { transfer, keep };
104
+
```
100
105
101
-
#### 4.4.1 SYCL runtime takes ownership
106
+
#### 4.4.1 SYCL runtime takes ownership (default)
102
107
103
108
Whenever the application creates a SYCL object from the corresponding Level-Zero handle via one of the ```make<T>()``` functions,
104
-
the SYCL runtime takes ownership of the Level-Zero handle. The application must not use the Level-Zero handle after
105
-
the last host copy of the SYCL object is destroyed (as described in the core SYCL specification under
106
-
"Common reference semantics"), and the application must not destroy the Level-Zero handle itself.
109
+
the SYCL runtime takes ownership of the Level-Zero handle, if no explicit ```ownership::keep``` was specified.
110
+
The application must not use the Level-Zero handle after the last host copy of the SYCL object is destroyed (
111
+
as described in the core SYCL specification under "Common reference semantics"), and the application must not
0 commit comments