@@ -239,6 +239,7 @@ typedef enum ur_structure_type_t {
239239 UR_STRUCTURE_TYPE_SAMPLER_DESC = 13 , ///< ::ur_sampler_desc_t
240240 UR_STRUCTURE_TYPE_QUEUE_PROPERTIES = 14 , ///< ::ur_queue_properties_t
241241 UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES = 15 , ///< ::ur_queue_properties_t
242+ UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES = 16 , ///< ::ur_context_native_properties_t
242243 /// @cond
243244 UR_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff
244245 /// @endcond
@@ -1456,6 +1457,18 @@ urContextGetNativeHandle(
14561457 ur_native_handle_t * phNativeContext ///< [out] a pointer to the native handle of the context.
14571458);
14581459
1460+ ///////////////////////////////////////////////////////////////////////////////
1461+ /// @brief Properties for for ::urContextCreateWithNativeHandle.
1462+ typedef struct ur_context_native_properties_t {
1463+ ur_structure_type_t stype ; ///< [in] type of this structure, must be
1464+ ///< ::UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES
1465+ void * pNext ; ///< [in,out][optional] pointer to extension-specific structure
1466+ bool isNativeHandleOwned ; ///< [in] Indicates UR owns the native handle or if it came from an interoperability
1467+ ///< operation in the application that asked to not transfer the ownership to
1468+ ///< the unified-runtime.
1469+
1470+ } ur_context_native_properties_t ;
1471+
14591472///////////////////////////////////////////////////////////////////////////////
14601473/// @brief Create runtime context object from native context handle.
14611474///
@@ -1472,11 +1485,16 @@ urContextGetNativeHandle(
14721485/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
14731486/// + `NULL == hNativeContext`
14741487/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
1488+ /// + `NULL == phDevices`
1489+ /// + `NULL == pProperties`
14751490/// + `NULL == phContext`
14761491UR_APIEXPORT ur_result_t UR_APICALL
14771492urContextCreateWithNativeHandle (
1478- ur_native_handle_t hNativeContext , ///< [in] the native handle of the context.
1479- ur_context_handle_t * phContext ///< [out] pointer to the handle of the context object created.
1493+ ur_native_handle_t hNativeContext , ///< [in] the native handle of the context.
1494+ uint32_t numDevices , ///< [in] number of devices associated with the context
1495+ const ur_device_handle_t * phDevices , ///< [in][range(0, numDevices)] list of devices associated with the context
1496+ const ur_context_native_properties_t * pProperties , ///< [in] pointer to properties struct
1497+ ur_context_handle_t * phContext ///< [out] pointer to the handle of the context object created.
14801498);
14811499
14821500///////////////////////////////////////////////////////////////////////////////
@@ -5732,6 +5750,9 @@ typedef void(UR_APICALL *ur_pfnContextGetNativeHandleCb_t)(
57325750/// allowing the callback the ability to modify the parameter's value
57335751typedef struct ur_context_create_with_native_handle_params_t {
57345752 ur_native_handle_t * phNativeContext ;
5753+ uint32_t * pnumDevices ;
5754+ const ur_device_handle_t * * pphDevices ;
5755+ const ur_context_native_properties_t * * ppProperties ;
57355756 ur_context_handle_t * * pphContext ;
57365757} ur_context_create_with_native_handle_params_t ;
57375758
0 commit comments