@@ -522,6 +522,38 @@ urPlatformCreateWithNativeHandle(
522522 ur_platform_handle_t * phPlatform ///< [out] pointer to the handle of the platform object created.
523523);
524524
525+ ///////////////////////////////////////////////////////////////////////////////
526+ /// @brief Get the platform specific compiler backend option from a generic
527+ /// frontend option.
528+ ///
529+ /// @details
530+ /// - The string returned via the ppPlatformOption is a NULL terminated C
531+ /// style string.
532+ /// - The string returned via the ppPlatformOption is thread local.
533+ /// - The memory in the string returned via the ppPlatformOption 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 == ppPlatformOption`
547+ /// - ::UR_RESULT_ERROR_INVALID_VALUE
548+ /// + If `pFrontendOption` is not a valid frontend option.
549+ UR_APIEXPORT ur_result_t UR_APICALL
550+ urPlatformGetBackendOption (
551+ ur_platform_handle_t hPlatform , ///< [in] handle of the platform instance.
552+ const char * pFrontendOption , ///< [in] string containing the frontend option.
553+ const char * * ppPlatformOption ///< [out] returns the correct platform specific compiler option based on
554+ ///< the frontend option.
555+ );
556+
525557///////////////////////////////////////////////////////////////////////////////
526558/// @brief Retrieve string representation of the underlying adapter specific
527559/// result reported by the the last API that returned
@@ -4309,6 +4341,7 @@ typedef enum ur_function_t {
43094341 UR_FUNCTION_USM_GET_MEM_ALLOC_INFO = 111 , ///< Enumerator for ::urUSMGetMemAllocInfo
43104342 UR_FUNCTION_USM_POOL_CREATE = 112 , ///< Enumerator for ::urUSMPoolCreate
43114343 UR_FUNCTION_USM_POOL_DESTROY = 113 , ///< Enumerator for ::urUSMPoolDestroy
4344+ UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION = 114 , ///< Enumerator for ::urPlatformGetBackendOption
43124345 /// @cond
43134346 UR_FUNCTION_FORCE_UINT32 = 0x7fffffff
43144347 /// @endcond
@@ -5540,6 +5573,28 @@ typedef void(UR_APICALL *ur_pfnPlatformGetApiVersionCb_t)(
55405573 void * pTracerUserData ,
55415574 void * * ppTracerInstanceUserData );
55425575
5576+ ///////////////////////////////////////////////////////////////////////////////
5577+ /// @brief Callback function parameters for urPlatformGetBackendOption
5578+ /// @details Each entry is a pointer to the parameter passed to the function;
5579+ /// allowing the callback the ability to modify the parameter's value
5580+ typedef struct ur_platform_get_backend_option_params_t {
5581+ ur_platform_handle_t * phPlatform ;
5582+ const char * * ppFrontendOption ;
5583+ const char * * * pppPlatformOption ;
5584+ } ur_platform_get_backend_option_params_t ;
5585+
5586+ ///////////////////////////////////////////////////////////////////////////////
5587+ /// @brief Callback function-pointer for urPlatformGetBackendOption
5588+ /// @param[in] params Parameters passed to this instance
5589+ /// @param[in] result Return value
5590+ /// @param[in] pTracerUserData Per-Tracer user data
5591+ /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data
5592+ typedef void (UR_APICALL * ur_pfnPlatformGetBackendOptionCb_t )(
5593+ ur_platform_get_backend_option_params_t * params ,
5594+ ur_result_t result ,
5595+ void * pTracerUserData ,
5596+ void * * ppTracerInstanceUserData );
5597+
55435598///////////////////////////////////////////////////////////////////////////////
55445599/// @brief Table of Platform callback functions pointers
55455600typedef struct ur_platform_callbacks_t {
@@ -5548,6 +5603,7 @@ typedef struct ur_platform_callbacks_t {
55485603 ur_pfnPlatformGetNativeHandleCb_t pfnGetNativeHandleCb ;
55495604 ur_pfnPlatformCreateWithNativeHandleCb_t pfnCreateWithNativeHandleCb ;
55505605 ur_pfnPlatformGetApiVersionCb_t pfnGetApiVersionCb ;
5606+ ur_pfnPlatformGetBackendOptionCb_t pfnGetBackendOptionCb ;
55515607} ur_platform_callbacks_t ;
55525608
55535609///////////////////////////////////////////////////////////////////////////////
0 commit comments