Skip to content

Commit 90792cd

Browse files
committed
address comments
Signed-off-by: Sergey V Maslov <[email protected]>
1 parent 1bfdd59 commit 90792cd

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

sycl/doc/extensions/LevelZeroBackend/LevelZeroBackend.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,15 @@ struct {
137137
std::vector<ze_module_handle_t>
138138
```
139139
</td>
140-
<td><pre>ze_module_handle_t</pre></td>
140+
<td>
141+
142+
``` C++
143+
struct {
144+
ze_module_handle_t NativeHandle;
145+
ext::oneapi::level_zero::ownership Ownership;
146+
}
147+
```
148+
</td>
141149
</tr>
142150
</table>
143151
@@ -226,7 +234,7 @@ make_kernel_bundle<backend::ext_oneapi_level_zero,
226234
const context &Context)
227235
```
228236
</td>
229-
<td>Constructs a SYCL kernel_bundle instance from a Level-Zero <code>ze_module_handle_t</code>. The <code>Context</code> 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 <a href="https://spec.oneapi.com/level-zero/latest/core/api.html?highlight=zemoduledynamiclink#_CPPv419zeModuleDynamicLink8uint32_tP18ze_module_handle_tP28ze_module_build_log_handle_t"><code>zeModuleDynamicLink</code></a>), and thus the SYCL kernel_bundle is created in the "executable" state.</td>
237+
<td>Constructs a SYCL kernel_bundle instance from a Level-Zero <code>ze_module_handle_t</code>. The <code>Context</code> argument must be a valid SYCL context encapsulating a Level-Zero context. The Level-Zero module should be created on the same context. The Level-Zero module must be fully linked (i.e. not require further linking through <a href="https://spec.oneapi.com/level-zero/latest/core/api.html?highlight=zemoduledynamiclink#_CPPv419zeModuleDynamicLink8uint32_tP18ze_module_handle_tP28ze_module_build_log_handle_t"><code>zeModuleDynamicLink</code></a>), and thus the SYCL kernel_bundle is created in the "executable" state. 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 runtime is going to destroy the input Level-Zero module, and hence the application must not to have any outstanding <code>ze_kernel_handle_t</code> handles to the underlying <code>ze_module_handle_t</code> by the time this interoperability <code>kernel_bundle</code> destructor is called.</td>
230238
</tr>
231239
</table>
232240

sycl/include/CL/sycl/detail/pi.h

+16-16
Original file line numberDiff line numberDiff line change
@@ -1034,8 +1034,8 @@ piextContextGetNativeHandle(pi_context context, pi_native_handle *nativeHandle);
10341034
/// \param devices is the list of devices in the context. Parameter is ignored
10351035
/// if devices can be queried from the context native handle for a
10361036
/// backend.
1037-
/// \param ownNativeHandle tells if SYCL RT should assume the ownership of
1038-
/// the native handle, if it can.
1037+
/// \param pluginOwnsNativeHandle Indicates whether the created PI object
1038+
/// should take ownership of the native handle.
10391039
/// \param context is the PI context created from the native handle.
10401040
/// \return PI_SUCCESS if successfully created pi_context from the handle.
10411041
/// PI_OUT_OF_HOST_MEMORY if can't allocate memory for the pi_context
@@ -1044,7 +1044,7 @@ piextContextGetNativeHandle(pi_context context, pi_native_handle *nativeHandle);
10441044
/// native handle. PI_UNKNOWN_ERROR in case of another error.
10451045
__SYCL_EXPORT pi_result piextContextCreateWithNativeHandle(
10461046
pi_native_handle nativeHandle, pi_uint32 numDevices,
1047-
const pi_device *devices, bool ownNativeHandle, pi_context *context);
1047+
const pi_device *devices, bool pluginOwnsNativeHandle, pi_context *context);
10481048

10491049
//
10501050
// Queue
@@ -1078,11 +1078,11 @@ piextQueueGetNativeHandle(pi_queue queue, pi_native_handle *nativeHandle);
10781078
/// \param nativeHandle is the native handle to create PI queue from.
10791079
/// \param context is the PI context of the queue.
10801080
/// \param queue is the PI queue created from the native handle.
1081-
/// \param ownNativeHandle tells if SYCL RT should assume the ownership of
1082-
/// the native handle, if it can.
1081+
/// \param pluginOwnsNativeHandle Indicates whether the created PI object
1082+
/// should take ownership of the native handle.
10831083
__SYCL_EXPORT pi_result piextQueueCreateWithNativeHandle(
10841084
pi_native_handle nativeHandle, pi_context context, pi_queue *queue,
1085-
bool ownNativeHandle);
1085+
bool pluginOwnsNativeHandle);
10861086

10871087
//
10881088
// Memory
@@ -1220,12 +1220,12 @@ piextProgramGetNativeHandle(pi_program program, pi_native_handle *nativeHandle);
12201220
///
12211221
/// \param nativeHandle is the native handle to create PI program from.
12221222
/// \param context is the PI context of the program.
1223-
/// \param ownNativeHandle tells if SYCL RT should assume the ownership of
1224-
/// the native handle, if it can.
1223+
/// \param pluginOwnsNativeHandle Indicates whether the created PI object
1224+
/// should take ownership of the native handle.
12251225
/// \param program is the PI program created from the native handle.
12261226
__SYCL_EXPORT pi_result piextProgramCreateWithNativeHandle(
1227-
pi_native_handle nativeHandle, pi_context context, bool ownNativeHandle,
1228-
pi_program *program);
1227+
pi_native_handle nativeHandle, pi_context context,
1228+
bool pluginOwnsNativeHandle, pi_program *program);
12291229

12301230
//
12311231
// Kernel
@@ -1319,12 +1319,12 @@ __SYCL_EXPORT pi_result piKernelSetExecInfo(pi_kernel kernel,
13191319
///
13201320
/// \param nativeHandle is the native handle to create PI kernel from.
13211321
/// \param context is the PI context of the kernel.
1322-
/// \param ownNativeHandle tells if SYCL RT should assume the ownership of
1323-
/// the native handle, if it can.
1322+
/// \param pluginOwnsNativeHandle Indicates whether the created PI object
1323+
/// should take ownership of the native handle.
13241324
/// \param kernel is the PI kernel created from the native handle.
13251325
__SYCL_EXPORT pi_result piextKernelCreateWithNativeHandle(
1326-
pi_native_handle nativeHandle, pi_context context, bool ownNativeHandle,
1327-
pi_kernel *kernel);
1326+
pi_native_handle nativeHandle, pi_context context,
1327+
bool pluginOwnsNativeHandle, pi_kernel *kernel);
13281328

13291329
/// Gets the native handle of a PI kernel object.
13301330
///
@@ -1377,8 +1377,8 @@ piextEventGetNativeHandle(pi_event event, pi_native_handle *nativeHandle);
13771377
///
13781378
/// \param nativeHandle is the native handle to create PI event from.
13791379
/// \param context is the corresponding PI context
1380-
/// \param ownNativeHandle tells if SYCL RT should assume the ownership of
1381-
/// the native handle, if it can.
1380+
/// \param pluginOwnsNativeHandle Indicates whether the created PI object
1381+
/// should take ownership of the native handle.
13821382
/// \param event is the PI event created from the native handle.
13831383
__SYCL_EXPORT pi_result piextEventCreateWithNativeHandle(
13841384
pi_native_handle nativeHandle, pi_context context, bool ownNativeHandle,

0 commit comments

Comments
 (0)