Skip to content

Commit

Permalink
Rerun generate target after applying suggestions from Github web ui. …
Browse files Browse the repository at this point in the history
…Add new entry to interface loader for adapter ddi table."
  • Loading branch information
martygrant committed Jul 5, 2024
1 parent 2e71fc2 commit 3cfc04c
Show file tree
Hide file tree
Showing 29 changed files with 458 additions and 212 deletions.
48 changes: 24 additions & 24 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ typedef enum ur_function_t {
UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP = 226, ///< Enumerator for ::urBindlessImagesImportExternalMemoryExp
UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP = 227, ///< Enumerator for ::urBindlessImagesImportExternalSemaphoreExp
UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP = 228, ///< Enumerator for ::urEnqueueNativeCommandExp
UR_FUNCTION_SET_LOGGER_CALLBACK = 229, ///< Enumerator for ::urSetLoggerCallback
UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL = 230, ///< Enumerator for ::urSetLoggerCallbackLevel
UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK = 231, ///< Enumerator for ::urAdapterSetLoggerCallback
UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK_LEVEL = 232, ///< Enumerator for ::urAdapterSetLoggerCallbackLevel
/// @cond
UR_FUNCTION_FORCE_UINT32 = 0x7fffffff
/// @endcond
Expand Down Expand Up @@ -1028,7 +1028,7 @@ typedef void (*ur_logger_output_callback_t)(
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_LOGGER_LEVEL_QUIET < level`
UR_APIEXPORT ur_result_t UR_APICALL
urSetLoggerCallback(
urAdapterSetLoggerCallback(
ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter
ur_logger_output_callback_t pfnLoggerCallback, ///< [in] Function pointer to callback from the logger.
void *pUserData, ///< [in][out][optional] pointer to data to be passed to callback
Expand All @@ -1048,7 +1048,7 @@ urSetLoggerCallback(
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_LOGGER_LEVEL_QUIET < level`
UR_APIEXPORT ur_result_t UR_APICALL
urSetLoggerCallbackLevel(
urAdapterSetLoggerCallbackLevel(
ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter
ur_logger_level_t level ///< [in] logging level
);
Expand Down Expand Up @@ -9720,6 +9720,26 @@ typedef struct ur_loader_config_set_code_location_callback_params_t {
void **ppUserData;
} ur_loader_config_set_code_location_callback_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Function parameters for urAdapterSetLoggerCallback
/// @details Each entry is a pointer to the parameter passed to the function;
/// allowing the callback the ability to modify the parameter's value
typedef struct ur_adapter_set_logger_callback_params_t {
ur_adapter_handle_t *phAdapter;
ur_logger_output_callback_t *ppfnLoggerCallback;
void **ppUserData;
ur_logger_level_t *plevel;
} ur_adapter_set_logger_callback_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Function parameters for urAdapterSetLoggerCallbackLevel
/// @details Each entry is a pointer to the parameter passed to the function;
/// allowing the callback the ability to modify the parameter's value
typedef struct ur_adapter_set_logger_callback_level_params_t {
ur_adapter_handle_t *phAdapter;
ur_logger_level_t *plevel;
} ur_adapter_set_logger_callback_level_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Function parameters for urPlatformGet
/// @details Each entry is a pointer to the parameter passed to the function;
Expand Down Expand Up @@ -10629,26 +10649,6 @@ typedef struct ur_adapter_get_info_params_t {
size_t **ppPropSizeRet;
} ur_adapter_get_info_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Function parameters for urSetLoggerCallback
/// @details Each entry is a pointer to the parameter passed to the function;
/// allowing the callback the ability to modify the parameter's value
typedef struct ur_set_logger_callback_params_t {
ur_adapter_handle_t *phAdapter;
ur_logger_output_callback_t *ppfnLoggerCallback;
void **ppUserData;
ur_logger_level_t *plevel;
} ur_set_logger_callback_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Function parameters for urSetLoggerCallbackLevel
/// @details Each entry is a pointer to the parameter passed to the function;
/// allowing the callback the ability to modify the parameter's value
typedef struct ur_set_logger_callback_level_params_t {
ur_adapter_handle_t *phAdapter;
ur_logger_level_t *plevel;
} ur_set_logger_callback_level_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Function parameters for urEnqueueKernelLaunch
/// @details Each entry is a pointer to the parameter passed to the function;
Expand Down
59 changes: 43 additions & 16 deletions include/ur_ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,48 @@
extern "C" {
#endif

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urAdapterSetLoggerCallback
typedef ur_result_t(UR_APICALL *ur_pfnAdapterSetLoggerCallback_t)(
ur_adapter_handle_t,
ur_logger_output_callback_t,
void *,
ur_logger_level_t);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urAdapterSetLoggerCallbackLevel
typedef ur_result_t(UR_APICALL *ur_pfnAdapterSetLoggerCallbackLevel_t)(
ur_adapter_handle_t,
ur_logger_level_t);

///////////////////////////////////////////////////////////////////////////////
/// @brief Table of Adapter functions pointers
typedef struct ur_adapter_dditable_t {
ur_pfnAdapterSetLoggerCallback_t pfnSetLoggerCallback;
ur_pfnAdapterSetLoggerCallbackLevel_t pfnSetLoggerCallbackLevel;
} ur_adapter_dditable_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Exported function for filling application's Adapter table
/// with current process' addresses
///
/// @returns
/// - ::UR_RESULT_SUCCESS
/// - ::UR_RESULT_ERROR_UNINITIALIZED
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION
UR_DLLEXPORT ur_result_t UR_APICALL
urGetAdapterProcAddrTable(
ur_api_version_t version, ///< [in] API version requested
ur_adapter_dditable_t *pDdiTable ///< [in,out] pointer to table of DDI function pointers
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urGetAdapterProcAddrTable
typedef ur_result_t(UR_APICALL *ur_pfnGetAdapterProcAddrTable_t)(
ur_api_version_t,
ur_adapter_dditable_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urPlatformGet
typedef ur_result_t(UR_APICALL *ur_pfnPlatformGet_t)(
Expand Down Expand Up @@ -1037,20 +1079,6 @@ typedef ur_result_t(UR_APICALL *ur_pfnAdapterGetInfo_t)(
void *,
size_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urSetLoggerCallback
typedef ur_result_t(UR_APICALL *ur_pfnSetLoggerCallback_t)(
ur_adapter_handle_t,
ur_logger_output_callback_t,
void *,
ur_logger_level_t);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urSetLoggerCallbackLevel
typedef ur_result_t(UR_APICALL *ur_pfnSetLoggerCallbackLevel_t)(
ur_adapter_handle_t,
ur_logger_level_t);

///////////////////////////////////////////////////////////////////////////////
/// @brief Table of Global functions pointers
typedef struct ur_global_dditable_t {
Expand All @@ -1059,8 +1087,6 @@ typedef struct ur_global_dditable_t {
ur_pfnAdapterRetain_t pfnAdapterRetain;
ur_pfnAdapterGetLastError_t pfnAdapterGetLastError;
ur_pfnAdapterGetInfo_t pfnAdapterGetInfo;
ur_pfnSetLoggerCallback_t pfnSetLoggerCallback;
ur_pfnSetLoggerCallbackLevel_t pfnSetLoggerCallbackLevel;
} ur_global_dditable_t;

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -2426,6 +2452,7 @@ typedef ur_result_t(UR_APICALL *ur_pfnGetDeviceProcAddrTable_t)(
///////////////////////////////////////////////////////////////////////////////
/// @brief Container for all DDI tables
typedef struct ur_dditable_t {
ur_adapter_dditable_t Adapter;
ur_platform_dditable_t Platform;
ur_context_dditable_t Context;
ur_event_dditable_t Event;
Expand Down
32 changes: 16 additions & 16 deletions include/ur_print.h
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,22 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintLoaderConfigEnableLayerParams(const s
/// - `buff_size < out_size`
UR_APIEXPORT ur_result_t UR_APICALL urPrintLoaderConfigSetCodeLocationCallbackParams(const struct ur_loader_config_set_code_location_callback_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);

///////////////////////////////////////////////////////////////////////////////
/// @brief Print ur_adapter_set_logger_callback_params_t struct
/// @returns
/// - ::UR_RESULT_SUCCESS
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// - `buff_size < out_size`
UR_APIEXPORT ur_result_t UR_APICALL urPrintAdapterSetLoggerCallbackParams(const struct ur_adapter_set_logger_callback_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);

///////////////////////////////////////////////////////////////////////////////
/// @brief Print ur_adapter_set_logger_callback_level_params_t struct
/// @returns
/// - ::UR_RESULT_SUCCESS
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// - `buff_size < out_size`
UR_APIEXPORT ur_result_t UR_APICALL urPrintAdapterSetLoggerCallbackLevelParams(const struct ur_adapter_set_logger_callback_level_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);

///////////////////////////////////////////////////////////////////////////////
/// @brief Print ur_platform_get_params_t struct
/// @returns
Expand Down Expand Up @@ -1810,22 +1826,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintAdapterGetLastErrorParams(const struc
/// - `buff_size < out_size`
UR_APIEXPORT ur_result_t UR_APICALL urPrintAdapterGetInfoParams(const struct ur_adapter_get_info_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);

///////////////////////////////////////////////////////////////////////////////
/// @brief Print ur_set_logger_callback_params_t struct
/// @returns
/// - ::UR_RESULT_SUCCESS
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// - `buff_size < out_size`
UR_APIEXPORT ur_result_t UR_APICALL urPrintSetLoggerCallbackParams(const struct ur_set_logger_callback_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);

///////////////////////////////////////////////////////////////////////////////
/// @brief Print ur_set_logger_callback_level_params_t struct
/// @returns
/// - ::UR_RESULT_SUCCESS
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// - `buff_size < out_size`
UR_APIEXPORT ur_result_t UR_APICALL urPrintSetLoggerCallbackLevelParams(const struct ur_set_logger_callback_level_params_t *params, char *buffer, const size_t buff_size, size_t *out_size);

///////////////////////////////////////////////////////////////////////////////
/// @brief Print ur_enqueue_kernel_launch_params_t struct
/// @returns
Expand Down
120 changes: 60 additions & 60 deletions include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -943,11 +943,11 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) {
case UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP:
os << "UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP";
break;
case UR_FUNCTION_SET_LOGGER_CALLBACK:
os << "UR_FUNCTION_SET_LOGGER_CALLBACK";
case UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK:
os << "UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK";
break;
case UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL:
os << "UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL";
case UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK_LEVEL:
os << "UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK_LEVEL";
break;
default:
os << "unknown enumerator";
Expand Down Expand Up @@ -10315,6 +10315,56 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
return os;
}

///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the ur_adapter_set_logger_callback_params_t type
/// @returns
/// std::ostream &
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_adapter_set_logger_callback_params_t *params) {

os << ".hAdapter = ";

ur::details::printPtr(os,
*(params->phAdapter));

os << ", ";
os << ".pfnLoggerCallback = ";

os << reinterpret_cast<void *>(
*(params->ppfnLoggerCallback));

os << ", ";
os << ".pUserData = ";

ur::details::printPtr(os,
*(params->ppUserData));

os << ", ";
os << ".level = ";

os << *(params->plevel);

return os;
}

///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the ur_adapter_set_logger_callback_level_params_t type
/// @returns
/// std::ostream &
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_adapter_set_logger_callback_level_params_t *params) {

os << ".hAdapter = ";

ur::details::printPtr(os,
*(params->phAdapter));

os << ", ";
os << ".level = ";

os << *(params->plevel);

return os;
}

///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the ur_platform_get_params_t type
/// @returns
Expand Down Expand Up @@ -12793,56 +12843,6 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct
return os;
}

///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the ur_set_logger_callback_params_t type
/// @returns
/// std::ostream &
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_set_logger_callback_params_t *params) {

os << ".hAdapter = ";

ur::details::printPtr(os,
*(params->phAdapter));

os << ", ";
os << ".pfnLoggerCallback = ";

os << reinterpret_cast<void *>(
*(params->ppfnLoggerCallback));

os << ", ";
os << ".pUserData = ";

ur::details::printPtr(os,
*(params->ppUserData));

os << ", ";
os << ".level = ";

os << *(params->plevel);

return os;
}

///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the ur_set_logger_callback_level_params_t type
/// @returns
/// std::ostream &
inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_set_logger_callback_level_params_t *params) {

os << ".hAdapter = ";

ur::details::printPtr(os,
*(params->phAdapter));

os << ", ";
os << ".level = ";

os << *(params->plevel);

return os;
}

///////////////////////////////////////////////////////////////////////////////
/// @brief Print operator for the ur_enqueue_kernel_launch_params_t type
/// @returns
Expand Down Expand Up @@ -17414,6 +17414,12 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, ur_function_
case UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK: {
os << (const struct ur_loader_config_set_code_location_callback_params_t *)params;
} break;
case UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK: {
os << (const struct ur_adapter_set_logger_callback_params_t *)params;
} break;
case UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK_LEVEL: {
os << (const struct ur_adapter_set_logger_callback_level_params_t *)params;
} break;
case UR_FUNCTION_PLATFORM_GET: {
os << (const struct ur_platform_get_params_t *)params;
} break;
Expand Down Expand Up @@ -17675,12 +17681,6 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, ur_function_
case UR_FUNCTION_ADAPTER_GET_INFO: {
os << (const struct ur_adapter_get_info_params_t *)params;
} break;
case UR_FUNCTION_SET_LOGGER_CALLBACK: {
os << (const struct ur_set_logger_callback_params_t *)params;
} break;
case UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL: {
os << (const struct ur_set_logger_callback_level_params_t *)params;
} break;
case UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH: {
os << (const struct ur_enqueue_kernel_launch_params_t *)params;
} break;
Expand Down
2 changes: 1 addition & 1 deletion scripts/core/INTRO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ An example of an environment variable for setting up the null adapter library wi

Logging callback
^^^^^^^^^^^^^^^^^^^^^
An API is available to configure the logging callback function :ref:`urSetLoggerCallback`. Additionally, the logging level can be set using :ref:`urSetLoggerCallbackLevel`.
An API is available to configure the logging callback function :ref:`urAdapterSetLoggerCallback`. Additionally, the logging level can be set using :ref:`urAdapterSetLoggerCallbackLevel`.

Adapter Discovery
---------------------
Expand Down
1 change: 0 additions & 1 deletion scripts/core/adapter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ etors:
--- #--------------------------------------------------------------------------
type: fptr_typedef
desc: "Callback function to retrieve output from the logger."
class: $xAdapter
name: $x_logger_output_callback_t
return: "void"
params:
Expand Down
Loading

0 comments on commit 3cfc04c

Please sign in to comment.