@@ -522,6 +522,36 @@ urPlatformCreateWithNativeHandle(
522522 ur_platform_handle_t * phPlatform ///< [out] pointer to the handle of the platform object created.
523523);
524524
525+ ///////////////////////////////////////////////////////////////////////////////
526+ /// @brief Get the adapter specific compiler backend option from a generic
527+ /// frontend option.
528+ ///
529+ /// @details
530+ /// - The string returned via the ppAdapterOption is a NULL terminated C
531+ /// style string.
532+ /// - The string returned via the ppAdapterOption is thread local.
533+ /// - The memory in the string returned via the ppAdapterOption is owned by
534+ /// the adapter.
535+ /// - The application may call this function from simultaneous threads.
536+ /// - The implementation of this function should be lock-free.
537+ ///
538+ /// @returns
539+ /// - ::UR_RESULT_SUCCESS
540+ /// - ::UR_RESULT_ERROR_UNINITIALIZED
541+ /// - ::UR_RESULT_ERROR_DEVICE_LOST
542+ /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
543+ /// + `NULL == hPlatform`
544+ /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
545+ /// + `NULL == pFrontendOption`
546+ /// + `NULL == ppAdapterOption`
547+ UR_APIEXPORT ur_result_t UR_APICALL
548+ urPlatformGetBackendOption (
549+ ur_platform_handle_t hPlatform , ///< [in] handle of the platform instance.
550+ const char * pFrontendOption , ///< [in] string containing the frontend option.
551+ const char * * ppAdapterOption ///< [out] returns the correct adapter specific option based on the
552+ ///< frontend option.
553+ );
554+
525555///////////////////////////////////////////////////////////////////////////////
526556/// @brief Retrieve string representation of the underlying adapter specific
527557/// result reported by the the last API that returned
@@ -4295,6 +4325,7 @@ typedef enum ur_function_t {
42954325 UR_FUNCTION_USM_GET_MEM_ALLOC_INFO = 111 , ///< Enumerator for ::urUSMGetMemAllocInfo
42964326 UR_FUNCTION_USM_POOL_CREATE = 112 , ///< Enumerator for ::urUSMPoolCreate
42974327 UR_FUNCTION_USM_POOL_DESTROY = 113 , ///< Enumerator for ::urUSMPoolDestroy
4328+ UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION = 114 , ///< Enumerator for ::urPlatformGetBackendOption
42984329 /// @cond
42994330 UR_FUNCTION_FORCE_UINT32 = 0x7fffffff
43004331 /// @endcond
@@ -5526,6 +5557,28 @@ typedef void(UR_APICALL *ur_pfnPlatformGetApiVersionCb_t)(
55265557 void * pTracerUserData ,
55275558 void * * ppTracerInstanceUserData );
55285559
5560+ ///////////////////////////////////////////////////////////////////////////////
5561+ /// @brief Callback function parameters for urPlatformGetBackendOption
5562+ /// @details Each entry is a pointer to the parameter passed to the function;
5563+ /// allowing the callback the ability to modify the parameter's value
5564+ typedef struct ur_platform_get_backend_option_params_t {
5565+ ur_platform_handle_t * phPlatform ;
5566+ const char * * ppFrontendOption ;
5567+ const char * * * pppAdapterOption ;
5568+ } ur_platform_get_backend_option_params_t ;
5569+
5570+ ///////////////////////////////////////////////////////////////////////////////
5571+ /// @brief Callback function-pointer for urPlatformGetBackendOption
5572+ /// @param[in] params Parameters passed to this instance
5573+ /// @param[in] result Return value
5574+ /// @param[in] pTracerUserData Per-Tracer user data
5575+ /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data
5576+ typedef void (UR_APICALL * ur_pfnPlatformGetBackendOptionCb_t )(
5577+ ur_platform_get_backend_option_params_t * params ,
5578+ ur_result_t result ,
5579+ void * pTracerUserData ,
5580+ void * * ppTracerInstanceUserData );
5581+
55295582///////////////////////////////////////////////////////////////////////////////
55305583/// @brief Table of Platform callback functions pointers
55315584typedef struct ur_platform_callbacks_t {
@@ -5534,6 +5587,7 @@ typedef struct ur_platform_callbacks_t {
55345587 ur_pfnPlatformGetNativeHandleCb_t pfnGetNativeHandleCb ;
55355588 ur_pfnPlatformCreateWithNativeHandleCb_t pfnCreateWithNativeHandleCb ;
55365589 ur_pfnPlatformGetApiVersionCb_t pfnGetApiVersionCb ;
5590+ ur_pfnPlatformGetBackendOptionCb_t pfnGetBackendOptionCb ;
55375591} ur_platform_callbacks_t ;
55385592
55395593///////////////////////////////////////////////////////////////////////////////
0 commit comments