@@ -340,3 +340,39 @@ through ${x}_usm_desc_t structure. Allocations that specify different pool handl
340
340
isolated and not reside on the same page. Memory pool is subject to limits specified during pool creation.
341
341
342
342
Even if no ${x}_usm_pool_handle_t is provided to an allocation function, each adapter may still perform memory pooling.
343
+
344
+ Native Handles
345
+ ==============
346
+
347
+ In addition to the regular object creation APIs, ${X} objects can be
348
+ constructed with handles obtained directly from an adapter's associated
349
+ backend. This is achieved by casting the backend handle to a
350
+ ${x}_native_handle_t and passing it to the relevant ``CreateWithNativeHandle ``
351
+ entry point.
352
+
353
+
354
+ .. note ::
355
+ Not all backends have a 1:1 equivalent for every ${X} handle type, as such
356
+ any ``CreateWithNativeHandle `` or ``GetNativeHandle `` entry point *may * fail
357
+ with the error code ${X}_RESULT_ERROR_UNSUPPORTED_FEATURE for a given
358
+ adapter.
359
+
360
+ Native Handle Ownership
361
+ -----------------------
362
+
363
+ By default a ${X} object constructed from a native handle doesn't own the
364
+ native handle, it is guaranteed not to modify the native handle's reference
365
+ count or otherwise cause its resources to be released. A ${X} object that
366
+ doesn't own its associated native handle **must ** be destroyed before the
367
+ native handle is.
368
+
369
+ Ownership of the native handle can be tranferred to the ${X} object by passing
370
+ ``isNativeHandleOwned = true `` in the native properties struct when calling the
371
+ ``CreateWithNativeHandle `` entry point. A ${X} object that owns a native handle
372
+ will attempt to release the native resources associated with that handle on
373
+ destruction. The same native handle **must not ** have its ownership transferred
374
+ to more than one ${X} object.
375
+
376
+ Ownership of a native handle obtained from a ${X} object via a
377
+ ``GetNativeHandle `` entry point **must not ** be transferred to a new ${X}
378
+ object.
0 commit comments