From 4abd3e089495c681c93c4a1b7c5836e15d417f30 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Mon, 10 Jun 2024 16:55:12 +0100 Subject: [PATCH 1/4] Added new output sink to the logger which is a user configurable callback function. Configurable through two new entry points with adapter implementations: urAdapterSetLoggerCallback() and urAdapterSetLoggerCallbackLevel(). Moved logger::level enum to the spec, named ur_logger_level_t. Added new unit test suite for these entry points. --- include/ur_api.h | 86 +++++++++++++++ include/ur_api_funcs.def | 2 + include/ur_ddi.h | 16 +++ include/ur_print.h | 24 +++++ include/ur_print.hpp | 90 ++++++++++++++++ scripts/core/INTRO.rst | 8 +- scripts/core/adapter.yml | 73 +++++++++++++ scripts/core/registry.yml | 6 ++ source/adapters/cuda/adapter.cpp | 21 +++- source/adapters/cuda/ur_interface_loader.cpp | 2 + source/adapters/hip/adapter.cpp | 23 +++- source/adapters/hip/ur_interface_loader.cpp | 2 + source/adapters/level_zero/adapter.cpp | 24 ++++- .../level_zero/ur_interface_loader.cpp | 3 + .../level_zero/ur_interface_loader.hpp | 5 + source/adapters/mock/ur_mockddi.cpp | 95 ++++++++++++++++ source/adapters/native_cpu/adapter.cpp | 17 +++ .../native_cpu/ur_interface_loader.cpp | 2 + source/adapters/opencl/adapter.cpp | 21 ++++ .../adapters/opencl/ur_interface_loader.cpp | 2 + source/common/logger/ur_level.hpp | 35 +++--- source/common/logger/ur_logger.hpp | 52 +++++---- source/common/logger/ur_logger_details.hpp | 101 +++++++++++------- source/common/logger/ur_sinks.hpp | 51 +++++++-- .../layers/sanitizer/ur_sanitizer_layer.cpp | 2 +- source/loader/layers/tracing/ur_trcddi.cpp | 87 +++++++++++++++ source/loader/layers/validation/ur_valddi.cpp | 82 ++++++++++++++ source/loader/loader.def.in | 5 + source/loader/loader.map.in | 5 + source/loader/ur_ldrddi.cpp | 61 +++++++++++ source/loader/ur_libapi.cpp | 62 +++++++++++ source/loader/ur_print.cpp | 23 ++++ source/ur_api.cpp | 48 +++++++++ test/unit/logger/fixtures.hpp | 13 ++- test/unit/logger/logger.cpp | 83 ++++++++++++-- 35 files changed, 1120 insertions(+), 112 deletions(-) diff --git a/include/ur_api.h b/include/ur_api.h index 9897d892b6..70bef9904d 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -230,6 +230,8 @@ typedef enum ur_function_t { UR_FUNCTION_COMMAND_BUFFER_UPDATE_SIGNAL_EVENT_EXP = 243, ///< Enumerator for ::urCommandBufferUpdateSignalEventExp UR_FUNCTION_COMMAND_BUFFER_UPDATE_WAIT_EVENTS_EXP = 244, ///< Enumerator for ::urCommandBufferUpdateWaitEventsExp UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP = 245, ///< Enumerator for ::urBindlessImagesMapExternalLinearMemoryExp + UR_FUNCTION_SET_LOGGER_CALLBACK = 246, ///< Enumerator for ::urSetLoggerCallback + UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL = 247, ///< Enumerator for ::urSetLoggerCallbackLevel /// @cond UR_FUNCTION_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -1025,6 +1027,70 @@ typedef enum ur_adapter_backend_t { } ur_adapter_backend_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Minimum level of messages to be processed by the logger. +typedef enum ur_logger_level_t { + UR_LOGGER_LEVEL_DEBUG = 0, ///< Debugging messages used for development purposes. + UR_LOGGER_LEVEL_INFO = 1, ///< General messages not related to debugging, warnings or errors. + UR_LOGGER_LEVEL_WARN = 2, ///< Used to warn users about potential problems. + UR_LOGGER_LEVEL_ERR = 3, ///< Used when an error has occurred. + UR_LOGGER_LEVEL_QUIET = 4, ///< Restrict logger processing any messages. + /// @cond + UR_LOGGER_LEVEL_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_logger_level_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function to retrieve output from the logger. +typedef void (*ur_logger_output_callback_t)( + ur_logger_level_t level, ///< [out] Minimum level of messages to be processed by the logger. + const char *pLoggerMsg, ///< [in][out] pointer to data to be passed to callback + void *pUserData ///< [in][out] pointer to data to be passed to callback +); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set a callback function for use by the logger to retrieve logging output. +/// It is a requirement that the callback function is thread safe and the +/// creator of the function will be responsible for this. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hAdapter` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pfnLoggerCallback` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_LOGGER_LEVEL_QUIET < level` +UR_APIEXPORT ur_result_t UR_APICALL +urSetLoggerCallback( + 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 + ur_logger_level_t level ///< [in] logging level +); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the minimum logging level for the logger Callback function. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hAdapter` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_LOGGER_LEVEL_QUIET < level` +UR_APIEXPORT ur_result_t UR_APICALL +urSetLoggerCallbackLevel( + ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter + ur_logger_level_t level ///< [in] logging level +); + #if !defined(__GNUC__) #pragma endregion #endif @@ -10997,6 +11063,26 @@ 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; diff --git a/include/ur_api_funcs.def b/include/ur_api_funcs.def index a7ca4d88a0..9fd627c125 100644 --- a/include/ur_api_funcs.def +++ b/include/ur_api_funcs.def @@ -101,6 +101,8 @@ _UR_API(urAdapterRelease) _UR_API(urAdapterRetain) _UR_API(urAdapterGetLastError) _UR_API(urAdapterGetInfo) +_UR_API(urSetLoggerCallback) +_UR_API(urSetLoggerCallbackLevel) _UR_API(urEnqueueKernelLaunch) _UR_API(urEnqueueEventsWait) _UR_API(urEnqueueEventsWaitWithBarrier) diff --git a/include/ur_ddi.h b/include/ur_ddi.h index b4d6f2bade..c402bcba13 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -1038,6 +1038,20 @@ 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 { @@ -1046,6 +1060,8 @@ 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; /////////////////////////////////////////////////////////////////////////////// diff --git a/include/ur_print.h b/include/ur_print.h index 1dd874e5a5..fd283ec022 100644 --- a/include/ur_print.h +++ b/include/ur_print.h @@ -114,6 +114,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintAdapterInfo(enum ur_adapter_info_t va /// - `buff_size < out_size` UR_APIEXPORT ur_result_t UR_APICALL urPrintAdapterBackend(enum ur_adapter_backend_t value, char *buffer, const size_t buff_size, size_t *out_size); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_logger_level_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintLoggerLevel(enum ur_logger_level_t value, char *buffer, const size_t buff_size, size_t *out_size); + /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_platform_info_t enum /// @returns @@ -1826,6 +1834,22 @@ 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 diff --git a/include/ur_print.hpp b/include/ur_print.hpp index a908fd9275..dfb5ce845a 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -230,6 +230,7 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_loader_config_info_t v inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_code_location_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_adapter_info_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_adapter_backend_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_logger_level_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_platform_info_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_api_version_t value); inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_platform_native_properties_t params); @@ -954,6 +955,12 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP"; break; + case UR_FUNCTION_SET_LOGGER_CALLBACK: + os << "UR_FUNCTION_SET_LOGGER_CALLBACK"; + break; + case UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL: + os << "UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL"; + break; default: os << "unknown enumerator"; break; @@ -1981,6 +1988,33 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_adapter_backend_t valu return os; } /////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_logger_level_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_logger_level_t value) { + switch (value) { + case UR_LOGGER_LEVEL_DEBUG: + os << "UR_LOGGER_LEVEL_DEBUG"; + break; + case UR_LOGGER_LEVEL_INFO: + os << "UR_LOGGER_LEVEL_INFO"; + break; + case UR_LOGGER_LEVEL_WARN: + os << "UR_LOGGER_LEVEL_WARN"; + break; + case UR_LOGGER_LEVEL_ERR: + os << "UR_LOGGER_LEVEL_ERR"; + break; + case UR_LOGGER_LEVEL_QUIET: + os << "UR_LOGGER_LEVEL_QUIET"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_platform_info_t type /// @returns /// std::ostream & @@ -13021,6 +13055,56 @@ 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( + *(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 @@ -18317,6 +18401,12 @@ 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; diff --git a/scripts/core/INTRO.rst b/scripts/core/INTRO.rst index 9a46d12170..1b15ac2f84 100644 --- a/scripts/core/INTRO.rst +++ b/scripts/core/INTRO.rst @@ -202,9 +202,9 @@ By default, no messages are printed. By default, there is a guarantee that *error* messages are flushed immediately. One can change this behavior to flush on lower-level messages. -Loggers redirect messages to *stdout*, *stderr*, or a file (default: *stderr*). +Loggers redirect messages to *stdout*, *stderr*, a file or a user configurable callback function (default: *stderr*). -All of these logging options can be set with **UR_LOG_LOADER** and **UR_LOG_NULL** environment variables described in the **Environment Variables** section below. +All of these logging options (except the callback) can be set with **UR_LOG_LOADER** and **UR_LOG_NULL** environment variables described in the **Environment Variables** section below. Both of these environment variables have the same syntax for setting logger options: "[level:debug|info|warning|error];[flush:];[output:stdout|stderr|file,]" @@ -232,6 +232,10 @@ An example of an environment variable for setting up the null adapter library wi UR_LOG_NULL="level:warning;output:stdout" +Logging callback +^^^^^^^^^^^^^^^^^^^^^ +An API is available to configure the logging callback function :ref:`urSetLoggerCallback`. Additionally, the logging level can be set using :ref:`urSetLoggerCallbackLevel`. + Adapter Discovery --------------------- UR is capable of discovering adapter libraries in the following ways in the listed order: diff --git a/scripts/core/adapter.yml b/scripts/core/adapter.yml index a4eddd823c..805001095a 100644 --- a/scripts/core/adapter.yml +++ b/scripts/core/adapter.yml @@ -201,3 +201,76 @@ etors: - name: NATIVE_CPU value: "5" desc: "The backend is Native CPU" +--- #-------------------------------------------------------------------------- +type: enum +desc: "Minimum level of messages to be processed by the logger." +class: $x +name: $x_logger_level_t +etors: + - name: DEBUG + value: "0" + desc: "Debugging messages used for development purposes." + - name: INFO + value: "1" + desc: "General messages not related to debugging, warnings or errors." + - name: WARN + value: "2" + desc: "Used to warn users about potential problems." + - name: ERR + value: "3" + desc: "Used when an error has occurred." + - name: QUIET + value: "4" + desc: "Restrict logger processing any messages." +--- #-------------------------------------------------------------------------- +type: fptr_typedef +desc: "Callback function to retrieve output from the logger." +name: $x_logger_output_callback_t +return: "void" +params: + - type: $x_logger_level_t + name: level + desc: "[out] Minimum level of messages to be processed by the logger." + init: DEBUG + - type: const char* + name: pLoggerMsg + desc: "[in][out] pointer to data to be passed to callback" + - type: void* + name: pUserData + desc: "[in][out] pointer to data to be passed to callback" +--- #-------------------------------------------------------------------------- +type: function +desc: | + Set a callback function for use by the logger to retrieve logging output. + It is a requirement that the callback function is thread safe and the + creator of the function will be responsible for this. +class: $x +name: SetLoggerCallback +decl: static +params: + - type: $x_adapter_handle_t + name: hAdapter + desc: "[in] handle of the adapter" + - type: $x_logger_output_callback_t + name: pfnLoggerCallback + desc: "[in] Function pointer to callback from the logger." + - type: void* + name: pUserData + desc: "[in][out][optional] pointer to data to be passed to callback" + - type: $x_logger_level_t + name: level + desc: "[in] logging level" + init: 0 +--- #-------------------------------------------------------------------------- +type: function +desc: "Set the minimum logging level for the logger Callback function." +class: $x +name: SetLoggerCallbackLevel +decl: static +params: + - type: $x_adapter_handle_t + name: hAdapter + desc: "[in] handle of the adapter" + - type: $x_logger_level_t + name: level + desc: "[in] logging level" diff --git a/scripts/core/registry.yml b/scripts/core/registry.yml index f4ba983bfc..4db75f4a41 100644 --- a/scripts/core/registry.yml +++ b/scripts/core/registry.yml @@ -604,6 +604,12 @@ etors: - name: BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP desc: Enumerator for $xBindlessImagesMapExternalLinearMemoryExp value: '245' +- name: SET_LOGGER_CALLBACK + desc: Enumerator for $xSetLoggerCallback + value: '246' +- name: SET_LOGGER_CALLBACK_LEVEL + desc: Enumerator for $xSetLoggerCallbackLevel + value: '247' --- type: enum desc: Defines structure types diff --git a/source/adapters/cuda/adapter.cpp b/source/adapters/cuda/adapter.cpp index c8949cd9a8..953bd9a8d2 100644 --- a/source/adapters/cuda/adapter.cpp +++ b/source/adapters/cuda/adapter.cpp @@ -29,7 +29,7 @@ class ur_legacy_sink : public logger::Sink { this->ostream = &std::cerr; } - virtual void print([[maybe_unused]] logger::Level level, + virtual void print([[maybe_unused]] ur_logger_level_t level, const std::string &msg) override { std::cerr << msg << std::endl; } @@ -41,7 +41,7 @@ class ur_legacy_sink : public logger::Sink { // through UR entry points. See #1330. ur_adapter_handle_t_::ur_adapter_handle_t_() : logger(logger::get_logger("cuda", - /*default_log_level*/ logger::Level::ERR)) { + /*default_log_level*/ UR_LOGGER_LEVEL_ERR)) { if (std::getenv("UR_LOG_CUDA") != nullptr) return; @@ -114,3 +114,20 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t, return UR_RESULT_SUCCESS; } + +UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( + ur_adapter_handle_t, ur_logger_output_callback_t pfnLoggerCallback, + void *pUserData, ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET) { + + adapter.logger.setCallbackSink(pfnLoggerCallback, pUserData, level); + + return UR_RESULT_SUCCESS; +} + +UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallbackLevel( + ur_adapter_handle_t, ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET) { + + adapter.logger.setCallbackLevel(level); + + return UR_RESULT_SUCCESS; +} diff --git a/source/adapters/cuda/ur_interface_loader.cpp b/source/adapters/cuda/ur_interface_loader.cpp index a9559eb188..81386f3f89 100644 --- a/source/adapters/cuda/ur_interface_loader.cpp +++ b/source/adapters/cuda/ur_interface_loader.cpp @@ -209,6 +209,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( pDdiTable->pfnAdapterRetain = urAdapterRetain; pDdiTable->pfnAdapterGetLastError = urAdapterGetLastError; pDdiTable->pfnAdapterGetInfo = urAdapterGetInfo; + pDdiTable->pfnSetLoggerCallback = urSetLoggerCallback; + pDdiTable->pfnSetLoggerCallbackLevel = urSetLoggerCallbackLevel; return UR_RESULT_SUCCESS; } diff --git a/source/adapters/hip/adapter.cpp b/source/adapters/hip/adapter.cpp index 99db21695f..cd64496c49 100644 --- a/source/adapters/hip/adapter.cpp +++ b/source/adapters/hip/adapter.cpp @@ -28,7 +28,7 @@ class ur_legacy_sink : public logger::Sink { this->ostream = &std::cerr; } - virtual void print([[maybe_unused]] logger::Level level, + virtual void print([[maybe_unused]] ur_logger_level_t level, const std::string &msg) override { std::cerr << msg << std::endl; } @@ -39,8 +39,8 @@ class ur_legacy_sink : public logger::Sink { // FIXME: Remove the default log level when querying logging info is supported // through UR entry points. See #1330. ur_adapter_handle_t_::ur_adapter_handle_t_() - : logger( - logger::get_logger("hip", /*default_log_level*/ logger::Level::ERR)) { + : logger(logger::get_logger("hip", + /*default_log_level*/ UR_LOGGER_LEVEL_ERR)) { if (std::getenv("UR_LOG_HIP") != nullptr) return; @@ -102,3 +102,20 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t, return UR_RESULT_SUCCESS; } + +UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( + ur_adapter_handle_t, ur_logger_output_callback_t pfnLoggerCallback, + void *pUserData, ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET) { + + adapter.logger.setCallbackSink(pfnLoggerCallback, pUserData, level); + + return UR_RESULT_SUCCESS; +} + +UR_APIEXPORT ur_result_t UR_APICALL +urSetLoggerCallbackLevel(ur_adapter_handle_t, ur_logger_level_t level) { + + adapter.logger.setCallbackLevel(level); + + return UR_RESULT_SUCCESS; +} diff --git a/source/adapters/hip/ur_interface_loader.cpp b/source/adapters/hip/ur_interface_loader.cpp index 1454ddfdf1..4bce45db2d 100644 --- a/source/adapters/hip/ur_interface_loader.cpp +++ b/source/adapters/hip/ur_interface_loader.cpp @@ -209,6 +209,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( pDdiTable->pfnAdapterGetLastError = urAdapterGetLastError; pDdiTable->pfnAdapterRelease = urAdapterRelease; pDdiTable->pfnAdapterRetain = urAdapterRetain; + pDdiTable->pfnSetLoggerCallback = urSetLoggerCallback; + pDdiTable->pfnSetLoggerCallbackLevel = urSetLoggerCallbackLevel; return UR_RESULT_SUCCESS; } diff --git a/source/adapters/level_zero/adapter.cpp b/source/adapters/level_zero/adapter.cpp index be79c09fef..ae670bd16c 100644 --- a/source/adapters/level_zero/adapter.cpp +++ b/source/adapters/level_zero/adapter.cpp @@ -40,7 +40,7 @@ class ur_legacy_sink : public logger::Sink { this->ostream = &std::cerr; } - virtual void print([[maybe_unused]] logger::Level level, + virtual void print([[maybe_unused]] ur_logger_level_t level, const std::string &msg) override { fprintf(stderr, "%s", msg.c_str()); } @@ -453,4 +453,26 @@ ur_result_t urAdapterGetInfo(ur_adapter_handle_t, ur_adapter_info_t PropName, return UR_RESULT_SUCCESS; } + +UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( + ur_adapter_handle_t, ur_logger_output_callback_t pfnLoggerCallback, + void *pUserData, ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET) { + + if (GlobalAdapter) { + GlobalAdapter->logger.setCallbackSink(pfnLoggerCallback, pUserData, level); + } + + return UR_RESULT_SUCCESS; +} + +UR_APIEXPORT ur_result_t UR_APICALL +urSetLoggerCallbackLevel(ur_adapter_handle_t, ur_logger_level_t level) { + + if (GlobalAdapter) { + GlobalAdapter->logger.setCallbackLevel(level); + } + + return UR_RESULT_SUCCESS; +} + } // namespace ur::level_zero diff --git a/source/adapters/level_zero/ur_interface_loader.cpp b/source/adapters/level_zero/ur_interface_loader.cpp index 1c2f68c07c..af29f15be1 100644 --- a/source/adapters/level_zero/ur_interface_loader.cpp +++ b/source/adapters/level_zero/ur_interface_loader.cpp @@ -43,6 +43,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( pDdiTable->pfnAdapterRetain = ur::level_zero::urAdapterRetain; pDdiTable->pfnAdapterGetLastError = ur::level_zero::urAdapterGetLastError; pDdiTable->pfnAdapterGetInfo = ur::level_zero::urAdapterGetInfo; + pDdiTable->pfnSetLoggerCallback = ur::level_zero::urSetLoggerCallback; + pDdiTable->pfnSetLoggerCallbackLevel = + ur::level_zero::urSetLoggerCallbackLevel; return result; } diff --git a/source/adapters/level_zero/ur_interface_loader.hpp b/source/adapters/level_zero/ur_interface_loader.hpp index 540eab7292..701e1f2ecf 100644 --- a/source/adapters/level_zero/ur_interface_loader.hpp +++ b/source/adapters/level_zero/ur_interface_loader.hpp @@ -20,6 +20,11 @@ ur_result_t urAdapterGetLastError(ur_adapter_handle_t hAdapter, ur_result_t urAdapterGetInfo(ur_adapter_handle_t hAdapter, ur_adapter_info_t propName, size_t propSize, void *pPropValue, size_t *pPropSizeRet); +ur_result_t urSetLoggerCallback(ur_adapter_handle_t hAdapter, + ur_logger_output_callback_t pfnLoggerCallback, + void *pUserData, ur_logger_level_t level); +ur_result_t urSetLoggerCallbackLevel(ur_adapter_handle_t hAdapter, + ur_logger_level_t level); ur_result_t urPlatformGet(ur_adapter_handle_t *phAdapters, uint32_t NumAdapters, uint32_t NumEntries, ur_platform_handle_t *phPlatforms, diff --git a/source/adapters/mock/ur_mockddi.cpp b/source/adapters/mock/ur_mockddi.cpp index 0ec36ed687..be992a0d01 100644 --- a/source/adapters/mock/ur_mockddi.cpp +++ b/source/adapters/mock/ur_mockddi.cpp @@ -257,6 +257,97 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetInfo( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urSetLoggerCallback +__urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( + 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 + ur_logger_level_t level ///< [in] logging level + ) try { + ur_result_t result = UR_RESULT_SUCCESS; + + ur_set_logger_callback_params_t params = {&hAdapter, &pfnLoggerCallback, + &pUserData, &level}; + + auto beforeCallback = reinterpret_cast( + mock::getCallbacks().get_before_callback("urSetLoggerCallback")); + if (beforeCallback) { + result = beforeCallback(¶ms); + if (result != UR_RESULT_SUCCESS) { + return result; + } + } + + auto replaceCallback = reinterpret_cast( + mock::getCallbacks().get_replace_callback("urSetLoggerCallback")); + if (replaceCallback) { + result = replaceCallback(¶ms); + } else { + + result = UR_RESULT_SUCCESS; + } + + if (result != UR_RESULT_SUCCESS) { + return result; + } + + auto afterCallback = reinterpret_cast( + mock::getCallbacks().get_after_callback("urSetLoggerCallback")); + if (afterCallback) { + return afterCallback(¶ms); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urSetLoggerCallbackLevel +__urdlllocal ur_result_t UR_APICALL urSetLoggerCallbackLevel( + ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter + ur_logger_level_t level ///< [in] logging level + ) try { + ur_result_t result = UR_RESULT_SUCCESS; + + ur_set_logger_callback_level_params_t params = {&hAdapter, &level}; + + auto beforeCallback = reinterpret_cast( + mock::getCallbacks().get_before_callback("urSetLoggerCallbackLevel")); + if (beforeCallback) { + result = beforeCallback(¶ms); + if (result != UR_RESULT_SUCCESS) { + return result; + } + } + + auto replaceCallback = reinterpret_cast( + mock::getCallbacks().get_replace_callback("urSetLoggerCallbackLevel")); + if (replaceCallback) { + result = replaceCallback(¶ms); + } else { + + result = UR_RESULT_SUCCESS; + } + + if (result != UR_RESULT_SUCCESS) { + return result; + } + + auto afterCallback = reinterpret_cast( + mock::getCallbacks().get_after_callback("urSetLoggerCallbackLevel")); + if (afterCallback) { + return afterCallback(¶ms); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urPlatformGet __urdlllocal ur_result_t UR_APICALL urPlatformGet( @@ -10698,6 +10789,10 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( pDdiTable->pfnAdapterGetInfo = driver::urAdapterGetInfo; + pDdiTable->pfnSetLoggerCallback = driver::urSetLoggerCallback; + + pDdiTable->pfnSetLoggerCallbackLevel = driver::urSetLoggerCallbackLevel; + return result; } catch (...) { return exceptionToResult(std::current_exception()); diff --git a/source/adapters/native_cpu/adapter.cpp b/source/adapters/native_cpu/adapter.cpp index 2b5b95ccd0..9ce6c29258 100644 --- a/source/adapters/native_cpu/adapter.cpp +++ b/source/adapters/native_cpu/adapter.cpp @@ -63,3 +63,20 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t, return UR_RESULT_SUCCESS; } + +UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( + ur_adapter_handle_t, ur_logger_output_callback_t pfnLoggerCallback, + void *pUserData, ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET) { + + Adapter.logger.setCallbackSink(pfnLoggerCallback, pUserData, level); + + return UR_RESULT_SUCCESS; +} + +UR_APIEXPORT ur_result_t UR_APICALL +urSetLoggerCallbackLevel(ur_adapter_handle_t, ur_logger_level_t level) { + + Adapter.logger.setCallbackLevel(level); + + return UR_RESULT_SUCCESS; +} diff --git a/source/adapters/native_cpu/ur_interface_loader.cpp b/source/adapters/native_cpu/ur_interface_loader.cpp index 94c6c4a03e..d61db694bf 100644 --- a/source/adapters/native_cpu/ur_interface_loader.cpp +++ b/source/adapters/native_cpu/ur_interface_loader.cpp @@ -206,6 +206,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( pDdiTable->pfnAdapterGetInfo = urAdapterGetInfo; pDdiTable->pfnAdapterRelease = urAdapterRelease; pDdiTable->pfnAdapterRetain = urAdapterRetain; + pDdiTable->pfnSetLoggerCallback = urSetLoggerCallback; + pDdiTable->pfnSetLoggerCallbackLevel = urSetLoggerCallbackLevel; return UR_RESULT_SUCCESS; } diff --git a/source/adapters/opencl/adapter.cpp b/source/adapters/opencl/adapter.cpp index 1decaa92ca..10fe6062b4 100644 --- a/source/adapters/opencl/adapter.cpp +++ b/source/adapters/opencl/adapter.cpp @@ -101,3 +101,24 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t, return UR_RESULT_SUCCESS; } + +UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( + ur_adapter_handle_t, ur_logger_output_callback_t pfnLoggerCallback, + void *pUserData, ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET) { + + if (adapter) { + adapter->log.setCallbackSink(pfnLoggerCallback, pUserData, level); + } + + return UR_RESULT_SUCCESS; +} + +UR_APIEXPORT ur_result_t UR_APICALL +urSetLoggerCallbackLevel(ur_adapter_handle_t, ur_logger_level_t level) { + + if (adapter) { + adapter->log.setCallbackLevel(level); + } + + return UR_RESULT_SUCCESS; +} diff --git a/source/adapters/opencl/ur_interface_loader.cpp b/source/adapters/opencl/ur_interface_loader.cpp index 6cd69d84d3..676438e3c8 100644 --- a/source/adapters/opencl/ur_interface_loader.cpp +++ b/source/adapters/opencl/ur_interface_loader.cpp @@ -208,6 +208,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( pDdiTable->pfnAdapterRetain = urAdapterRetain; pDdiTable->pfnAdapterGetLastError = urAdapterGetLastError; pDdiTable->pfnAdapterGetInfo = urAdapterGetInfo; + pDdiTable->pfnSetLoggerCallback = urSetLoggerCallback; + pDdiTable->pfnSetLoggerCallbackLevel = urSetLoggerCallbackLevel; return UR_RESULT_SUCCESS; } diff --git a/source/common/logger/ur_level.hpp b/source/common/logger/ur_level.hpp index 9d532213ee..1149409e24 100644 --- a/source/common/logger/ur_level.hpp +++ b/source/common/logger/ur_level.hpp @@ -8,22 +8,21 @@ #include #include +#include namespace logger { -enum class Level { DEBUG, INFO, WARN, ERR, QUIET }; - -inline constexpr auto level_to_str(Level level) { +inline constexpr auto level_to_str(ur_logger_level_t level) { switch (level) { - case Level::DEBUG: + case UR_LOGGER_LEVEL_DEBUG: return "DEBUG"; - case Level::INFO: + case UR_LOGGER_LEVEL_INFO: return "INFO"; - case Level::WARN: + case UR_LOGGER_LEVEL_WARN: return "WARNING"; - case Level::ERR: + case UR_LOGGER_LEVEL_ERR: return "ERROR"; - case Level::QUIET: + case UR_LOGGER_LEVEL_QUIET: return "QUIET"; default: return ""; @@ -31,26 +30,26 @@ inline constexpr auto level_to_str(Level level) { } inline auto str_to_level(std::string name) { - struct lvl_name { + struct level_name { std::string name; - Level lvl; + ur_logger_level_t level; }; - const lvl_name lvl_names[] = {{"debug", Level::DEBUG}, - {"info", Level::INFO}, - {"warning", Level::WARN}, - {"error", Level::ERR}, - {"quiet", Level::QUIET}}; + const level_name level_names[] = {{"debug", UR_LOGGER_LEVEL_DEBUG}, + {"info", UR_LOGGER_LEVEL_INFO}, + {"warning", UR_LOGGER_LEVEL_WARN}, + {"error", UR_LOGGER_LEVEL_ERR}, + {"quiet", UR_LOGGER_LEVEL_QUIET}}; - for (auto const &item : lvl_names) { + for (auto const &item : level_names) { if (item.name.compare(name) == 0) { - return item.lvl; + return item.level; } } throw std::invalid_argument( std::string("Parsing error: no valid log level for string '") + name + std::string("'.") + - std::string("\nValid log level names are: debug, info, warning, error, " + std::string("\nValid log level names are: debug, info, warning, error " "and quiet")); } diff --git a/source/common/logger/ur_logger.hpp b/source/common/logger/ur_logger.hpp index c4dc655444..18bbf90721 100644 --- a/source/common/logger/ur_logger.hpp +++ b/source/common/logger/ur_logger.hpp @@ -14,13 +14,14 @@ namespace logger { -Logger create_logger(std::string logger_name, bool skip_prefix = false, - bool skip_linebreak = false, - logger::Level default_log_level = logger::Level::QUIET); +Logger +create_logger(std::string logger_name, bool skip_prefix = false, + bool skip_linebreak = false, + ur_logger_level_t default_log_level = UR_LOGGER_LEVEL_QUIET); inline Logger & get_logger(std::string name = "common", - logger::Level default_log_level = logger::Level::QUIET) { + ur_logger_level_t default_log_level = UR_LOGGER_LEVEL_QUIET) { static Logger logger = create_logger(std::move(name), /*skip_prefix*/ false, /*slip_linebreak*/ false, default_log_level); @@ -31,22 +32,23 @@ inline void init(const std::string &name) { get_logger(name.c_str()); } template inline void debug(const char *format, Args &&...args) { - get_logger().log(logger::Level::DEBUG, format, std::forward(args)...); + get_logger().log(UR_LOGGER_LEVEL_DEBUG, format, + std::forward(args)...); } template inline void info(const char *format, Args &&...args) { - get_logger().log(logger::Level::INFO, format, std::forward(args)...); + get_logger().log(UR_LOGGER_LEVEL_INFO, format, std::forward(args)...); } template inline void warning(const char *format, Args &&...args) { - get_logger().log(logger::Level::WARN, format, std::forward(args)...); + get_logger().log(UR_LOGGER_LEVEL_WARN, format, std::forward(args)...); } template inline void error(const char *format, Args &&...args) { - get_logger().log(logger::Level::ERR, format, std::forward(args)...); + get_logger().log(UR_LOGGER_LEVEL_ERR, format, std::forward(args)...); } template @@ -57,32 +59,32 @@ inline void always(const char *format, Args &&...args) { template inline void debug(const logger::LegacyMessage &p, const char *format, Args &&...args) { - get_logger().log(p, logger::Level::DEBUG, format, + get_logger().log(p, UR_LOGGER_LEVEL_DEBUG, format, std::forward(args)...); } template inline void info(logger::LegacyMessage p, const char *format, Args &&...args) { - get_logger().log(p, logger::Level::INFO, format, + get_logger().log(p, UR_LOGGER_LEVEL_INFO, format, std::forward(args)...); } template inline void warning(logger::LegacyMessage p, const char *format, Args &&...args) { - get_logger().log(p, logger::Level::WARN, format, + get_logger().log(p, UR_LOGGER_LEVEL_WARN, format, std::forward(args)...); } template inline void error(logger::LegacyMessage p, const char *format, Args &&...args) { - get_logger().log(p, logger::Level::ERR, format, + get_logger().log(p, UR_LOGGER_LEVEL_ERR, format, std::forward(args)...); } -inline void setLevel(logger::Level level) { get_logger().setLevel(level); } +inline void setLevel(ur_logger_level_t level) { get_logger().setLevel(level); } -inline void setFlushLevel(logger::Level level) { +inline void setFlushLevel(ur_logger_level_t level) { get_logger().setFlushLevel(level); } @@ -114,14 +116,12 @@ template inline std::string toHex(T t) { /// to be printed immediately as they occur /// - output: stderr inline Logger create_logger(std::string logger_name, bool skip_prefix, - bool skip_linebreak, - logger::Level default_log_level) { + bool skip_linebreak, ur_logger_level_t level) { std::transform(logger_name.begin(), logger_name.end(), logger_name.begin(), ::toupper); std::stringstream env_var_name; - const auto default_flush_level = logger::Level::ERR; + const auto default_flush_level = UR_LOGGER_LEVEL_ERR; const std::string default_output = "stderr"; - auto level = default_log_level; auto flush_level = default_flush_level; std::unique_ptr sink; @@ -129,10 +129,9 @@ inline Logger create_logger(std::string logger_name, bool skip_prefix, try { auto map = getenv_to_map(env_var_name.str().c_str()); if (!map.has_value()) { - return Logger( - default_log_level, - std::make_unique( - std::move(logger_name), skip_prefix, skip_linebreak)); + return Logger(level, std::make_unique( + std::move(logger_name), skip_prefix, + skip_linebreak)); } auto kv = map->find("level"); @@ -160,10 +159,9 @@ inline Logger create_logger(std::string logger_name, bool skip_prefix, std::cerr << "Wrong logger environment variable parameter: '" << map->begin()->first << "'. Default logger options are set."; - return Logger( - default_log_level, - std::make_unique( - std::move(logger_name), skip_prefix, skip_linebreak)); + return Logger(level, std::make_unique( + std::move(logger_name), skip_prefix, + skip_linebreak)); } sink = values.size() == 2 @@ -175,7 +173,7 @@ inline Logger create_logger(std::string logger_name, bool skip_prefix, std::cerr << "Error when creating a logger instance from the '" << env_var_name.str() << "' environment variable:\n" << e.what() << std::endl; - return Logger(default_log_level, + return Logger(level, std::make_unique( std::move(logger_name), skip_prefix, skip_linebreak)); } diff --git a/source/common/logger/ur_logger_details.hpp b/source/common/logger/ur_logger_details.hpp index 9c9462935e..cb6f9fceb3 100644 --- a/source/common/logger/ur_logger_details.hpp +++ b/source/common/logger/ur_logger_details.hpp @@ -18,37 +18,45 @@ struct LegacyMessage { class Logger { public: - Logger(std::unique_ptr sink) : sink(std::move(sink)) { - this->level = logger::Level::QUIET; - } - - Logger(logger::Level level, std::unique_ptr sink) - : level(level), sink(std::move(sink)) {} + Logger(std::unique_ptr sink, + std::unique_ptr callbackSink = nullptr) + : standardSinkLevel(UR_LOGGER_LEVEL_QUIET), + standardSink(std::move(sink)), + callbackSinkLevel(UR_LOGGER_LEVEL_QUIET), + callbackSink(std::move(callbackSink)) {} + + Logger(ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET, + std::unique_ptr sink = nullptr, + ur_logger_level_t callbackSinkLevel = UR_LOGGER_LEVEL_QUIET, + std::unique_ptr callbackSink = nullptr) + : standardSinkLevel(level), standardSink(std::move(sink)), + callbackSinkLevel(callbackSinkLevel), + callbackSink(std::move(callbackSink)) {} Logger &operator=(Logger &&) = default; ~Logger() = default; - void setLevel(logger::Level level) { this->level = level; } + void setLevel(ur_logger_level_t level) { this->standardSinkLevel = level; } - logger::Level getLevel() { return this->level; } + ur_logger_level_t getLevel() { return this->standardSinkLevel; } - void setFlushLevel(logger::Level level) { - if (sink) { - this->sink->setFlushLevel(level); + void setFlushLevel(ur_logger_level_t level) { + if (standardSink) { + this->standardSink->setFlushLevel(level); } } template void debug(const char *format, Args &&...args) { - log(logger::Level::DEBUG, format, std::forward(args)...); + log(UR_LOGGER_LEVEL_DEBUG, format, std::forward(args)...); } template void info(const char *format, Args &&...args) { - log(logger::Level::INFO, format, std::forward(args)...); + log(UR_LOGGER_LEVEL_INFO, format, std::forward(args)...); } template void warning(const char *format, Args &&...args) { - log(logger::Level::WARN, format, std::forward(args)...); + log(UR_LOGGER_LEVEL_WARN, format, std::forward(args)...); } template void warn(const char *format, Args &&...args) { @@ -56,74 +64,93 @@ class Logger { } template void error(const char *format, Args &&...args) { - log(logger::Level::ERR, format, std::forward(args)...); + log(UR_LOGGER_LEVEL_ERR, format, std::forward(args)...); } template void always(const char *format, Args &&...args) { - if (sink) { - sink->log(logger::Level::QUIET, format, - std::forward(args)...); + if (standardSink) { + standardSink->log(UR_LOGGER_LEVEL_QUIET, format, + std::forward(args)...); } } template void debug(const logger::LegacyMessage &p, const char *format, Args &&...args) { - log(p, logger::Level::DEBUG, format, std::forward(args)...); + log(p, UR_LOGGER_LEVEL_DEBUG, format, std::forward(args)...); } template void info(const logger::LegacyMessage &p, const char *format, Args &&...args) { - log(p, logger::Level::INFO, format, std::forward(args)...); + log(p, UR_LOGGER_LEVEL_INFO, format, std::forward(args)...); } template void warning(const logger::LegacyMessage &p, const char *format, Args &&...args) { - log(p, logger::Level::WARN, format, std::forward(args)...); + log(p, UR_LOGGER_LEVEL_WARN, format, std::forward(args)...); } template void error(const logger::LegacyMessage &p, const char *format, Args &&...args) { - log(p, logger::Level::ERR, format, std::forward(args)...); + log(p, UR_LOGGER_LEVEL_ERR, format, std::forward(args)...); } template - void log(logger::Level level, const char *format, Args &&...args) { + void log(ur_logger_level_t level, const char *format, Args &&...args) { log(logger::LegacyMessage(format), level, format, std::forward(args)...); } template - void log(const logger::LegacyMessage &p, logger::Level level, + void log(const logger::LegacyMessage &p, ur_logger_level_t level, const char *format, Args &&...args) { - if (!sink) { - return; + if (callbackSink && level >= this->callbackSinkLevel) { + callbackSink->log(level, format, std::forward(args)...); } - if (isLegacySink) { - sink->log(level, p.message, std::forward(args)...); - return; - } - if (level < this->level) { - return; + if (standardSink) { + if (isLegacySink) { + standardSink->log(level, p.message, + std::forward(args)...); + return; + } + + if (level < this->standardSinkLevel) { + return; + } + standardSink->log(level, format, std::forward(args)...); } - - sink->log(level, format, std::forward(args)...); } void setLegacySink(std::unique_ptr legacySink) { this->isLegacySink = true; - this->sink = std::move(legacySink); + this->standardSink = std::move(legacySink); + } + + void setCallbackSink(ur_logger_output_callback_t cb, void *pUserData, + ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET) { + if (!callbackSink) { + callbackSink = std::make_unique("UR_LOG_CALLBACK"); + } + callbackSinkLevel = level; + callbackSink->setCallback(cb, pUserData); + } + + void setCallbackLevel(ur_logger_level_t level) { + this->callbackSinkLevel = level; } private: - logger::Level level; - std::unique_ptr sink; + ur_logger_level_t standardSinkLevel; + std::unique_ptr standardSink; bool isLegacySink = false; + + ur_logger_level_t callbackSinkLevel; + std::unique_ptr callbackSink; }; } // namespace logger diff --git a/source/common/logger/ur_sinks.hpp b/source/common/logger/ur_sinks.hpp index e0d8144a31..f6799578fc 100644 --- a/source/common/logger/ur_sinks.hpp +++ b/source/common/logger/ur_sinks.hpp @@ -7,10 +7,12 @@ #define UR_SINKS_HPP 1 #include +#include #include #include #include +#include "ur_api.h" #include "ur_filesystem_resolved.hpp" #include "ur_level.hpp" #include "ur_print.hpp" @@ -24,9 +26,9 @@ inline bool isTearDowned = false; class Sink { public: template - void log(logger::Level level, const char *fmt, Args &&...args) { + void log(ur_logger_level_t level, const char *fmt, Args &&...args) { std::ostringstream buffer; - if (!skip_prefix && level != logger::Level::QUIET) { + if (!skip_prefix && level != UR_LOGGER_LEVEL_QUIET) { buffer << "<" << logger_name << ">" << "[" << level_to_str(level) << "]: "; } @@ -49,23 +51,23 @@ class Sink { #endif } - void setFlushLevel(logger::Level level) { this->flush_level = level; } + void setFlushLevel(ur_logger_level_t level) { this->flush_level = level; } virtual ~Sink() = default; protected: std::ostream *ostream; - logger::Level flush_level; + ur_logger_level_t flush_level; Sink(std::string logger_name, bool skip_prefix = false, bool skip_linebreak = false) : logger_name(std::move(logger_name)), skip_prefix(skip_prefix), skip_linebreak(skip_linebreak) { ostream = nullptr; - flush_level = logger::Level::ERR; + flush_level = UR_LOGGER_LEVEL_ERR; } - virtual void print(logger::Level level, const std::string &msg) { + virtual void print(ur_logger_level_t level, const std::string &msg) { std::scoped_lock lock(output_mutex); *ostream << msg; if (level >= flush_level) { @@ -158,7 +160,7 @@ class StdoutSink : public Sink { this->ostream = &std::cout; } - StdoutSink(std::string logger_name, Level flush_lvl, + StdoutSink(std::string logger_name, ur_logger_level_t flush_lvl, bool skip_prefix = false, bool skip_linebreak = false) : StdoutSink(std::move(logger_name), skip_prefix, skip_linebreak) { this->flush_level = flush_lvl; @@ -175,8 +177,8 @@ class StderrSink : public Sink { this->ostream = &std::cerr; } - StderrSink(std::string logger_name, Level flush_lvl, bool skip_prefix, - bool skip_linebreak) + StderrSink(std::string logger_name, ur_logger_level_t flush_lvl, + bool skip_prefix, bool skip_linebreak) : StderrSink(std::move(logger_name), skip_prefix, skip_linebreak) { this->flush_level = flush_lvl; } @@ -200,7 +202,7 @@ class FileSink : public Sink { } FileSink(std::string logger_name, filesystem::path file_path, - Level flush_lvl, bool skip_prefix = false, + ur_logger_level_t flush_lvl, bool skip_prefix = false, bool skip_linebreak = false) : FileSink(std::move(logger_name), std::move(file_path), skip_prefix, skip_linebreak) { @@ -213,6 +215,35 @@ class FileSink : public Sink { std::ofstream ofstream; }; +class CallbackSink : public Sink { + public: + CallbackSink(std::string logger_name, bool skip_prefix = false, + bool skip_linebreak = false) + : Sink(std::move(logger_name), skip_prefix, skip_linebreak) {} + + CallbackSink(std::string logger_name, ur_logger_level_t flush_lvl, + bool skip_prefix, bool skip_linebreak) + : CallbackSink(std::move(logger_name), skip_prefix, skip_linebreak) { + this->flush_level = flush_lvl; + } + + ~CallbackSink() = default; + + void setCallback(ur_logger_output_callback_t cb, void *pUserData) { + callback = cb; + userData = pUserData; + } + + private: + ur_logger_output_callback_t callback; + void *userData; + + virtual void print(ur_logger_level_t level, + const std::string &msg) override { + callback(level, msg.c_str(), userData); + } +}; + inline std::unique_ptr sink_from_str(std::string logger_name, std::string name, filesystem::path file_path = "", diff --git a/source/loader/layers/sanitizer/ur_sanitizer_layer.cpp b/source/loader/layers/sanitizer/ur_sanitizer_layer.cpp index b94235cdf0..badec90df1 100644 --- a/source/loader/layers/sanitizer/ur_sanitizer_layer.cpp +++ b/source/loader/layers/sanitizer/ur_sanitizer_layer.cpp @@ -19,7 +19,7 @@ context_t *getContext() { return context_t::get_direct(); } /////////////////////////////////////////////////////////////////////////////// context_t::context_t() : logger(logger::create_logger("sanitizer", false, false, - logger::Level::WARN)) {} + UR_LOGGER_LEVEL_WARN)) {} ur_result_t context_t::tearDown() { return UR_RESULT_SUCCESS; } diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index 57d7fe3702..eee96a54ea 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -216,6 +216,86 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetInfo( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urSetLoggerCallback +__urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( + 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 + ur_logger_level_t level ///< [in] logging level +) { + auto pfnSetLoggerCallback = + getContext()->urDdiTable.Global.pfnSetLoggerCallback; + + if (nullptr == pfnSetLoggerCallback) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_set_logger_callback_params_t params = {&hAdapter, &pfnLoggerCallback, + &pUserData, &level}; + uint64_t instance = getContext()->notify_begin( + UR_FUNCTION_SET_LOGGER_CALLBACK, "urSetLoggerCallback", ¶ms); + + auto &logger = getContext()->logger; + logger.info(" ---> urSetLoggerCallback\n"); + + ur_result_t result = + pfnSetLoggerCallback(hAdapter, pfnLoggerCallback, pUserData, level); + + getContext()->notify_end(UR_FUNCTION_SET_LOGGER_CALLBACK, + "urSetLoggerCallback", ¶ms, &result, instance); + + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_SET_LOGGER_CALLBACK, ¶ms); + logger.info(" <--- urSetLoggerCallback({}) -> {};\n", args_str.str(), + result); + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urSetLoggerCallbackLevel +__urdlllocal ur_result_t UR_APICALL urSetLoggerCallbackLevel( + ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter + ur_logger_level_t level ///< [in] logging level +) { + auto pfnSetLoggerCallbackLevel = + getContext()->urDdiTable.Global.pfnSetLoggerCallbackLevel; + + if (nullptr == pfnSetLoggerCallbackLevel) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_set_logger_callback_level_params_t params = {&hAdapter, &level}; + uint64_t instance = + getContext()->notify_begin(UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL, + "urSetLoggerCallbackLevel", ¶ms); + + auto &logger = getContext()->logger; + logger.info(" ---> urSetLoggerCallbackLevel\n"); + + ur_result_t result = pfnSetLoggerCallbackLevel(hAdapter, level); + + getContext()->notify_end(UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL, + "urSetLoggerCallbackLevel", ¶ms, &result, + instance); + + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL, ¶ms); + logger.info(" <--- urSetLoggerCallbackLevel({}) -> {};\n", + args_str.str(), result); + } + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urPlatformGet __urdlllocal ur_result_t UR_APICALL urPlatformGet( @@ -9201,6 +9281,13 @@ __urdlllocal ur_result_t UR_APICALL urGetGlobalProcAddrTable( dditable.pfnAdapterGetInfo = pDdiTable->pfnAdapterGetInfo; pDdiTable->pfnAdapterGetInfo = ur_tracing_layer::urAdapterGetInfo; + dditable.pfnSetLoggerCallback = pDdiTable->pfnSetLoggerCallback; + pDdiTable->pfnSetLoggerCallback = ur_tracing_layer::urSetLoggerCallback; + + dditable.pfnSetLoggerCallbackLevel = pDdiTable->pfnSetLoggerCallbackLevel; + pDdiTable->pfnSetLoggerCallbackLevel = + ur_tracing_layer::urSetLoggerCallbackLevel; + return result; } /////////////////////////////////////////////////////////////////////////////// diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 0911745f03..6e9b9dfa48 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -202,6 +202,81 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetInfo( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urSetLoggerCallback +__urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( + 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 + ur_logger_level_t level ///< [in] logging level +) { + auto pfnSetLoggerCallback = + getContext()->urDdiTable.Global.pfnSetLoggerCallback; + + if (nullptr == pfnSetLoggerCallback) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (getContext()->enableParameterValidation) { + if (NULL == hAdapter) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == pfnLoggerCallback) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (UR_LOGGER_LEVEL_QUIET < level) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hAdapter)) { + getContext()->refCountContext->logInvalidReference(hAdapter); + } + + ur_result_t result = + pfnSetLoggerCallback(hAdapter, pfnLoggerCallback, pUserData, level); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urSetLoggerCallbackLevel +__urdlllocal ur_result_t UR_APICALL urSetLoggerCallbackLevel( + ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter + ur_logger_level_t level ///< [in] logging level +) { + auto pfnSetLoggerCallbackLevel = + getContext()->urDdiTable.Global.pfnSetLoggerCallbackLevel; + + if (nullptr == pfnSetLoggerCallbackLevel) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (getContext()->enableParameterValidation) { + if (NULL == hAdapter) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (UR_LOGGER_LEVEL_QUIET < level) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + } + + if (getContext()->enableLifetimeValidation && + !getContext()->refCountContext->isReferenceValid(hAdapter)) { + getContext()->refCountContext->logInvalidReference(hAdapter); + } + + ur_result_t result = pfnSetLoggerCallbackLevel(hAdapter, level); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urPlatformGet __urdlllocal ur_result_t UR_APICALL urPlatformGet( @@ -10236,6 +10311,13 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( dditable.pfnAdapterGetInfo = pDdiTable->pfnAdapterGetInfo; pDdiTable->pfnAdapterGetInfo = ur_validation_layer::urAdapterGetInfo; + dditable.pfnSetLoggerCallback = pDdiTable->pfnSetLoggerCallback; + pDdiTable->pfnSetLoggerCallback = ur_validation_layer::urSetLoggerCallback; + + dditable.pfnSetLoggerCallbackLevel = pDdiTable->pfnSetLoggerCallbackLevel; + pDdiTable->pfnSetLoggerCallbackLevel = + ur_validation_layer::urSetLoggerCallbackLevel; + return result; } diff --git a/source/loader/loader.def.in b/source/loader/loader.def.in index c34bde6fd2..743a40164f 100644 --- a/source/loader/loader.def.in +++ b/source/loader/loader.def.in @@ -373,6 +373,7 @@ EXPORTS urPrintLoaderConfigSetMockingEnabledParams urPrintLoaderInitParams urPrintLoaderTearDownParams + urPrintLoggerLevel urPrintMapFlags urPrintMemBufferCreateParams urPrintMemBufferCreateWithNativeHandleParams @@ -458,6 +459,8 @@ EXPORTS urPrintSamplerNativeProperties urPrintSamplerReleaseParams urPrintSamplerRetainParams + urPrintSetLoggerCallbackLevelParams + urPrintSetLoggerCallbackParams urPrintSpecializationConstantInfo urPrintStructureType urPrintUsmAdviceFlags @@ -530,6 +533,8 @@ EXPORTS urSamplerGetNativeHandle urSamplerRelease urSamplerRetain + urSetLoggerCallback + urSetLoggerCallbackLevel urUSMDeviceAlloc urUSMFree urUSMGetMemAllocInfo diff --git a/source/loader/loader.map.in b/source/loader/loader.map.in index 8333ee2fa4..6c8d48c876 100644 --- a/source/loader/loader.map.in +++ b/source/loader/loader.map.in @@ -373,6 +373,7 @@ urPrintLoaderConfigSetMockingEnabledParams; urPrintLoaderInitParams; urPrintLoaderTearDownParams; + urPrintLoggerLevel; urPrintMapFlags; urPrintMemBufferCreateParams; urPrintMemBufferCreateWithNativeHandleParams; @@ -458,6 +459,8 @@ urPrintSamplerNativeProperties; urPrintSamplerReleaseParams; urPrintSamplerRetainParams; + urPrintSetLoggerCallbackLevelParams; + urPrintSetLoggerCallbackParams; urPrintSpecializationConstantInfo; urPrintStructureType; urPrintUsmAdviceFlags; @@ -530,6 +533,8 @@ urSamplerGetNativeHandle; urSamplerRelease; urSamplerRetain; + urSetLoggerCallback; + urSetLoggerCallbackLevel; urUSMDeviceAlloc; urUSMFree; urUSMGetMemAllocInfo; diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 4e50271b58..7a0f1e4888 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -180,6 +180,64 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetInfo( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urSetLoggerCallback +__urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( + 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 + ur_logger_level_t level ///< [in] logging level +) { + ur_result_t result = UR_RESULT_SUCCESS; + + [[maybe_unused]] auto context = getContext(); + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hAdapter)->dditable; + auto pfnSetLoggerCallback = dditable->ur.Global.pfnSetLoggerCallback; + if (nullptr == pfnSetLoggerCallback) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hAdapter = reinterpret_cast(hAdapter)->handle; + + // forward to device-platform + result = + pfnSetLoggerCallback(hAdapter, pfnLoggerCallback, pUserData, level); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urSetLoggerCallbackLevel +__urdlllocal ur_result_t UR_APICALL urSetLoggerCallbackLevel( + ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter + ur_logger_level_t level ///< [in] logging level +) { + ur_result_t result = UR_RESULT_SUCCESS; + + [[maybe_unused]] auto context = getContext(); + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hAdapter)->dditable; + auto pfnSetLoggerCallbackLevel = + dditable->ur.Global.pfnSetLoggerCallbackLevel; + if (nullptr == pfnSetLoggerCallbackLevel) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hAdapter = reinterpret_cast(hAdapter)->handle; + + // forward to device-platform + result = pfnSetLoggerCallbackLevel(hAdapter, level); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urPlatformGet __urdlllocal ur_result_t UR_APICALL urPlatformGet( @@ -9347,6 +9405,9 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( pDdiTable->pfnAdapterGetLastError = ur_loader::urAdapterGetLastError; pDdiTable->pfnAdapterGetInfo = ur_loader::urAdapterGetInfo; + pDdiTable->pfnSetLoggerCallback = ur_loader::urSetLoggerCallback; + pDdiTable->pfnSetLoggerCallbackLevel = + ur_loader::urSetLoggerCallbackLevel; } else { // return pointers directly to platform's DDIs *pDdiTable = diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index ca6d4da65d..4564f173d4 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -487,6 +487,68 @@ ur_result_t UR_APICALL urAdapterGetInfo( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set a callback function for use by the logger to retrieve logging output. +/// It is a requirement that the callback function is thread safe and the +/// creator of the function will be responsible for this. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hAdapter` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pfnLoggerCallback` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_LOGGER_LEVEL_QUIET < level` +ur_result_t UR_APICALL urSetLoggerCallback( + 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 + ur_logger_level_t level ///< [in] logging level + ) try { + auto pfnSetLoggerCallback = + ur_lib::getContext()->urDdiTable.Global.pfnSetLoggerCallback; + if (nullptr == pfnSetLoggerCallback) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnSetLoggerCallback(hAdapter, pfnLoggerCallback, pUserData, level); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the minimum logging level for the logger Callback function. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hAdapter` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_LOGGER_LEVEL_QUIET < level` +ur_result_t UR_APICALL urSetLoggerCallbackLevel( + ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter + ur_logger_level_t level ///< [in] logging level + ) try { + auto pfnSetLoggerCallbackLevel = + ur_lib::getContext()->urDdiTable.Global.pfnSetLoggerCallbackLevel; + if (nullptr == pfnSetLoggerCallbackLevel) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnSetLoggerCallbackLevel(hAdapter, level); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves all available platforms for the given adapters /// diff --git a/source/loader/ur_print.cpp b/source/loader/ur_print.cpp index 3a14d9a9de..21e9bfcf1b 100644 --- a/source/loader/ur_print.cpp +++ b/source/loader/ur_print.cpp @@ -128,6 +128,13 @@ ur_result_t urPrintAdapterBackend(enum ur_adapter_backend_t value, char *buffer, return str_copy(&ss, buffer, buff_size, out_size); } +ur_result_t urPrintLoggerLevel(enum ur_logger_level_t value, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << value; + return str_copy(&ss, buffer, buff_size, out_size); +} + ur_result_t urPrintPlatformInfo(enum ur_platform_info_t value, char *buffer, const size_t buff_size, size_t *out_size) { std::stringstream ss; @@ -1129,6 +1136,22 @@ urPrintAdapterGetInfoParams(const struct ur_adapter_get_info_params_t *params, return str_copy(&ss, buffer, buff_size, out_size); } +ur_result_t urPrintSetLoggerCallbackParams( + const struct ur_set_logger_callback_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + +ur_result_t urPrintSetLoggerCallbackLevelParams( + const struct ur_set_logger_callback_level_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size) { + std::stringstream ss; + ss << params; + return str_copy(&ss, buffer, buff_size, out_size); +} + ur_result_t urPrintBindlessImagesUnsampledImageHandleDestroyExpParams( const struct ur_bindless_images_unsampled_image_handle_destroy_exp_params_t *params, diff --git a/source/ur_api.cpp b/source/ur_api.cpp index cdfdb648af..2c455ca48d 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -438,6 +438,54 @@ ur_result_t UR_APICALL urAdapterGetInfo( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set a callback function for use by the logger to retrieve logging output. +/// It is a requirement that the callback function is thread safe and the +/// creator of the function will be responsible for this. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hAdapter` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pfnLoggerCallback` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_LOGGER_LEVEL_QUIET < level` +ur_result_t UR_APICALL urSetLoggerCallback( + 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 + ur_logger_level_t level ///< [in] logging level +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the minimum logging level for the logger Callback function. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hAdapter` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_LOGGER_LEVEL_QUIET < level` +ur_result_t UR_APICALL urSetLoggerCallbackLevel( + ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter + ur_logger_level_t level ///< [in] logging level +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves all available platforms for the given adapters /// diff --git a/test/unit/logger/fixtures.hpp b/test/unit/logger/fixtures.hpp index 1e973938cc..3601f5973b 100644 --- a/test/unit/logger/fixtures.hpp +++ b/test/unit/logger/fixtures.hpp @@ -91,9 +91,20 @@ class DefaultLoggerWithFileSink : public UniquePtrLoggerWithFilesink { protected: void SetUp() override { logger = std::make_unique( - logger::Level::WARN, + UR_LOGGER_LEVEL_WARN, std::make_unique(logger_name, file_path)); } }; +class LoggerWithCallbackSink : public ::testing::Test { + protected: + std::unique_ptr logger; + + void SetUp() override { + logger = std::make_unique( + UR_LOGGER_LEVEL_QUIET, nullptr, UR_LOGGER_LEVEL_WARN, + std::make_unique("UR_LOG_CALLBACK")); + } +}; + #endif // UR_UNIT_LOGGER_TEST_FIXTURES_HPP diff --git a/test/unit/logger/logger.cpp b/test/unit/logger/logger.cpp index df1bc50e7f..f5cb318f0f 100644 --- a/test/unit/logger/logger.cpp +++ b/test/unit/logger/logger.cpp @@ -9,6 +9,7 @@ #include "fixtures.hpp" #include "logger/ur_logger_details.hpp" +#include "ur_api.h" ////////////////////////////////////////////////////////////////////////////// TEST_F(DefaultLoggerWithFileSink, DefaultLevelNoOutput) { @@ -51,7 +52,7 @@ TEST_F(DefaultLoggerWithFileSink, NoBraces) { } TEST_F(DefaultLoggerWithFileSink, SetLevelDebug) { - auto level = logger::Level::DEBUG; + auto level = UR_LOGGER_LEVEL_DEBUG; logger->setLevel(level); logger->setFlushLevel(level); logger->debug("Test message: {}", "success"); @@ -60,7 +61,7 @@ TEST_F(DefaultLoggerWithFileSink, SetLevelDebug) { } TEST_F(DefaultLoggerWithFileSink, SetLevelInfo) { - auto level = logger::Level::INFO; + auto level = UR_LOGGER_LEVEL_INFO; logger->setLevel(level); logger->setFlushLevel(level); logger->info("Test message: {}", "success"); @@ -70,7 +71,7 @@ TEST_F(DefaultLoggerWithFileSink, SetLevelInfo) { } TEST_F(DefaultLoggerWithFileSink, SetLevelWarning) { - auto level = logger::Level::WARN; + auto level = UR_LOGGER_LEVEL_WARN; logger->setLevel(level); logger->warning("Test message: {}", "success"); logger->info("This should not be printed: {}", 42); @@ -79,7 +80,7 @@ TEST_F(DefaultLoggerWithFileSink, SetLevelWarning) { } TEST_F(DefaultLoggerWithFileSink, SetLevelError) { - logger->setLevel(logger::Level::ERR); + logger->setLevel(UR_LOGGER_LEVEL_ERR); logger->error("Test message: {}", "success"); logger->warning("This should not be printed: {}", 42); @@ -88,7 +89,7 @@ TEST_F(DefaultLoggerWithFileSink, SetLevelError) { ////////////////////////////////////////////////////////////////////////////// TEST_F(UniquePtrLoggerWithFilesink, SetLogLevelAndFlushLevelDebugWithCtor) { - auto level = logger::Level::DEBUG; + auto level = UR_LOGGER_LEVEL_DEBUG; logger = std::make_unique( level, std::make_unique(logger_name, file_path, level)); @@ -106,15 +107,16 @@ TEST_F(UniquePtrLoggerWithFilesink, NestedFilePath) { filesystem::create_directories(file_path); file_path /= file_name; logger = std::make_unique( - logger::Level::WARN, std::make_unique( - logger_name, file_path, logger::Level::WARN)); + UR_LOGGER_LEVEL_WARN, + std::make_unique(logger_name, file_path, + UR_LOGGER_LEVEL_WARN)); logger->warning("Test message: {}", "success"); test_msg << test_msg_prefix << "[WARNING]: Test message: success\n"; } TEST_F(UniquePtrLoggerWithFilesinkFail, NullSink) { - logger = std::make_unique(logger::Level::INFO, nullptr); + logger = std::make_unique(UR_LOGGER_LEVEL_INFO, nullptr); logger->info("This should not be printed: {}", 42); test_msg.clear(); } @@ -128,7 +130,7 @@ INSTANTIATE_TEST_SUITE_P( TEST_P(FileSinkLoggerMultipleThreads, Multithreaded) { std::vector threads; auto local_logger = logger::Logger( - logger::Level::WARN, + UR_LOGGER_LEVEL_WARN, std::make_unique(logger_name, file_path, true)); constexpr int message_count = 50; @@ -175,7 +177,7 @@ INSTANTIATE_TEST_SUITE_P( TEST_P(CommonLoggerWithMultipleThreads, StdoutMultithreaded) { std::vector threads; auto local_logger = - logger::Logger(logger::Level::WARN, + logger::Logger(UR_LOGGER_LEVEL_WARN, std::make_unique("test", true)); constexpr int message_count = 50; @@ -207,3 +209,64 @@ TEST_P(CommonLoggerWithMultipleThreads, StdoutMultithreaded) { thread.join(); } } + +////////////////////////////////////////////////////////////////////////////// +void receiveLoggerMessages([[maybe_unused]] ur_logger_level_t level, + const char *msg, void *userData) { + std::string *str = static_cast(userData); + *str = msg; +} + +TEST_F(LoggerWithCallbackSink, CallbackSinkTest) { + // Pass a callback function to the logger which will be used as an additional destination sink + // and any logged messages will be sent to the callback function + std::string callback_message; + logger->setCallbackSink(receiveLoggerMessages, &callback_message, + UR_LOGGER_LEVEL_ERR); + + logger->error("Test message: {}", "success"); + + ASSERT_STREQ(callback_message.c_str(), + "[ERROR]: Test message: success\n"); +} + +TEST_F(LoggerWithCallbackSink, CallbackSinkSetLevel) { + // Set log level to DEBUG and confirm a DEBUG message is received + std::string callback_message; + logger->setCallbackSink(receiveLoggerMessages, &callback_message, + UR_LOGGER_LEVEL_DEBUG); + + logger->debug("Test message: {}", "success"); + ASSERT_STREQ(callback_message.c_str(), + "[DEBUG]: Test message: success\n"); + + // Set level to WARN and confirm a DEBUG message is not received + logger->setCallbackLevel(UR_LOGGER_LEVEL_WARN); + callback_message.clear(); + logger->debug("Test message: {}", "success"); + ASSERT_STREQ(callback_message.c_str(), ""); + + // While level is DEBUG confirm a ERR message is received + callback_message.clear(); + logger->error("Test message: {}", "success"); + ASSERT_STREQ(callback_message.c_str(), + "[ERROR]: Test message: success\n"); + + // Set level to QUIET and confirm no log levels are received + logger->setCallbackLevel(UR_LOGGER_LEVEL_QUIET); + callback_message.clear(); + logger->debug("Test message: {}", "success"); + ASSERT_STREQ(callback_message.c_str(), ""); + + callback_message.clear(); + logger->info("Test message: {}", "success"); + ASSERT_STREQ(callback_message.c_str(), ""); + + callback_message.clear(); + logger->warn("Test message: {}", "success"); + ASSERT_STREQ(callback_message.c_str(), ""); + + callback_message.clear(); + logger->error("Test message: {}", "success"); + ASSERT_STREQ(callback_message.c_str(), ""); +} From 02c0aa0ee33479e5d2b743b2c184ed00ee99d78e Mon Sep 17 00:00:00 2001 From: Martin Grant Date: Thu, 4 Jul 2024 11:00:29 +0100 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: Kenneth Benzie (Benie) --- scripts/core/adapter.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/core/adapter.yml b/scripts/core/adapter.yml index 805001095a..46840bf5d2 100644 --- a/scripts/core/adapter.yml +++ b/scripts/core/adapter.yml @@ -204,7 +204,7 @@ etors: --- #-------------------------------------------------------------------------- type: enum desc: "Minimum level of messages to be processed by the logger." -class: $x +class: $xAdapter name: $x_logger_level_t etors: - name: DEBUG @@ -225,6 +225,7 @@ etors: --- #-------------------------------------------------------------------------- type: fptr_typedef desc: "Callback function to retrieve output from the logger." +class: $xAdapter name: $x_logger_output_callback_t return: "void" params: @@ -244,7 +245,7 @@ desc: | Set a callback function for use by the logger to retrieve logging output. It is a requirement that the callback function is thread safe and the creator of the function will be responsible for this. -class: $x +class: $xAdapter name: SetLoggerCallback decl: static params: @@ -264,7 +265,7 @@ params: --- #-------------------------------------------------------------------------- type: function desc: "Set the minimum logging level for the logger Callback function." -class: $x +class: $xAdapter name: SetLoggerCallbackLevel decl: static params: From 8936426f1db006821546f82aee30c534f0fa891b Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Fri, 5 Jul 2024 15:11:50 +0100 Subject: [PATCH 3/4] Rerun generate target after applying suggestions from Github web ui. Move entry points from global ddi table to adapter. Rename the callback function pointer to ur_logger_callback_t. --- include/ur_api.h | 100 ++++++------ include/ur_api_funcs.def | 4 +- include/ur_ddi.h | 59 +++++-- include/ur_print.h | 32 ++-- include/ur_print.hpp | 146 +++++++++--------- scripts/core/INTRO.rst | 2 +- scripts/core/adapter.yml | 5 +- scripts/core/registry.yml | 62 ++++---- source/adapters/adapter.def.in | 1 + source/adapters/adapter.map.in | 1 + source/adapters/cuda/adapter.cpp | 6 +- source/adapters/cuda/ur_interface_loader.cpp | 14 +- source/adapters/hip/adapter.cpp | 6 +- source/adapters/hip/ur_interface_loader.cpp | 14 +- source/adapters/level_zero/adapter.cpp | 6 +- .../level_zero/ur_interface_loader.cpp | 19 ++- .../level_zero/ur_interface_loader.hpp | 11 +- source/adapters/mock/ur_mockddi.cpp | 65 ++++++-- source/adapters/native_cpu/adapter.cpp | 6 +- .../native_cpu/ur_interface_loader.cpp | 15 +- source/adapters/opencl/adapter.cpp | 6 +- .../adapters/opencl/ur_interface_loader.cpp | 15 +- source/common/logger/ur_logger_details.hpp | 2 +- source/common/logger/ur_sinks.hpp | 4 +- source/loader/layers/tracing/ur_trcddi.cpp | 98 ++++++++---- source/loader/layers/validation/ur_valddi.cpp | 55 +++++-- source/loader/loader.def.in | 9 +- source/loader/loader.map.in | 9 +- source/loader/ur_ldrddi.cpp | 78 ++++++++-- source/loader/ur_libapi.cpp | 10 +- source/loader/ur_libddi.cpp | 5 + source/loader/ur_print.cpp | 10 +- source/ur_api.cpp | 6 +- 33 files changed, 570 insertions(+), 311 deletions(-) diff --git a/include/ur_api.h b/include/ur_api.h index 70bef9904d..b9ff322788 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -208,30 +208,30 @@ typedef enum ur_function_t { UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP = 221, ///< Enumerator for ::urCommandBufferGetInfoExp UR_FUNCTION_COMMAND_BUFFER_COMMAND_GET_INFO_EXP = 222, ///< Enumerator for ::urCommandBufferCommandGetInfoExp UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP = 223, ///< Enumerator for ::urEnqueueTimestampRecordingExp - UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP = 224, ///< Enumerator for ::urEnqueueKernelLaunchCustomExp - UR_FUNCTION_KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE = 225, ///< Enumerator for ::urKernelGetSuggestedLocalWorkSize - 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_LOADER_CONFIG_SET_MOCKING_ENABLED = 229, ///< Enumerator for ::urLoaderConfigSetMockingEnabled + UR_FUNCTION_LOADER_CONFIG_SET_MOCKING_ENABLED = 224, ///< Enumerator for ::urLoaderConfigSetMockingEnabled + UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK = 225, ///< Enumerator for ::urAdapterSetLoggerCallback + UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK_LEVEL = 226, ///< Enumerator for ::urAdapterSetLoggerCallbackLevel + UR_FUNCTION_KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE = 227, ///< Enumerator for ::urKernelGetSuggestedLocalWorkSize + UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP = 228, ///< Enumerator for ::urBindlessImagesImportExternalMemoryExp + UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP = 229, ///< Enumerator for ::urBindlessImagesMapExternalLinearMemoryExp UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP = 230, ///< Enumerator for ::urBindlessImagesReleaseExternalMemoryExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP = 231, ///< Enumerator for ::urCommandBufferAppendUSMMemcpyExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP = 232, ///< Enumerator for ::urCommandBufferAppendUSMFillExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP = 233, ///< Enumerator for ::urCommandBufferAppendMemBufferCopyExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP = 234, ///< Enumerator for ::urCommandBufferAppendMemBufferWriteExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP = 235, ///< Enumerator for ::urCommandBufferAppendMemBufferReadExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP = 236, ///< Enumerator for ::urCommandBufferAppendMemBufferCopyRectExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP = 237, ///< Enumerator for ::urCommandBufferAppendMemBufferWriteRectExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP = 238, ///< Enumerator for ::urCommandBufferAppendMemBufferReadRectExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 239, ///< Enumerator for ::urCommandBufferAppendMemBufferFillExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP = 240, ///< Enumerator for ::urCommandBufferAppendUSMPrefetchExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 241, ///< Enumerator for ::urCommandBufferAppendUSMAdviseExp - UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP = 242, ///< Enumerator for ::urCommandBufferEnqueueExp - UR_FUNCTION_COMMAND_BUFFER_UPDATE_SIGNAL_EVENT_EXP = 243, ///< Enumerator for ::urCommandBufferUpdateSignalEventExp - UR_FUNCTION_COMMAND_BUFFER_UPDATE_WAIT_EVENTS_EXP = 244, ///< Enumerator for ::urCommandBufferUpdateWaitEventsExp - UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP = 245, ///< Enumerator for ::urBindlessImagesMapExternalLinearMemoryExp - UR_FUNCTION_SET_LOGGER_CALLBACK = 246, ///< Enumerator for ::urSetLoggerCallback - UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL = 247, ///< Enumerator for ::urSetLoggerCallbackLevel + UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP = 231, ///< Enumerator for ::urBindlessImagesImportExternalSemaphoreExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP = 232, ///< Enumerator for ::urCommandBufferAppendUSMMemcpyExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP = 233, ///< Enumerator for ::urCommandBufferAppendUSMFillExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP = 234, ///< Enumerator for ::urCommandBufferAppendMemBufferCopyExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP = 235, ///< Enumerator for ::urCommandBufferAppendMemBufferWriteExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP = 236, ///< Enumerator for ::urCommandBufferAppendMemBufferReadExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP = 237, ///< Enumerator for ::urCommandBufferAppendMemBufferCopyRectExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP = 238, ///< Enumerator for ::urCommandBufferAppendMemBufferWriteRectExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP = 239, ///< Enumerator for ::urCommandBufferAppendMemBufferReadRectExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 240, ///< Enumerator for ::urCommandBufferAppendMemBufferFillExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP = 241, ///< Enumerator for ::urCommandBufferAppendUSMPrefetchExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 242, ///< Enumerator for ::urCommandBufferAppendUSMAdviseExp + UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP = 243, ///< Enumerator for ::urCommandBufferEnqueueExp + UR_FUNCTION_COMMAND_BUFFER_UPDATE_SIGNAL_EVENT_EXP = 244, ///< Enumerator for ::urCommandBufferUpdateSignalEventExp + UR_FUNCTION_COMMAND_BUFFER_UPDATE_WAIT_EVENTS_EXP = 245, ///< Enumerator for ::urCommandBufferUpdateWaitEventsExp + UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP = 246, ///< Enumerator for ::urEnqueueKernelLaunchCustomExp + UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP = 247, ///< Enumerator for ::urEnqueueNativeCommandExp /// @cond UR_FUNCTION_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -1043,7 +1043,7 @@ typedef enum ur_logger_level_t { /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function to retrieve output from the logger. -typedef void (*ur_logger_output_callback_t)( +typedef void (*ur_logger_callback_t)( ur_logger_level_t level, ///< [out] Minimum level of messages to be processed by the logger. const char *pLoggerMsg, ///< [in][out] pointer to data to be passed to callback void *pUserData ///< [in][out] pointer to data to be passed to callback @@ -1066,11 +1066,11 @@ 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( - 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 - ur_logger_level_t level ///< [in] logging level +urAdapterSetLoggerCallback( + ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter + ur_logger_callback_t pfnLoggerCallback, ///< [in] Function pointer to callback from the logger. + void *pUserData, ///< [in][out][optional] pointer to data to be passed to callback + ur_logger_level_t level ///< [in] logging level ); /////////////////////////////////////////////////////////////////////////////// @@ -1086,7 +1086,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 ); @@ -10153,6 +10153,26 @@ typedef struct ur_loader_config_set_mocking_enabled_params_t { ur_bool_t *penable; } ur_loader_config_set_mocking_enabled_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_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; @@ -11063,26 +11083,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; diff --git a/include/ur_api_funcs.def b/include/ur_api_funcs.def index 9fd627c125..043b5ea9fa 100644 --- a/include/ur_api_funcs.def +++ b/include/ur_api_funcs.def @@ -14,6 +14,8 @@ // Auto-generated file, do not edit. +_UR_API(urAdapterSetLoggerCallback) +_UR_API(urAdapterSetLoggerCallbackLevel) _UR_API(urPlatformGet) _UR_API(urPlatformGetInfo) _UR_API(urPlatformGetNativeHandle) @@ -101,8 +103,6 @@ _UR_API(urAdapterRelease) _UR_API(urAdapterRetain) _UR_API(urAdapterGetLastError) _UR_API(urAdapterGetInfo) -_UR_API(urSetLoggerCallback) -_UR_API(urSetLoggerCallbackLevel) _UR_API(urEnqueueKernelLaunch) _UR_API(urEnqueueEventsWait) _UR_API(urEnqueueEventsWaitWithBarrier) diff --git a/include/ur_ddi.h b/include/ur_ddi.h index c402bcba13..91f2247fe8 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -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_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)( @@ -1038,20 +1080,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 { @@ -1060,8 +1088,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; /////////////////////////////////////////////////////////////////////////////// @@ -2502,6 +2528,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; diff --git a/include/ur_print.h b/include/ur_print.h index fd283ec022..75cf08ed50 100644 --- a/include/ur_print.h +++ b/include/ur_print.h @@ -1138,6 +1138,22 @@ UR_APIEXPORT ur_result_t UR_APICALL urPrintLoaderConfigSetCodeLocationCallbackPa /// - `buff_size < out_size` UR_APIEXPORT ur_result_t UR_APICALL urPrintLoaderConfigSetMockingEnabledParams(const struct ur_loader_config_set_mocking_enabled_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 @@ -1834,22 +1850,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 diff --git a/include/ur_print.hpp b/include/ur_print.hpp index dfb5ce845a..61bb97ab36 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -889,8 +889,14 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP: os << "UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP"; break; - case UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP: - os << "UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP"; + case UR_FUNCTION_LOADER_CONFIG_SET_MOCKING_ENABLED: + os << "UR_FUNCTION_LOADER_CONFIG_SET_MOCKING_ENABLED"; + break; + case UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK: + os << "UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK"; + break; + case UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK_LEVEL: + os << "UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK_LEVEL"; break; case UR_FUNCTION_KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE: os << "UR_FUNCTION_KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE"; @@ -898,18 +904,15 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP: - os << "UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP"; - break; - case UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP: - os << "UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP"; - break; - case UR_FUNCTION_LOADER_CONFIG_SET_MOCKING_ENABLED: - os << "UR_FUNCTION_LOADER_CONFIG_SET_MOCKING_ENABLED"; + case UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP"; break; case UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP"; break; + case UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP"; + break; case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP"; break; @@ -952,14 +955,11 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_COMMAND_BUFFER_UPDATE_WAIT_EVENTS_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_UPDATE_WAIT_EVENTS_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP: - os << "UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP"; - break; - case UR_FUNCTION_SET_LOGGER_CALLBACK: - os << "UR_FUNCTION_SET_LOGGER_CALLBACK"; + case UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP: + os << "UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP"; break; - case UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL: - os << "UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL"; + case UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP: + os << "UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP"; break; default: os << "unknown enumerator"; @@ -10571,6 +10571,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( + *(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 @@ -13055,56 +13105,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( - *(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 @@ -18140,6 +18140,12 @@ inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, ur_function_ case UR_FUNCTION_LOADER_CONFIG_SET_MOCKING_ENABLED: { os << (const struct ur_loader_config_set_mocking_enabled_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; @@ -18401,12 +18407,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; diff --git a/scripts/core/INTRO.rst b/scripts/core/INTRO.rst index 1b15ac2f84..5e7f860a4e 100644 --- a/scripts/core/INTRO.rst +++ b/scripts/core/INTRO.rst @@ -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 --------------------- diff --git a/scripts/core/adapter.yml b/scripts/core/adapter.yml index 46840bf5d2..375e15e425 100644 --- a/scripts/core/adapter.yml +++ b/scripts/core/adapter.yml @@ -225,8 +225,7 @@ etors: --- #-------------------------------------------------------------------------- type: fptr_typedef desc: "Callback function to retrieve output from the logger." -class: $xAdapter -name: $x_logger_output_callback_t +name: $x_logger_callback_t return: "void" params: - type: $x_logger_level_t @@ -252,7 +251,7 @@ params: - type: $x_adapter_handle_t name: hAdapter desc: "[in] handle of the adapter" - - type: $x_logger_output_callback_t + - type: $x_logger_callback_t name: pfnLoggerCallback desc: "[in] Function pointer to callback from the logger." - type: void* diff --git a/scripts/core/registry.yml b/scripts/core/registry.yml index 4db75f4a41..c9b9a91d5e 100644 --- a/scripts/core/registry.yml +++ b/scripts/core/registry.yml @@ -538,77 +538,77 @@ etors: - name: ENQUEUE_TIMESTAMP_RECORDING_EXP desc: Enumerator for $xEnqueueTimestampRecordingExp value: '223' -- name: ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP - desc: Enumerator for $xEnqueueKernelLaunchCustomExp +- name: LOADER_CONFIG_SET_MOCKING_ENABLED + desc: Enumerator for $xLoaderConfigSetMockingEnabled value: '224' +- name: ADAPTER_SET_LOGGER_CALLBACK + desc: Enumerator for $xAdapterSetLoggerCallback + value: '225' +- name: ADAPTER_SET_LOGGER_CALLBACK_LEVEL + desc: Enumerator for $xAdapterSetLoggerCallbackLevel + value: '226' - name: KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE desc: Enumerator for $xKernelGetSuggestedLocalWorkSize - value: '225' + value: '227' - name: BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP desc: Enumerator for $xBindlessImagesImportExternalMemoryExp - value: '226' -- name: BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP - desc: Enumerator for $xBindlessImagesImportExternalSemaphoreExp - value: '227' -- name: ENQUEUE_NATIVE_COMMAND_EXP - desc: Enumerator for $xEnqueueNativeCommandExp value: '228' -- name: LOADER_CONFIG_SET_MOCKING_ENABLED - desc: Enumerator for $xLoaderConfigSetMockingEnabled +- name: BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP + desc: Enumerator for $xBindlessImagesMapExternalLinearMemoryExp value: '229' - name: BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP desc: Enumerator for $xBindlessImagesReleaseExternalMemoryExp value: '230' +- name: BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP + desc: Enumerator for $xBindlessImagesImportExternalSemaphoreExp + value: '231' - name: COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP desc: Enumerator for $xCommandBufferAppendUSMMemcpyExp - value: '231' + value: '232' - name: COMMAND_BUFFER_APPEND_USM_FILL_EXP desc: Enumerator for $xCommandBufferAppendUSMFillExp - value: '232' + value: '233' - name: COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP desc: Enumerator for $xCommandBufferAppendMemBufferCopyExp - value: '233' + value: '234' - name: COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP desc: Enumerator for $xCommandBufferAppendMemBufferWriteExp - value: '234' + value: '235' - name: COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP desc: Enumerator for $xCommandBufferAppendMemBufferReadExp - value: '235' + value: '236' - name: COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP desc: Enumerator for $xCommandBufferAppendMemBufferCopyRectExp - value: '236' + value: '237' - name: COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP desc: Enumerator for $xCommandBufferAppendMemBufferWriteRectExp - value: '237' + value: '238' - name: COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP desc: Enumerator for $xCommandBufferAppendMemBufferReadRectExp - value: '238' + value: '239' - name: COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP desc: Enumerator for $xCommandBufferAppendMemBufferFillExp - value: '239' + value: '240' - name: COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP desc: Enumerator for $xCommandBufferAppendUSMPrefetchExp - value: '240' + value: '241' - name: COMMAND_BUFFER_APPEND_USM_ADVISE_EXP desc: Enumerator for $xCommandBufferAppendUSMAdviseExp - value: '241' + value: '242' - name: COMMAND_BUFFER_ENQUEUE_EXP desc: Enumerator for $xCommandBufferEnqueueExp - value: '242' + value: '243' - name: COMMAND_BUFFER_UPDATE_SIGNAL_EVENT_EXP desc: Enumerator for $xCommandBufferUpdateSignalEventExp - value: '243' + value: '244' - name: COMMAND_BUFFER_UPDATE_WAIT_EVENTS_EXP desc: Enumerator for $xCommandBufferUpdateWaitEventsExp - value: '244' -- name: BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP - desc: Enumerator for $xBindlessImagesMapExternalLinearMemoryExp value: '245' -- name: SET_LOGGER_CALLBACK - desc: Enumerator for $xSetLoggerCallback +- name: ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP + desc: Enumerator for $xEnqueueKernelLaunchCustomExp value: '246' -- name: SET_LOGGER_CALLBACK_LEVEL - desc: Enumerator for $xSetLoggerCallbackLevel +- name: ENQUEUE_NATIVE_COMMAND_EXP + desc: Enumerator for $xEnqueueNativeCommandExp value: '247' --- type: enum diff --git a/source/adapters/adapter.def.in b/source/adapters/adapter.def.in index 3c18c78bd1..9449526857 100644 --- a/source/adapters/adapter.def.in +++ b/source/adapters/adapter.def.in @@ -1,6 +1,7 @@ LIBRARY @TARGET_LIBNAME@ EXPORTS urGetGlobalProcAddrTable + urGetAdapterProcAddrTable urGetBindlessImagesExpProcAddrTable urGetCommandBufferExpProcAddrTable urGetContextProcAddrTable diff --git a/source/adapters/adapter.map.in b/source/adapters/adapter.map.in index bb08ae7d88..5fe52a579d 100644 --- a/source/adapters/adapter.map.in +++ b/source/adapters/adapter.map.in @@ -1,6 +1,7 @@ @TARGET_LIBNAME@ { global: urGetGlobalProcAddrTable; + urGetAdapterProcAddrTable; urGetBindlessImagesExpProcAddrTable; urGetCommandBufferExpProcAddrTable; urGetContextProcAddrTable; diff --git a/source/adapters/cuda/adapter.cpp b/source/adapters/cuda/adapter.cpp index 953bd9a8d2..3262038e7d 100644 --- a/source/adapters/cuda/adapter.cpp +++ b/source/adapters/cuda/adapter.cpp @@ -115,8 +115,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t, return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( - ur_adapter_handle_t, ur_logger_output_callback_t pfnLoggerCallback, +UR_APIEXPORT ur_result_t UR_APICALL urAdapterSetLoggerCallback( + ur_adapter_handle_t, ur_logger_callback_t pfnLoggerCallback, void *pUserData, ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET) { adapter.logger.setCallbackSink(pfnLoggerCallback, pUserData, level); @@ -124,7 +124,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallbackLevel( +UR_APIEXPORT ur_result_t UR_APICALL urAdapterSetLoggerCallbackLevel( ur_adapter_handle_t, ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET) { adapter.logger.setCallbackLevel(level); diff --git a/source/adapters/cuda/ur_interface_loader.cpp b/source/adapters/cuda/ur_interface_loader.cpp index 81386f3f89..228c6ae5d6 100644 --- a/source/adapters/cuda/ur_interface_loader.cpp +++ b/source/adapters/cuda/ur_interface_loader.cpp @@ -209,8 +209,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( pDdiTable->pfnAdapterRetain = urAdapterRetain; pDdiTable->pfnAdapterGetLastError = urAdapterGetLastError; pDdiTable->pfnAdapterGetInfo = urAdapterGetInfo; - pDdiTable->pfnSetLoggerCallback = urSetLoggerCallback; - pDdiTable->pfnSetLoggerCallbackLevel = urSetLoggerCallbackLevel; return UR_RESULT_SUCCESS; } @@ -449,6 +447,18 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( return UR_RESULT_SUCCESS; } +UR_DLLEXPORT ur_result_t UR_APICALL urGetAdapterProcAddrTable( + ur_api_version_t version, ur_adapter_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + pDdiTable->pfnSetLoggerCallback = urAdapterSetLoggerCallback; + pDdiTable->pfnSetLoggerCallbackLevel = urAdapterSetLoggerCallbackLevel; + + return UR_RESULT_SUCCESS; +} + #if defined(__cplusplus) } // extern "C" #endif diff --git a/source/adapters/hip/adapter.cpp b/source/adapters/hip/adapter.cpp index cd64496c49..0091cd76a3 100644 --- a/source/adapters/hip/adapter.cpp +++ b/source/adapters/hip/adapter.cpp @@ -103,8 +103,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t, return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( - ur_adapter_handle_t, ur_logger_output_callback_t pfnLoggerCallback, +UR_APIEXPORT ur_result_t UR_APICALL urAdapterSetLoggerCallback( + ur_adapter_handle_t, ur_logger_callback_t pfnLoggerCallback, void *pUserData, ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET) { adapter.logger.setCallbackSink(pfnLoggerCallback, pUserData, level); @@ -113,7 +113,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( } UR_APIEXPORT ur_result_t UR_APICALL -urSetLoggerCallbackLevel(ur_adapter_handle_t, ur_logger_level_t level) { +urAdapterSetLoggerCallbackLevel(ur_adapter_handle_t, ur_logger_level_t level) { adapter.logger.setCallbackLevel(level); diff --git a/source/adapters/hip/ur_interface_loader.cpp b/source/adapters/hip/ur_interface_loader.cpp index 4bce45db2d..dac75170fc 100644 --- a/source/adapters/hip/ur_interface_loader.cpp +++ b/source/adapters/hip/ur_interface_loader.cpp @@ -209,8 +209,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( pDdiTable->pfnAdapterGetLastError = urAdapterGetLastError; pDdiTable->pfnAdapterRelease = urAdapterRelease; pDdiTable->pfnAdapterRetain = urAdapterRetain; - pDdiTable->pfnSetLoggerCallback = urSetLoggerCallback; - pDdiTable->pfnSetLoggerCallbackLevel = urSetLoggerCallbackLevel; return UR_RESULT_SUCCESS; } @@ -415,6 +413,18 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( return UR_RESULT_SUCCESS; } +UR_DLLEXPORT ur_result_t UR_APICALL urGetAdapterProcAddrTable( + ur_api_version_t version, ur_adapter_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + pDdiTable->pfnSetLoggerCallback = urAdapterSetLoggerCallback; + pDdiTable->pfnSetLoggerCallbackLevel = urAdapterSetLoggerCallbackLevel; + + return UR_RESULT_SUCCESS; +} + #if defined(__cplusplus) } // extern "C" #endif diff --git a/source/adapters/level_zero/adapter.cpp b/source/adapters/level_zero/adapter.cpp index ae670bd16c..26e625545e 100644 --- a/source/adapters/level_zero/adapter.cpp +++ b/source/adapters/level_zero/adapter.cpp @@ -454,8 +454,8 @@ ur_result_t urAdapterGetInfo(ur_adapter_handle_t, ur_adapter_info_t PropName, return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( - ur_adapter_handle_t, ur_logger_output_callback_t pfnLoggerCallback, +UR_APIEXPORT ur_result_t UR_APICALL urAdapterSetLoggerCallback( + ur_adapter_handle_t, ur_logger_callback_t pfnLoggerCallback, void *pUserData, ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET) { if (GlobalAdapter) { @@ -466,7 +466,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( } UR_APIEXPORT ur_result_t UR_APICALL -urSetLoggerCallbackLevel(ur_adapter_handle_t, ur_logger_level_t level) { +urAdapterSetLoggerCallbackLevel(ur_adapter_handle_t, ur_logger_level_t level) { if (GlobalAdapter) { GlobalAdapter->logger.setCallbackLevel(level); diff --git a/source/adapters/level_zero/ur_interface_loader.cpp b/source/adapters/level_zero/ur_interface_loader.cpp index af29f15be1..624f87464e 100644 --- a/source/adapters/level_zero/ur_interface_loader.cpp +++ b/source/adapters/level_zero/ur_interface_loader.cpp @@ -43,9 +43,20 @@ UR_APIEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( pDdiTable->pfnAdapterRetain = ur::level_zero::urAdapterRetain; pDdiTable->pfnAdapterGetLastError = ur::level_zero::urAdapterGetLastError; pDdiTable->pfnAdapterGetInfo = ur::level_zero::urAdapterGetInfo; - pDdiTable->pfnSetLoggerCallback = ur::level_zero::urSetLoggerCallback; + + return result; +} + +UR_APIEXPORT ur_result_t UR_APICALL urGetAdapterProcAddrTable( + ur_api_version_t version, ur_adapter_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + + pDdiTable->pfnSetLoggerCallback = ur::level_zero::urAdapterSetLoggerCallback; pDdiTable->pfnSetLoggerCallbackLevel = - ur::level_zero::urSetLoggerCallbackLevel; + ur::level_zero::urAdapterSetLoggerCallbackLevel; return result; } @@ -535,6 +546,10 @@ ur_result_t urAdapterGetDdiTables(ur_dditable_t *ddi) { &ddi->Global); if (result != UR_RESULT_SUCCESS) return result; + result = ur::level_zero::urGetAdapterProcAddrTable(UR_API_VERSION_CURRENT, + &ddi->Adapter); + if (result != UR_RESULT_SUCCESS) + return result; result = ur::level_zero::urGetBindlessImagesExpProcAddrTable( UR_API_VERSION_CURRENT, &ddi->BindlessImagesExp); if (result != UR_RESULT_SUCCESS) diff --git a/source/adapters/level_zero/ur_interface_loader.hpp b/source/adapters/level_zero/ur_interface_loader.hpp index 701e1f2ecf..21a7f38134 100644 --- a/source/adapters/level_zero/ur_interface_loader.hpp +++ b/source/adapters/level_zero/ur_interface_loader.hpp @@ -20,11 +20,12 @@ ur_result_t urAdapterGetLastError(ur_adapter_handle_t hAdapter, ur_result_t urAdapterGetInfo(ur_adapter_handle_t hAdapter, ur_adapter_info_t propName, size_t propSize, void *pPropValue, size_t *pPropSizeRet); -ur_result_t urSetLoggerCallback(ur_adapter_handle_t hAdapter, - ur_logger_output_callback_t pfnLoggerCallback, - void *pUserData, ur_logger_level_t level); -ur_result_t urSetLoggerCallbackLevel(ur_adapter_handle_t hAdapter, - ur_logger_level_t level); +ur_result_t urAdapterSetLoggerCallback(ur_adapter_handle_t hAdapter, + ur_logger_callback_t pfnLoggerCallback, + void *pUserData, + ur_logger_level_t level); +ur_result_t urAdapterSetLoggerCallbackLevel(ur_adapter_handle_t hAdapter, + ur_logger_level_t level); ur_result_t urPlatformGet(ur_adapter_handle_t *phAdapters, uint32_t NumAdapters, uint32_t NumEntries, ur_platform_handle_t *phPlatforms, diff --git a/source/adapters/mock/ur_mockddi.cpp b/source/adapters/mock/ur_mockddi.cpp index be992a0d01..72ff8b6b3e 100644 --- a/source/adapters/mock/ur_mockddi.cpp +++ b/source/adapters/mock/ur_mockddi.cpp @@ -258,10 +258,10 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetInfo( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urSetLoggerCallback -__urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( +/// @brief Intercept function for urAdapterSetLoggerCallback +__urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallback( ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter - ur_logger_output_callback_t + ur_logger_callback_t pfnLoggerCallback, ///< [in] Function pointer to callback from the logger. void * pUserData, ///< [in][out][optional] pointer to data to be passed to callback @@ -269,11 +269,11 @@ __urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( ) try { ur_result_t result = UR_RESULT_SUCCESS; - ur_set_logger_callback_params_t params = {&hAdapter, &pfnLoggerCallback, - &pUserData, &level}; + ur_adapter_set_logger_callback_params_t params = { + &hAdapter, &pfnLoggerCallback, &pUserData, &level}; auto beforeCallback = reinterpret_cast( - mock::getCallbacks().get_before_callback("urSetLoggerCallback")); + mock::getCallbacks().get_before_callback("urAdapterSetLoggerCallback")); if (beforeCallback) { result = beforeCallback(¶ms); if (result != UR_RESULT_SUCCESS) { @@ -282,7 +282,8 @@ __urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( } auto replaceCallback = reinterpret_cast( - mock::getCallbacks().get_replace_callback("urSetLoggerCallback")); + mock::getCallbacks().get_replace_callback( + "urAdapterSetLoggerCallback")); if (replaceCallback) { result = replaceCallback(¶ms); } else { @@ -295,7 +296,7 @@ __urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( } auto afterCallback = reinterpret_cast( - mock::getCallbacks().get_after_callback("urSetLoggerCallback")); + mock::getCallbacks().get_after_callback("urAdapterSetLoggerCallback")); if (afterCallback) { return afterCallback(¶ms); } @@ -306,17 +307,18 @@ __urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urSetLoggerCallbackLevel -__urdlllocal ur_result_t UR_APICALL urSetLoggerCallbackLevel( +/// @brief Intercept function for urAdapterSetLoggerCallbackLevel +__urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallbackLevel( ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter ur_logger_level_t level ///< [in] logging level ) try { ur_result_t result = UR_RESULT_SUCCESS; - ur_set_logger_callback_level_params_t params = {&hAdapter, &level}; + ur_adapter_set_logger_callback_level_params_t params = {&hAdapter, &level}; auto beforeCallback = reinterpret_cast( - mock::getCallbacks().get_before_callback("urSetLoggerCallbackLevel")); + mock::getCallbacks().get_before_callback( + "urAdapterSetLoggerCallbackLevel")); if (beforeCallback) { result = beforeCallback(¶ms); if (result != UR_RESULT_SUCCESS) { @@ -325,7 +327,8 @@ __urdlllocal ur_result_t UR_APICALL urSetLoggerCallbackLevel( } auto replaceCallback = reinterpret_cast( - mock::getCallbacks().get_replace_callback("urSetLoggerCallbackLevel")); + mock::getCallbacks().get_replace_callback( + "urAdapterSetLoggerCallbackLevel")); if (replaceCallback) { result = replaceCallback(¶ms); } else { @@ -338,7 +341,8 @@ __urdlllocal ur_result_t UR_APICALL urSetLoggerCallbackLevel( } auto afterCallback = reinterpret_cast( - mock::getCallbacks().get_after_callback("urSetLoggerCallbackLevel")); + mock::getCallbacks().get_after_callback( + "urAdapterSetLoggerCallbackLevel")); if (afterCallback) { return afterCallback(¶ms); } @@ -10789,9 +10793,38 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( pDdiTable->pfnAdapterGetInfo = driver::urAdapterGetInfo; - pDdiTable->pfnSetLoggerCallback = driver::urSetLoggerCallback; + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Adapter table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::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 + ) try { + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (driver::d_context.version < version) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + + pDdiTable->pfnSetLoggerCallback = driver::urAdapterSetLoggerCallback; - pDdiTable->pfnSetLoggerCallbackLevel = driver::urSetLoggerCallbackLevel; + pDdiTable->pfnSetLoggerCallbackLevel = + driver::urAdapterSetLoggerCallbackLevel; return result; } catch (...) { diff --git a/source/adapters/native_cpu/adapter.cpp b/source/adapters/native_cpu/adapter.cpp index 9ce6c29258..b36c632abd 100644 --- a/source/adapters/native_cpu/adapter.cpp +++ b/source/adapters/native_cpu/adapter.cpp @@ -64,8 +64,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t, return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( - ur_adapter_handle_t, ur_logger_output_callback_t pfnLoggerCallback, +UR_APIEXPORT ur_result_t UR_APICALL urAdapterSetLoggerCallback( + ur_adapter_handle_t, ur_logger_callback_t pfnLoggerCallback, void *pUserData, ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET) { Adapter.logger.setCallbackSink(pfnLoggerCallback, pUserData, level); @@ -74,7 +74,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( } UR_APIEXPORT ur_result_t UR_APICALL -urSetLoggerCallbackLevel(ur_adapter_handle_t, ur_logger_level_t level) { +urAdapterSetLoggerCallbackLevel(ur_adapter_handle_t, ur_logger_level_t level) { Adapter.logger.setCallbackLevel(level); diff --git a/source/adapters/native_cpu/ur_interface_loader.cpp b/source/adapters/native_cpu/ur_interface_loader.cpp index d61db694bf..7485c7d60d 100644 --- a/source/adapters/native_cpu/ur_interface_loader.cpp +++ b/source/adapters/native_cpu/ur_interface_loader.cpp @@ -206,8 +206,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( pDdiTable->pfnAdapterGetInfo = urAdapterGetInfo; pDdiTable->pfnAdapterRelease = urAdapterRelease; pDdiTable->pfnAdapterRetain = urAdapterRetain; - pDdiTable->pfnSetLoggerCallback = urSetLoggerCallback; - pDdiTable->pfnSetLoggerCallbackLevel = urSetLoggerCallbackLevel; return UR_RESULT_SUCCESS; } @@ -432,4 +430,17 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( return UR_RESULT_SUCCESS; } + +UR_DLLEXPORT ur_result_t UR_APICALL urGetAdapterProcAddrTable( + ur_api_version_t version, ur_adapter_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + pDdiTable->pfnSetLoggerCallback = urAdapterSetLoggerCallback; + pDdiTable->pfnSetLoggerCallbackLevel = urAdapterSetLoggerCallbackLevel; + + return UR_RESULT_SUCCESS; +} + } // extern "C" diff --git a/source/adapters/opencl/adapter.cpp b/source/adapters/opencl/adapter.cpp index 10fe6062b4..9cad23c11a 100644 --- a/source/adapters/opencl/adapter.cpp +++ b/source/adapters/opencl/adapter.cpp @@ -102,8 +102,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t, return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( - ur_adapter_handle_t, ur_logger_output_callback_t pfnLoggerCallback, +UR_APIEXPORT ur_result_t UR_APICALL urAdapterSetLoggerCallback( + ur_adapter_handle_t, ur_logger_callback_t pfnLoggerCallback, void *pUserData, ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET) { if (adapter) { @@ -114,7 +114,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urSetLoggerCallback( } UR_APIEXPORT ur_result_t UR_APICALL -urSetLoggerCallbackLevel(ur_adapter_handle_t, ur_logger_level_t level) { +urAdapterSetLoggerCallbackLevel(ur_adapter_handle_t, ur_logger_level_t level) { if (adapter) { adapter->log.setCallbackLevel(level); diff --git a/source/adapters/opencl/ur_interface_loader.cpp b/source/adapters/opencl/ur_interface_loader.cpp index 676438e3c8..c3b133e2e6 100644 --- a/source/adapters/opencl/ur_interface_loader.cpp +++ b/source/adapters/opencl/ur_interface_loader.cpp @@ -208,8 +208,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( pDdiTable->pfnAdapterRetain = urAdapterRetain; pDdiTable->pfnAdapterGetLastError = urAdapterGetLastError; pDdiTable->pfnAdapterGetInfo = urAdapterGetInfo; - pDdiTable->pfnSetLoggerCallback = urSetLoggerCallback; - pDdiTable->pfnSetLoggerCallbackLevel = urSetLoggerCallbackLevel; return UR_RESULT_SUCCESS; } @@ -439,6 +437,19 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( return UR_RESULT_SUCCESS; } + +UR_DLLEXPORT ur_result_t UR_APICALL urGetAdapterProcAddrTable( + ur_api_version_t version, ur_adapter_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + pDdiTable->pfnSetLoggerCallback = urAdapterSetLoggerCallback; + pDdiTable->pfnSetLoggerCallbackLevel = urAdapterSetLoggerCallbackLevel; + + return UR_RESULT_SUCCESS; +} + #if defined(__cplusplus) } // extern "C" #endif diff --git a/source/common/logger/ur_logger_details.hpp b/source/common/logger/ur_logger_details.hpp index cb6f9fceb3..36c06d8098 100644 --- a/source/common/logger/ur_logger_details.hpp +++ b/source/common/logger/ur_logger_details.hpp @@ -131,7 +131,7 @@ class Logger { this->standardSink = std::move(legacySink); } - void setCallbackSink(ur_logger_output_callback_t cb, void *pUserData, + void setCallbackSink(ur_logger_callback_t cb, void *pUserData, ur_logger_level_t level = UR_LOGGER_LEVEL_QUIET) { if (!callbackSink) { callbackSink = std::make_unique("UR_LOG_CALLBACK"); diff --git a/source/common/logger/ur_sinks.hpp b/source/common/logger/ur_sinks.hpp index f6799578fc..c86981a12c 100644 --- a/source/common/logger/ur_sinks.hpp +++ b/source/common/logger/ur_sinks.hpp @@ -229,13 +229,13 @@ class CallbackSink : public Sink { ~CallbackSink() = default; - void setCallback(ur_logger_output_callback_t cb, void *pUserData) { + void setCallback(ur_logger_callback_t cb, void *pUserData) { callback = cb; userData = pUserData; } private: - ur_logger_output_callback_t callback; + ur_logger_callback_t callback; void *userData; virtual void print(ur_logger_level_t level, diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index eee96a54ea..5af9c4aef7 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -217,79 +217,81 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetInfo( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urSetLoggerCallback -__urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( +/// @brief Intercept function for urAdapterSetLoggerCallback +__urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallback( ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter - ur_logger_output_callback_t + ur_logger_callback_t pfnLoggerCallback, ///< [in] Function pointer to callback from the logger. void * pUserData, ///< [in][out][optional] pointer to data to be passed to callback ur_logger_level_t level ///< [in] logging level ) { auto pfnSetLoggerCallback = - getContext()->urDdiTable.Global.pfnSetLoggerCallback; + getContext()->urDdiTable.Adapter.pfnSetLoggerCallback; if (nullptr == pfnSetLoggerCallback) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_set_logger_callback_params_t params = {&hAdapter, &pfnLoggerCallback, - &pUserData, &level}; - uint64_t instance = getContext()->notify_begin( - UR_FUNCTION_SET_LOGGER_CALLBACK, "urSetLoggerCallback", ¶ms); + ur_adapter_set_logger_callback_params_t params = { + &hAdapter, &pfnLoggerCallback, &pUserData, &level}; + uint64_t instance = + getContext()->notify_begin(UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK, + "urAdapterSetLoggerCallback", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urSetLoggerCallback\n"); + logger.info(" ---> urAdapterSetLoggerCallback\n"); ur_result_t result = pfnSetLoggerCallback(hAdapter, pfnLoggerCallback, pUserData, level); - getContext()->notify_end(UR_FUNCTION_SET_LOGGER_CALLBACK, - "urSetLoggerCallback", ¶ms, &result, instance); + getContext()->notify_end(UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK, + "urAdapterSetLoggerCallback", ¶ms, &result, + instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( - args_str, UR_FUNCTION_SET_LOGGER_CALLBACK, ¶ms); - logger.info(" <--- urSetLoggerCallback({}) -> {};\n", args_str.str(), - result); + args_str, UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK, ¶ms); + logger.info(" <--- urAdapterSetLoggerCallback({}) -> {};\n", + args_str.str(), result); } return result; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urSetLoggerCallbackLevel -__urdlllocal ur_result_t UR_APICALL urSetLoggerCallbackLevel( +/// @brief Intercept function for urAdapterSetLoggerCallbackLevel +__urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallbackLevel( ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter ur_logger_level_t level ///< [in] logging level ) { auto pfnSetLoggerCallbackLevel = - getContext()->urDdiTable.Global.pfnSetLoggerCallbackLevel; + getContext()->urDdiTable.Adapter.pfnSetLoggerCallbackLevel; if (nullptr == pfnSetLoggerCallbackLevel) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_set_logger_callback_level_params_t params = {&hAdapter, &level}; - uint64_t instance = - getContext()->notify_begin(UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL, - "urSetLoggerCallbackLevel", ¶ms); + ur_adapter_set_logger_callback_level_params_t params = {&hAdapter, &level}; + uint64_t instance = getContext()->notify_begin( + UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK_LEVEL, + "urAdapterSetLoggerCallbackLevel", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urSetLoggerCallbackLevel\n"); + logger.info(" ---> urAdapterSetLoggerCallbackLevel\n"); ur_result_t result = pfnSetLoggerCallbackLevel(hAdapter, level); - getContext()->notify_end(UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL, - "urSetLoggerCallbackLevel", ¶ms, &result, - instance); + getContext()->notify_end(UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK_LEVEL, + "urAdapterSetLoggerCallbackLevel", ¶ms, + &result, instance); if (logger.getLevel() <= logger::Level::INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( - args_str, UR_FUNCTION_SET_LOGGER_CALLBACK_LEVEL, ¶ms); - logger.info(" <--- urSetLoggerCallbackLevel({}) -> {};\n", + args_str, UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK_LEVEL, ¶ms); + logger.info(" <--- urAdapterSetLoggerCallbackLevel({}) -> {};\n", args_str.str(), result); } @@ -9281,12 +9283,43 @@ __urdlllocal ur_result_t UR_APICALL urGetGlobalProcAddrTable( dditable.pfnAdapterGetInfo = pDdiTable->pfnAdapterGetInfo; pDdiTable->pfnAdapterGetInfo = ur_tracing_layer::urAdapterGetInfo; + return result; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Adapter table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +__urdlllocal 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 +) { + auto &dditable = ur_tracing_layer::getContext()->urDdiTable.Adapter; + + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (UR_MAJOR_VERSION(ur_tracing_layer::getContext()->version) != + UR_MAJOR_VERSION(version) || + UR_MINOR_VERSION(ur_tracing_layer::getContext()->version) > + UR_MINOR_VERSION(version)) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + dditable.pfnSetLoggerCallback = pDdiTable->pfnSetLoggerCallback; - pDdiTable->pfnSetLoggerCallback = ur_tracing_layer::urSetLoggerCallback; + pDdiTable->pfnSetLoggerCallback = + ur_tracing_layer::urAdapterSetLoggerCallback; dditable.pfnSetLoggerCallbackLevel = pDdiTable->pfnSetLoggerCallbackLevel; pDdiTable->pfnSetLoggerCallbackLevel = - ur_tracing_layer::urSetLoggerCallbackLevel; + ur_tracing_layer::urAdapterSetLoggerCallbackLevel; return result; } @@ -10554,6 +10587,11 @@ ur_result_t context_t::init(ur_dditable_t *dditable, UR_API_VERSION_CURRENT, &dditable->Global); } + if (UR_RESULT_SUCCESS == result) { + result = ur_tracing_layer::urGetAdapterProcAddrTable( + UR_API_VERSION_CURRENT, &dditable->Adapter); + } + if (UR_RESULT_SUCCESS == result) { result = ur_tracing_layer::urGetBindlessImagesExpProcAddrTable( UR_API_VERSION_CURRENT, &dditable->BindlessImagesExp); diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 6e9b9dfa48..c2b5e43e49 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -203,17 +203,17 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetInfo( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urSetLoggerCallback -__urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( +/// @brief Intercept function for urAdapterSetLoggerCallback +__urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallback( ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter - ur_logger_output_callback_t + ur_logger_callback_t pfnLoggerCallback, ///< [in] Function pointer to callback from the logger. void * pUserData, ///< [in][out][optional] pointer to data to be passed to callback ur_logger_level_t level ///< [in] logging level ) { auto pfnSetLoggerCallback = - getContext()->urDdiTable.Global.pfnSetLoggerCallback; + getContext()->urDdiTable.Adapter.pfnSetLoggerCallback; if (nullptr == pfnSetLoggerCallback) { return UR_RESULT_ERROR_UNINITIALIZED; @@ -245,13 +245,13 @@ __urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urSetLoggerCallbackLevel -__urdlllocal ur_result_t UR_APICALL urSetLoggerCallbackLevel( +/// @brief Intercept function for urAdapterSetLoggerCallbackLevel +__urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallbackLevel( ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter ur_logger_level_t level ///< [in] logging level ) { auto pfnSetLoggerCallbackLevel = - getContext()->urDdiTable.Global.pfnSetLoggerCallbackLevel; + getContext()->urDdiTable.Adapter.pfnSetLoggerCallbackLevel; if (nullptr == pfnSetLoggerCallbackLevel) { return UR_RESULT_ERROR_UNINITIALIZED; @@ -10311,12 +10311,44 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( dditable.pfnAdapterGetInfo = pDdiTable->pfnAdapterGetInfo; pDdiTable->pfnAdapterGetInfo = ur_validation_layer::urAdapterGetInfo; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Adapter table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::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 +) { + auto &dditable = ur_validation_layer::getContext()->urDdiTable.Adapter; + + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (UR_MAJOR_VERSION(ur_validation_layer::getContext()->version) != + UR_MAJOR_VERSION(version) || + UR_MINOR_VERSION(ur_validation_layer::getContext()->version) > + UR_MINOR_VERSION(version)) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + dditable.pfnSetLoggerCallback = pDdiTable->pfnSetLoggerCallback; - pDdiTable->pfnSetLoggerCallback = ur_validation_layer::urSetLoggerCallback; + pDdiTable->pfnSetLoggerCallback = + ur_validation_layer::urAdapterSetLoggerCallback; dditable.pfnSetLoggerCallbackLevel = pDdiTable->pfnSetLoggerCallbackLevel; pDdiTable->pfnSetLoggerCallbackLevel = - ur_validation_layer::urSetLoggerCallbackLevel; + ur_validation_layer::urAdapterSetLoggerCallbackLevel; return result; } @@ -11631,6 +11663,11 @@ ur_result_t context_t::init(ur_dditable_t *dditable, UR_API_VERSION_CURRENT, &dditable->Global); } + if (UR_RESULT_SUCCESS == result) { + result = ur_validation_layer::urGetAdapterProcAddrTable( + UR_API_VERSION_CURRENT, &dditable->Adapter); + } + if (UR_RESULT_SUCCESS == result) { result = ur_validation_layer::urGetBindlessImagesExpProcAddrTable( UR_API_VERSION_CURRENT, &dditable->BindlessImagesExp); diff --git a/source/loader/loader.def.in b/source/loader/loader.def.in index 743a40164f..2b04888abd 100644 --- a/source/loader/loader.def.in +++ b/source/loader/loader.def.in @@ -5,6 +5,8 @@ EXPORTS urAdapterGetLastError urAdapterRelease urAdapterRetain + urAdapterSetLoggerCallback + urAdapterSetLoggerCallbackLevel urBindlessImagesImageAllocateExp urBindlessImagesImageCopyExp urBindlessImagesImageFreeExp @@ -101,6 +103,7 @@ EXPORTS urEventRetain urEventSetCallback urEventWait + urGetAdapterProcAddrTable urGetBindlessImagesExpProcAddrTable urGetCommandBufferExpProcAddrTable urGetContextProcAddrTable @@ -174,6 +177,8 @@ EXPORTS urPrintAdapterInfo urPrintAdapterReleaseParams urPrintAdapterRetainParams + urPrintAdapterSetLoggerCallbackLevelParams + urPrintAdapterSetLoggerCallbackParams urPrintApiVersion urPrintBaseDesc urPrintBaseProperties @@ -459,8 +464,6 @@ EXPORTS urPrintSamplerNativeProperties urPrintSamplerReleaseParams urPrintSamplerRetainParams - urPrintSetLoggerCallbackLevelParams - urPrintSetLoggerCallbackParams urPrintSpecializationConstantInfo urPrintStructureType urPrintUsmAdviceFlags @@ -533,8 +536,6 @@ EXPORTS urSamplerGetNativeHandle urSamplerRelease urSamplerRetain - urSetLoggerCallback - urSetLoggerCallbackLevel urUSMDeviceAlloc urUSMFree urUSMGetMemAllocInfo diff --git a/source/loader/loader.map.in b/source/loader/loader.map.in index 6c8d48c876..7b544b9e70 100644 --- a/source/loader/loader.map.in +++ b/source/loader/loader.map.in @@ -5,6 +5,8 @@ urAdapterGetLastError; urAdapterRelease; urAdapterRetain; + urAdapterSetLoggerCallback; + urAdapterSetLoggerCallbackLevel; urBindlessImagesImageAllocateExp; urBindlessImagesImageCopyExp; urBindlessImagesImageFreeExp; @@ -101,6 +103,7 @@ urEventRetain; urEventSetCallback; urEventWait; + urGetAdapterProcAddrTable; urGetBindlessImagesExpProcAddrTable; urGetCommandBufferExpProcAddrTable; urGetContextProcAddrTable; @@ -174,6 +177,8 @@ urPrintAdapterInfo; urPrintAdapterReleaseParams; urPrintAdapterRetainParams; + urPrintAdapterSetLoggerCallbackLevelParams; + urPrintAdapterSetLoggerCallbackParams; urPrintApiVersion; urPrintBaseDesc; urPrintBaseProperties; @@ -459,8 +464,6 @@ urPrintSamplerNativeProperties; urPrintSamplerReleaseParams; urPrintSamplerRetainParams; - urPrintSetLoggerCallbackLevelParams; - urPrintSetLoggerCallbackParams; urPrintSpecializationConstantInfo; urPrintStructureType; urPrintUsmAdviceFlags; @@ -533,8 +536,6 @@ urSamplerGetNativeHandle; urSamplerRelease; urSamplerRetain; - urSetLoggerCallback; - urSetLoggerCallbackLevel; urUSMDeviceAlloc; urUSMFree; urUSMGetMemAllocInfo; diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 7a0f1e4888..4328f8eabf 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -181,10 +181,10 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetInfo( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urSetLoggerCallback -__urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( +/// @brief Intercept function for urAdapterSetLoggerCallback +__urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallback( ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter - ur_logger_output_callback_t + ur_logger_callback_t pfnLoggerCallback, ///< [in] Function pointer to callback from the logger. void * pUserData, ///< [in][out][optional] pointer to data to be passed to callback @@ -196,7 +196,7 @@ __urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( // extract platform's function pointer table auto dditable = reinterpret_cast(hAdapter)->dditable; - auto pfnSetLoggerCallback = dditable->ur.Global.pfnSetLoggerCallback; + auto pfnSetLoggerCallback = dditable->ur.Adapter.pfnSetLoggerCallback; if (nullptr == pfnSetLoggerCallback) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -212,8 +212,8 @@ __urdlllocal ur_result_t UR_APICALL urSetLoggerCallback( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urSetLoggerCallbackLevel -__urdlllocal ur_result_t UR_APICALL urSetLoggerCallbackLevel( +/// @brief Intercept function for urAdapterSetLoggerCallbackLevel +__urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallbackLevel( ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter ur_logger_level_t level ///< [in] logging level ) { @@ -224,7 +224,7 @@ __urdlllocal ur_result_t UR_APICALL urSetLoggerCallbackLevel( // extract platform's function pointer table auto dditable = reinterpret_cast(hAdapter)->dditable; auto pfnSetLoggerCallbackLevel = - dditable->ur.Global.pfnSetLoggerCallbackLevel; + dditable->ur.Adapter.pfnSetLoggerCallbackLevel; if (nullptr == pfnSetLoggerCallbackLevel) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -9405,9 +9405,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( pDdiTable->pfnAdapterGetLastError = ur_loader::urAdapterGetLastError; pDdiTable->pfnAdapterGetInfo = ur_loader::urAdapterGetInfo; - pDdiTable->pfnSetLoggerCallback = ur_loader::urSetLoggerCallback; - pDdiTable->pfnSetLoggerCallbackLevel = - ur_loader::urSetLoggerCallbackLevel; } else { // return pointers directly to platform's DDIs *pDdiTable = @@ -9418,6 +9415,67 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @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 +) { + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (ur_loader::getContext()->version < version) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + + // Load the device-platform DDI tables + for (auto &platform : ur_loader::getContext()->platforms) { + // statically linked adapter inside of the loader + if (platform.handle == nullptr) { + continue; + } + + if (platform.initStatus != UR_RESULT_SUCCESS) { + continue; + } + auto getTable = reinterpret_cast( + ur_loader::LibLoader::getFunctionPtr(platform.handle.get(), + "urGetAdapterProcAddrTable")); + if (!getTable) { + continue; + } + platform.initStatus = getTable(version, &platform.dditable.ur.Adapter); + } + + if (UR_RESULT_SUCCESS == result) { + if (ur_loader::getContext()->platforms.size() != 1 || + ur_loader::getContext()->forceIntercept) { + // return pointers to loader's DDIs + pDdiTable->pfnSetLoggerCallback = + ur_loader::urAdapterSetLoggerCallback; + pDdiTable->pfnSetLoggerCallbackLevel = + ur_loader::urAdapterSetLoggerCallbackLevel; + } else { + // return pointers directly to platform's DDIs + *pDdiTable = + ur_loader::getContext()->platforms.front().dditable.ur.Adapter; + } + } + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's BindlessImagesExp table /// with current process' addresses diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 4564f173d4..8f4dd04645 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -503,16 +503,16 @@ ur_result_t UR_APICALL urAdapterGetInfo( /// + `NULL == pfnLoggerCallback` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_LOGGER_LEVEL_QUIET < level` -ur_result_t UR_APICALL urSetLoggerCallback( +ur_result_t UR_APICALL urAdapterSetLoggerCallback( ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter - ur_logger_output_callback_t + ur_logger_callback_t pfnLoggerCallback, ///< [in] Function pointer to callback from the logger. void * pUserData, ///< [in][out][optional] pointer to data to be passed to callback ur_logger_level_t level ///< [in] logging level ) try { auto pfnSetLoggerCallback = - ur_lib::getContext()->urDdiTable.Global.pfnSetLoggerCallback; + ur_lib::getContext()->urDdiTable.Adapter.pfnSetLoggerCallback; if (nullptr == pfnSetLoggerCallback) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -534,12 +534,12 @@ ur_result_t UR_APICALL urSetLoggerCallback( /// + `NULL == hAdapter` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_LOGGER_LEVEL_QUIET < level` -ur_result_t UR_APICALL urSetLoggerCallbackLevel( +ur_result_t UR_APICALL urAdapterSetLoggerCallbackLevel( ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter ur_logger_level_t level ///< [in] logging level ) try { auto pfnSetLoggerCallbackLevel = - ur_lib::getContext()->urDdiTable.Global.pfnSetLoggerCallbackLevel; + ur_lib::getContext()->urDdiTable.Adapter.pfnSetLoggerCallbackLevel; if (nullptr == pfnSetLoggerCallbackLevel) { return UR_RESULT_ERROR_UNINITIALIZED; } diff --git a/source/loader/ur_libddi.cpp b/source/loader/ur_libddi.cpp index 4d88bb2044..9d3474285c 100644 --- a/source/loader/ur_libddi.cpp +++ b/source/loader/ur_libddi.cpp @@ -25,6 +25,11 @@ __urdlllocal ur_result_t context_t::ddiInit() { &urDdiTable.Global); } + if (UR_RESULT_SUCCESS == result) { + result = urGetAdapterProcAddrTable(UR_API_VERSION_CURRENT, + &urDdiTable.Adapter); + } + if (UR_RESULT_SUCCESS == result) { result = urGetBindlessImagesExpProcAddrTable( UR_API_VERSION_CURRENT, &urDdiTable.BindlessImagesExp); diff --git a/source/loader/ur_print.cpp b/source/loader/ur_print.cpp index 21e9bfcf1b..42015e6b72 100644 --- a/source/loader/ur_print.cpp +++ b/source/loader/ur_print.cpp @@ -1136,17 +1136,17 @@ urPrintAdapterGetInfoParams(const struct ur_adapter_get_info_params_t *params, return str_copy(&ss, buffer, buff_size, out_size); } -ur_result_t urPrintSetLoggerCallbackParams( - const struct ur_set_logger_callback_params_t *params, char *buffer, +ur_result_t urPrintAdapterSetLoggerCallbackParams( + const struct ur_adapter_set_logger_callback_params_t *params, char *buffer, const size_t buff_size, size_t *out_size) { std::stringstream ss; ss << params; return str_copy(&ss, buffer, buff_size, out_size); } -ur_result_t urPrintSetLoggerCallbackLevelParams( - const struct ur_set_logger_callback_level_params_t *params, char *buffer, - const size_t buff_size, size_t *out_size) { +ur_result_t urPrintAdapterSetLoggerCallbackLevelParams( + const struct ur_adapter_set_logger_callback_level_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size) { std::stringstream ss; ss << params; return str_copy(&ss, buffer, buff_size, out_size); diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 2c455ca48d..d41bf23c8e 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -454,9 +454,9 @@ ur_result_t UR_APICALL urAdapterGetInfo( /// + `NULL == pfnLoggerCallback` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_LOGGER_LEVEL_QUIET < level` -ur_result_t UR_APICALL urSetLoggerCallback( +ur_result_t UR_APICALL urAdapterSetLoggerCallback( ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter - ur_logger_output_callback_t + ur_logger_callback_t pfnLoggerCallback, ///< [in] Function pointer to callback from the logger. void * pUserData, ///< [in][out][optional] pointer to data to be passed to callback @@ -478,7 +478,7 @@ ur_result_t UR_APICALL urSetLoggerCallback( /// + `NULL == hAdapter` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_LOGGER_LEVEL_QUIET < level` -ur_result_t UR_APICALL urSetLoggerCallbackLevel( +ur_result_t UR_APICALL urAdapterSetLoggerCallbackLevel( ur_adapter_handle_t hAdapter, ///< [in] handle of the adapter ur_logger_level_t level ///< [in] logging level ) { From e592c3ddb2a1b9f68061f164c5ee0bbcec16caa5 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Thu, 17 Oct 2024 16:23:15 +0100 Subject: [PATCH 4/4] Update tracing mako template to account to use new logger level enum. --- scripts/templates/trcddi.cpp.mako | 2 +- source/loader/layers/tracing/ur_trcddi.cpp | 380 ++++++++++----------- 2 files changed, 191 insertions(+), 191 deletions(-) diff --git a/scripts/templates/trcddi.cpp.mako b/scripts/templates/trcddi.cpp.mako index 9c676810b4..b26b56b342 100644 --- a/scripts/templates/trcddi.cpp.mako +++ b/scripts/templates/trcddi.cpp.mako @@ -52,7 +52,7 @@ namespace ur_tracing_layer getContext()->notify_end(${th.make_func_etor(n, tags, obj)}, "${th.make_func_name(n, tags, obj)}", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, ${th.make_func_etor(n, tags, obj)}, ¶ms); logger.info(" <--- ${th.make_func_name(n, tags, obj)}({}) -> {};\n", args_str.str(), result); diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index 5af9c4aef7..3aa263b93f 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -48,7 +48,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGet( getContext()->notify_end(UR_FUNCTION_ADAPTER_GET, "urAdapterGet", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_GET, ¶ms); @@ -82,7 +82,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRelease( getContext()->notify_end(UR_FUNCTION_ADAPTER_RELEASE, "urAdapterRelease", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_RELEASE, ¶ms); @@ -116,7 +116,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRetain( getContext()->notify_end(UR_FUNCTION_ADAPTER_RETAIN, "urAdapterRetain", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_RETAIN, ¶ms); @@ -159,7 +159,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetLastError( "urAdapterGetLastError", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ADAPTER_GET_LAST_ERROR, ¶ms); @@ -205,7 +205,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetInfo( getContext()->notify_end(UR_FUNCTION_ADAPTER_GET_INFO, "urAdapterGetInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_GET_INFO, ¶ms); @@ -287,7 +287,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallbackLevel( "urAdapterSetLoggerCallbackLevel", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK_LEVEL, ¶ms); @@ -336,7 +336,7 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGet( getContext()->notify_end(UR_FUNCTION_PLATFORM_GET, "urPlatformGet", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PLATFORM_GET, ¶ms); @@ -382,7 +382,7 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetInfo( getContext()->notify_end(UR_FUNCTION_PLATFORM_GET_INFO, "urPlatformGetInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PLATFORM_GET_INFO, ¶ms); @@ -419,7 +419,7 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetApiVersion( "urPlatformGetApiVersion", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PLATFORM_GET_API_VERSION, ¶ms); @@ -459,7 +459,7 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetNativeHandle( "urPlatformGetNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PLATFORM_GET_NATIVE_HANDLE, ¶ms); @@ -505,7 +505,7 @@ __urdlllocal ur_result_t UR_APICALL urPlatformCreateWithNativeHandle( "urPlatformCreateWithNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PLATFORM_CREATE_WITH_NATIVE_HANDLE, ¶ms); @@ -549,7 +549,7 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetBackendOption( "urPlatformGetBackendOption", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION, ¶ms); @@ -597,7 +597,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGet( getContext()->notify_end(UR_FUNCTION_DEVICE_GET, "urDeviceGet", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_GET, ¶ms); @@ -643,7 +643,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetInfo( getContext()->notify_end(UR_FUNCTION_DEVICE_GET_INFO, "urDeviceGetInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_GET_INFO, ¶ms); @@ -678,7 +678,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRetain( getContext()->notify_end(UR_FUNCTION_DEVICE_RETAIN, "urDeviceRetain", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_RETAIN, ¶ms); @@ -713,7 +713,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRelease( getContext()->notify_end(UR_FUNCTION_DEVICE_RELEASE, "urDeviceRelease", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_RELEASE, ¶ms); @@ -759,7 +759,7 @@ __urdlllocal ur_result_t UR_APICALL urDevicePartition( getContext()->notify_end(UR_FUNCTION_DEVICE_PARTITION, "urDevicePartition", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_PARTITION, ¶ms); @@ -805,7 +805,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceSelectBinary( "urDeviceSelectBinary", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_DEVICE_SELECT_BINARY, ¶ms); @@ -844,7 +844,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetNativeHandle( "urDeviceGetNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_DEVICE_GET_NATIVE_HANDLE, ¶ms); @@ -890,7 +890,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceCreateWithNativeHandle( "urDeviceCreateWithNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_DEVICE_CREATE_WITH_NATIVE_HANDLE, ¶ms); @@ -935,7 +935,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetGlobalTimestamps( "urDeviceGetGlobalTimestamps", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_DEVICE_GET_GLOBAL_TIMESTAMPS, ¶ms); @@ -977,7 +977,7 @@ __urdlllocal ur_result_t UR_APICALL urContextCreate( getContext()->notify_end(UR_FUNCTION_CONTEXT_CREATE, "urContextCreate", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_CREATE, ¶ms); @@ -1012,7 +1012,7 @@ __urdlllocal ur_result_t UR_APICALL urContextRetain( getContext()->notify_end(UR_FUNCTION_CONTEXT_RETAIN, "urContextRetain", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_RETAIN, ¶ms); @@ -1047,7 +1047,7 @@ __urdlllocal ur_result_t UR_APICALL urContextRelease( getContext()->notify_end(UR_FUNCTION_CONTEXT_RELEASE, "urContextRelease", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_RELEASE, ¶ms); @@ -1095,7 +1095,7 @@ __urdlllocal ur_result_t UR_APICALL urContextGetInfo( getContext()->notify_end(UR_FUNCTION_CONTEXT_GET_INFO, "urContextGetInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_GET_INFO, ¶ms); @@ -1135,7 +1135,7 @@ __urdlllocal ur_result_t UR_APICALL urContextGetNativeHandle( "urContextGetNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_CONTEXT_GET_NATIVE_HANDLE, ¶ms); @@ -1187,7 +1187,7 @@ __urdlllocal ur_result_t UR_APICALL urContextCreateWithNativeHandle( "urContextCreateWithNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_CONTEXT_CREATE_WITH_NATIVE_HANDLE, ¶ms); @@ -1229,7 +1229,7 @@ __urdlllocal ur_result_t UR_APICALL urContextSetExtendedDeleter( "urContextSetExtendedDeleter", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_CONTEXT_SET_EXTENDED_DELETER, ¶ms); @@ -1271,7 +1271,7 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreate( getContext()->notify_end(UR_FUNCTION_MEM_IMAGE_CREATE, "urMemImageCreate", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_IMAGE_CREATE, ¶ms); @@ -1313,7 +1313,7 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreate( getContext()->notify_end(UR_FUNCTION_MEM_BUFFER_CREATE, "urMemBufferCreate", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_BUFFER_CREATE, ¶ms); @@ -1348,7 +1348,7 @@ __urdlllocal ur_result_t UR_APICALL urMemRetain( getContext()->notify_end(UR_FUNCTION_MEM_RETAIN, "urMemRetain", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_RETAIN, ¶ms); @@ -1382,7 +1382,7 @@ __urdlllocal ur_result_t UR_APICALL urMemRelease( getContext()->notify_end(UR_FUNCTION_MEM_RELEASE, "urMemRelease", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_RELEASE, ¶ms); @@ -1426,7 +1426,7 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferPartition( "urMemBufferPartition", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_MEM_BUFFER_PARTITION, ¶ms); @@ -1466,7 +1466,7 @@ __urdlllocal ur_result_t UR_APICALL urMemGetNativeHandle( "urMemGetNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_MEM_GET_NATIVE_HANDLE, ¶ms); @@ -1511,7 +1511,7 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreateWithNativeHandle( "urMemBufferCreateWithNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_MEM_BUFFER_CREATE_WITH_NATIVE_HANDLE, @@ -1561,7 +1561,7 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreateWithNativeHandle( "urMemImageCreateWithNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_MEM_IMAGE_CREATE_WITH_NATIVE_HANDLE, ¶ms); @@ -1609,7 +1609,7 @@ __urdlllocal ur_result_t UR_APICALL urMemGetInfo( getContext()->notify_end(UR_FUNCTION_MEM_GET_INFO, "urMemGetInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_GET_INFO, ¶ms); @@ -1656,7 +1656,7 @@ __urdlllocal ur_result_t UR_APICALL urMemImageGetInfo( getContext()->notify_end(UR_FUNCTION_MEM_IMAGE_GET_INFO, "urMemImageGetInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_MEM_IMAGE_GET_INFO, ¶ms); @@ -1693,7 +1693,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerCreate( getContext()->notify_end(UR_FUNCTION_SAMPLER_CREATE, "urSamplerCreate", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_CREATE, ¶ms); @@ -1728,7 +1728,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRetain( getContext()->notify_end(UR_FUNCTION_SAMPLER_RETAIN, "urSamplerRetain", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_RETAIN, ¶ms); @@ -1763,7 +1763,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRelease( getContext()->notify_end(UR_FUNCTION_SAMPLER_RELEASE, "urSamplerRelease", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_RELEASE, ¶ms); @@ -1807,7 +1807,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerGetInfo( getContext()->notify_end(UR_FUNCTION_SAMPLER_GET_INFO, "urSamplerGetInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_GET_INFO, ¶ms); @@ -1847,7 +1847,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerGetNativeHandle( "urSamplerGetNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_SAMPLER_GET_NATIVE_HANDLE, ¶ms); @@ -1892,7 +1892,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerCreateWithNativeHandle( "urSamplerCreateWithNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_SAMPLER_CREATE_WITH_NATIVE_HANDLE, ¶ms); @@ -1934,7 +1934,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMHostAlloc( getContext()->notify_end(UR_FUNCTION_USM_HOST_ALLOC, "urUSMHostAlloc", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_HOST_ALLOC, ¶ms); @@ -1978,7 +1978,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMDeviceAlloc( getContext()->notify_end(UR_FUNCTION_USM_DEVICE_ALLOC, "urUSMDeviceAlloc", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_DEVICE_ALLOC, ¶ms); @@ -2022,7 +2022,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMSharedAlloc( getContext()->notify_end(UR_FUNCTION_USM_SHARED_ALLOC, "urUSMSharedAlloc", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_SHARED_ALLOC, ¶ms); @@ -2057,7 +2057,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMFree( getContext()->notify_end(UR_FUNCTION_USM_FREE, "urUSMFree", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_FREE, ¶ms); @@ -2103,7 +2103,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMGetMemAllocInfo( "urUSMGetMemAllocInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_USM_GET_MEM_ALLOC_INFO, ¶ms); @@ -2141,7 +2141,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolCreate( getContext()->notify_end(UR_FUNCTION_USM_POOL_CREATE, "urUSMPoolCreate", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_CREATE, ¶ms); @@ -2175,7 +2175,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRetain( getContext()->notify_end(UR_FUNCTION_USM_POOL_RETAIN, "urUSMPoolRetain", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_RETAIN, ¶ms); @@ -2209,7 +2209,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRelease( getContext()->notify_end(UR_FUNCTION_USM_POOL_RELEASE, "urUSMPoolRelease", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_RELEASE, ¶ms); @@ -2252,7 +2252,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetInfo( getContext()->notify_end(UR_FUNCTION_USM_POOL_GET_INFO, "urUSMPoolGetInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_GET_INFO, ¶ms); @@ -2305,7 +2305,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemGranularityGetInfo( "urVirtualMemGranularityGetInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_VIRTUAL_MEM_GRANULARITY_GET_INFO, ¶ms); @@ -2349,7 +2349,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemReserve( getContext()->notify_end(UR_FUNCTION_VIRTUAL_MEM_RESERVE, "urVirtualMemReserve", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_VIRTUAL_MEM_RESERVE, ¶ms); @@ -2386,7 +2386,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemFree( getContext()->notify_end(UR_FUNCTION_VIRTUAL_MEM_FREE, "urVirtualMemFree", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_FREE, ¶ms); @@ -2431,7 +2431,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemMap( getContext()->notify_end(UR_FUNCTION_VIRTUAL_MEM_MAP, "urVirtualMemMap", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_MAP, ¶ms); @@ -2468,7 +2468,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemUnmap( getContext()->notify_end(UR_FUNCTION_VIRTUAL_MEM_UNMAP, "urVirtualMemUnmap", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_UNMAP, ¶ms); @@ -2509,7 +2509,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemSetAccess( "urVirtualMemSetAccess", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_VIRTUAL_MEM_SET_ACCESS, ¶ms); @@ -2559,7 +2559,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemGetInfo( getContext()->notify_end(UR_FUNCTION_VIRTUAL_MEM_GET_INFO, "urVirtualMemGetInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_VIRTUAL_MEM_GET_INFO, ¶ms); @@ -2603,7 +2603,7 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemCreate( getContext()->notify_end(UR_FUNCTION_PHYSICAL_MEM_CREATE, "urPhysicalMemCreate", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PHYSICAL_MEM_CREATE, ¶ms); @@ -2638,7 +2638,7 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRetain( getContext()->notify_end(UR_FUNCTION_PHYSICAL_MEM_RETAIN, "urPhysicalMemRetain", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PHYSICAL_MEM_RETAIN, ¶ms); @@ -2674,7 +2674,7 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRelease( "urPhysicalMemRelease", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PHYSICAL_MEM_RELEASE, ¶ms); @@ -2717,7 +2717,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL( "urProgramCreateWithIL", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_CREATE_WITH_IL, ¶ms); @@ -2764,7 +2764,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary( "urProgramCreateWithBinary", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY, ¶ms); @@ -2801,7 +2801,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuild( getContext()->notify_end(UR_FUNCTION_PROGRAM_BUILD, "urProgramBuild", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_BUILD, ¶ms); @@ -2839,7 +2839,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCompile( getContext()->notify_end(UR_FUNCTION_PROGRAM_COMPILE, "urProgramCompile", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_COMPILE, ¶ms); @@ -2885,7 +2885,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramLink( getContext()->notify_end(UR_FUNCTION_PROGRAM_LINK, "urProgramLink", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_LINK, ¶ms); @@ -2920,7 +2920,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramRetain( getContext()->notify_end(UR_FUNCTION_PROGRAM_RETAIN, "urProgramRetain", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_RETAIN, ¶ms); @@ -2955,7 +2955,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramRelease( getContext()->notify_end(UR_FUNCTION_PROGRAM_RELEASE, "urProgramRelease", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_RELEASE, ¶ms); @@ -3003,7 +3003,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetFunctionPointer( "urProgramGetFunctionPointer", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_GET_FUNCTION_POINTER, ¶ms); @@ -3054,7 +3054,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetGlobalVariablePointer( "urProgramGetGlobalVariablePointer", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_GET_GLOBAL_VARIABLE_POINTER, ¶ms); @@ -3101,7 +3101,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetInfo( getContext()->notify_end(UR_FUNCTION_PROGRAM_GET_INFO, "urProgramGetInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_GET_INFO, ¶ms); @@ -3151,7 +3151,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetBuildInfo( "urProgramGetBuildInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_GET_BUILD_INFO, ¶ms); @@ -3194,7 +3194,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramSetSpecializationConstants( "urProgramSetSpecializationConstants", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_SET_SPECIALIZATION_CONSTANTS, @@ -3235,7 +3235,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetNativeHandle( "urProgramGetNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_GET_NATIVE_HANDLE, ¶ms); @@ -3280,7 +3280,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithNativeHandle( "urProgramCreateWithNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_CREATE_WITH_NATIVE_HANDLE, ¶ms); @@ -3317,7 +3317,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreate( getContext()->notify_end(UR_FUNCTION_KERNEL_CREATE, "urKernelCreate", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_CREATE, ¶ms); @@ -3360,7 +3360,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgValue( getContext()->notify_end(UR_FUNCTION_KERNEL_SET_ARG_VALUE, "urKernelSetArgValue", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_SET_ARG_VALUE, ¶ms); @@ -3401,7 +3401,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgLocal( getContext()->notify_end(UR_FUNCTION_KERNEL_SET_ARG_LOCAL, "urKernelSetArgLocal", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_SET_ARG_LOCAL, ¶ms); @@ -3449,7 +3449,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetInfo( getContext()->notify_end(UR_FUNCTION_KERNEL_GET_INFO, "urKernelGetInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_GET_INFO, ¶ms); @@ -3496,7 +3496,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetGroupInfo( "urKernelGetGroupInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_GET_GROUP_INFO, ¶ms); @@ -3545,7 +3545,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetSubGroupInfo( "urKernelGetSubGroupInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_GET_SUB_GROUP_INFO, ¶ms); @@ -3579,7 +3579,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelRetain( getContext()->notify_end(UR_FUNCTION_KERNEL_RETAIN, "urKernelRetain", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_RETAIN, ¶ms); @@ -3614,7 +3614,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelRelease( getContext()->notify_end(UR_FUNCTION_KERNEL_RELEASE, "urKernelRelease", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_RELEASE, ¶ms); @@ -3657,7 +3657,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgPointer( "urKernelSetArgPointer", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_SET_ARG_POINTER, ¶ms); @@ -3700,7 +3700,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetExecInfo( getContext()->notify_end(UR_FUNCTION_KERNEL_SET_EXEC_INFO, "urKernelSetExecInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_SET_EXEC_INFO, ¶ms); @@ -3741,7 +3741,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgSampler( "urKernelSetArgSampler", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_SET_ARG_SAMPLER, ¶ms); @@ -3782,7 +3782,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgMemObj( "urKernelSetArgMemObj", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_SET_ARG_MEM_OBJ, ¶ms); @@ -3824,7 +3824,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetSpecializationConstants( "urKernelSetSpecializationConstants", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_SET_SPECIALIZATION_CONSTANTS, ¶ms); @@ -3863,7 +3863,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetNativeHandle( "urKernelGetNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_GET_NATIVE_HANDLE, ¶ms); @@ -3910,7 +3910,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreateWithNativeHandle( "urKernelCreateWithNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_CREATE_WITH_NATIVE_HANDLE, ¶ms); @@ -3965,7 +3965,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetSuggestedLocalWorkSize( "urKernelGetSuggestedLocalWorkSize", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE, @@ -4010,7 +4010,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueGetInfo( getContext()->notify_end(UR_FUNCTION_QUEUE_GET_INFO, "urQueueGetInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_GET_INFO, ¶ms); @@ -4050,7 +4050,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueCreate( getContext()->notify_end(UR_FUNCTION_QUEUE_CREATE, "urQueueCreate", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_CREATE, ¶ms); @@ -4085,7 +4085,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueRetain( getContext()->notify_end(UR_FUNCTION_QUEUE_RETAIN, "urQueueRetain", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_RETAIN, ¶ms); @@ -4120,7 +4120,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueRelease( getContext()->notify_end(UR_FUNCTION_QUEUE_RELEASE, "urQueueRelease", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_RELEASE, ¶ms); @@ -4160,7 +4160,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueGetNativeHandle( "urQueueGetNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_QUEUE_GET_NATIVE_HANDLE, ¶ms); @@ -4206,7 +4206,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueCreateWithNativeHandle( "urQueueCreateWithNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_QUEUE_CREATE_WITH_NATIVE_HANDLE, ¶ms); @@ -4240,7 +4240,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueFinish( getContext()->notify_end(UR_FUNCTION_QUEUE_FINISH, "urQueueFinish", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_FINISH, ¶ms); @@ -4274,7 +4274,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueFlush( getContext()->notify_end(UR_FUNCTION_QUEUE_FLUSH, "urQueueFlush", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_FLUSH, ¶ms); @@ -4316,7 +4316,7 @@ __urdlllocal ur_result_t UR_APICALL urEventGetInfo( getContext()->notify_end(UR_FUNCTION_EVENT_GET_INFO, "urEventGetInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_GET_INFO, ¶ms); @@ -4364,7 +4364,7 @@ __urdlllocal ur_result_t UR_APICALL urEventGetProfilingInfo( "urEventGetProfilingInfo", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_EVENT_GET_PROFILING_INFO, ¶ms); @@ -4401,7 +4401,7 @@ __urdlllocal ur_result_t UR_APICALL urEventWait( getContext()->notify_end(UR_FUNCTION_EVENT_WAIT, "urEventWait", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_WAIT, ¶ms); @@ -4434,7 +4434,7 @@ __urdlllocal ur_result_t UR_APICALL urEventRetain( getContext()->notify_end(UR_FUNCTION_EVENT_RETAIN, "urEventRetain", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_RETAIN, ¶ms); @@ -4468,7 +4468,7 @@ __urdlllocal ur_result_t UR_APICALL urEventRelease( getContext()->notify_end(UR_FUNCTION_EVENT_RELEASE, "urEventRelease", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_RELEASE, ¶ms); @@ -4505,7 +4505,7 @@ __urdlllocal ur_result_t UR_APICALL urEventGetNativeHandle( "urEventGetNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_EVENT_GET_NATIVE_HANDLE, ¶ms); @@ -4550,7 +4550,7 @@ __urdlllocal ur_result_t UR_APICALL urEventCreateWithNativeHandle( "urEventCreateWithNativeHandle", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_EVENT_CREATE_WITH_NATIVE_HANDLE, ¶ms); @@ -4590,7 +4590,7 @@ __urdlllocal ur_result_t UR_APICALL urEventSetCallback( getContext()->notify_end(UR_FUNCTION_EVENT_SET_CALLBACK, "urEventSetCallback", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_EVENT_SET_CALLBACK, ¶ms); @@ -4660,7 +4660,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch( "urEnqueueKernelLaunch", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH, ¶ms); @@ -4707,7 +4707,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWait( getContext()->notify_end(UR_FUNCTION_ENQUEUE_EVENTS_WAIT, "urEnqueueEventsWait", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_EVENTS_WAIT, ¶ms); @@ -4757,7 +4757,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( "urEnqueueEventsWaitWithBarrier", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER, ¶ms); @@ -4813,7 +4813,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( "urEnqueueMemBufferRead", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ, ¶ms); @@ -4872,7 +4872,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( "urEnqueueMemBufferWrite", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE, ¶ms); @@ -4953,7 +4953,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( "urEnqueueMemBufferReadRect", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ_RECT, ¶ms); @@ -5037,7 +5037,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( "urEnqueueMemBufferWriteRect", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE_RECT, ¶ms); @@ -5093,7 +5093,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( "urEnqueueMemBufferCopy", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY, ¶ms); @@ -5163,7 +5163,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( "urEnqueueMemBufferCopyRect", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY_RECT, ¶ms); @@ -5224,7 +5224,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( "urEnqueueMemBufferFill", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_FILL, ¶ms); @@ -5286,7 +5286,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( "urEnqueueMemImageRead", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_IMAGE_READ, ¶ms); @@ -5349,7 +5349,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( "urEnqueueMemImageWrite", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_IMAGE_WRITE, ¶ms); @@ -5411,7 +5411,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( "urEnqueueMemImageCopy", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_IMAGE_COPY, ¶ms); @@ -5469,7 +5469,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferMap( "urEnqueueMemBufferMap", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_MAP, ¶ms); @@ -5520,7 +5520,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemUnmap( getContext()->notify_end(UR_FUNCTION_ENQUEUE_MEM_UNMAP, "urEnqueueMemUnmap", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_MEM_UNMAP, ¶ms); @@ -5577,7 +5577,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( getContext()->notify_end(UR_FUNCTION_ENQUEUE_USM_FILL, "urEnqueueUSMFill", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_FILL, ¶ms); @@ -5631,7 +5631,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( getContext()->notify_end(UR_FUNCTION_ENQUEUE_USM_MEMCPY, "urEnqueueUSMMemcpy", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_USM_MEMCPY, ¶ms); @@ -5684,7 +5684,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( "urEnqueueUSMPrefetch", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_USM_PREFETCH, ¶ms); @@ -5726,7 +5726,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMAdvise( getContext()->notify_end(UR_FUNCTION_ENQUEUE_USM_ADVISE, "urEnqueueUSMAdvise", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_USM_ADVISE, ¶ms); @@ -5787,7 +5787,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( getContext()->notify_end(UR_FUNCTION_ENQUEUE_USM_FILL_2D, "urEnqueueUSMFill2D", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_USM_FILL_2D, ¶ms); @@ -5849,7 +5849,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( "urEnqueueUSMMemcpy2D", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_USM_MEMCPY_2D, ¶ms); @@ -5909,7 +5909,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableWrite( "urEnqueueDeviceGlobalVariableWrite", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_WRITE, @@ -5970,7 +5970,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableRead( "urEnqueueDeviceGlobalVariableRead", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_READ, ¶ms); @@ -6033,7 +6033,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueReadHostPipe( "urEnqueueReadHostPipe", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_READ_HOST_PIPE, ¶ms); @@ -6097,7 +6097,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( "urEnqueueWriteHostPipe", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE, ¶ms); @@ -6149,7 +6149,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPitchedAllocExp( "urUSMPitchedAllocExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_USM_PITCHED_ALLOC_EXP, ¶ms); @@ -6194,7 +6194,7 @@ urBindlessImagesUnsampledImageHandleDestroyExp( "urBindlessImagesUnsampledImageHandleDestroyExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, @@ -6243,7 +6243,7 @@ urBindlessImagesSampledImageHandleDestroyExp( "urBindlessImagesSampledImageHandleDestroyExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, @@ -6291,7 +6291,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( "urBindlessImagesImageAllocateExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_ALLOCATE_EXP, ¶ms); @@ -6332,7 +6332,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageFreeExp( "urBindlessImagesImageFreeExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_FREE_EXP, ¶ms); @@ -6379,7 +6379,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP, "urBindlessImagesUnsampledImageCreateExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP, @@ -6431,7 +6431,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP, "urBindlessImagesSampledImageCreateExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP, @@ -6508,7 +6508,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp( "urBindlessImagesImageCopyExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_COPY_EXP, ¶ms); @@ -6552,7 +6552,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( "urBindlessImagesImageGetInfoExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_GET_INFO_EXP, ¶ms); @@ -6597,7 +6597,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp( "urBindlessImagesMipmapGetLevelExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_GET_LEVEL_EXP, @@ -6639,7 +6639,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( "urBindlessImagesMipmapFreeExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_FREE_EXP, ¶ms); @@ -6688,7 +6688,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportExternalMemoryExp( UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP, "urBindlessImagesImportExternalMemoryExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP, @@ -6738,7 +6738,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( "urBindlessImagesMapExternalArrayExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP, @@ -6786,7 +6786,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMapExternalLinearMemoryExp( "urBindlessImagesMapExternalLinearMemoryExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, @@ -6831,7 +6831,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalMemoryExp( UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP, "urBindlessImagesReleaseExternalMemoryExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP, @@ -6883,7 +6883,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportExternalSemaphoreExp( "urBindlessImagesImportExternalSemaphoreExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP, @@ -6929,7 +6929,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalSemaphoreExp( "urBindlessImagesReleaseExternalSemaphoreExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, @@ -6993,7 +6993,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesWaitExternalSemaphoreExp( UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP, "urBindlessImagesWaitExternalSemaphoreExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP, @@ -7058,7 +7058,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSignalExternalSemaphoreExp( "urBindlessImagesSignalExternalSemaphoreExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP, @@ -7103,7 +7103,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferCreateExp( "urCommandBufferCreateExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_CREATE_EXP, ¶ms); @@ -7140,7 +7140,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainExp( "urCommandBufferRetainExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_RETAIN_EXP, ¶ms); @@ -7178,7 +7178,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseExp( "urCommandBufferReleaseExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_RELEASE_EXP, ¶ms); @@ -7216,7 +7216,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferFinalizeExp( "urCommandBufferFinalizeExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP, ¶ms); @@ -7310,7 +7310,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP, "urCommandBufferAppendKernelLaunchExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP, @@ -7384,7 +7384,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( "urCommandBufferAppendUSMMemcpyExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP, @@ -7461,7 +7461,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( "urCommandBufferAppendUSMFillExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP, ¶ms); @@ -7538,7 +7538,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP, "urCommandBufferAppendMemBufferCopyExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP, @@ -7616,7 +7616,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP, "urCommandBufferAppendMemBufferWriteExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP, @@ -7693,7 +7693,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP, "urCommandBufferAppendMemBufferReadExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP, @@ -7785,7 +7785,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( "urCommandBufferAppendMemBufferCopyRectExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, @@ -7885,7 +7885,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( "urCommandBufferAppendMemBufferWriteRectExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, @@ -7982,7 +7982,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( "urCommandBufferAppendMemBufferReadRectExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, @@ -8063,7 +8063,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP, "urCommandBufferAppendMemBufferFillExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP, @@ -8138,7 +8138,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( "urCommandBufferAppendUSMPrefetchExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP, @@ -8212,7 +8212,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( "urCommandBufferAppendUSMAdviseExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP, @@ -8265,7 +8265,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( "urCommandBufferEnqueueExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP, ¶ms); @@ -8303,7 +8303,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainCommandExp( "urCommandBufferRetainCommandExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_RETAIN_COMMAND_EXP, ¶ms); @@ -8341,7 +8341,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseCommandExp( "urCommandBufferReleaseCommandExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_RELEASE_COMMAND_EXP, ¶ms); @@ -8383,7 +8383,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp( UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP, "urCommandBufferUpdateKernelLaunchExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP, @@ -8424,7 +8424,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateSignalEventExp( "urCommandBufferUpdateSignalEventExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_UPDATE_SIGNAL_EVENT_EXP, @@ -8470,7 +8470,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateWaitEventsExp( "urCommandBufferUpdateWaitEventsExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_UPDATE_WAIT_EVENTS_EXP, @@ -8520,7 +8520,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferGetInfoExp( "urCommandBufferGetInfoExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP, ¶ms); @@ -8569,7 +8569,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferCommandGetInfoExp( "urCommandBufferCommandGetInfoExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_COMMAND_GET_INFO_EXP, ¶ms); @@ -8642,7 +8642,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( "urEnqueueCooperativeKernelLaunchExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP, @@ -8691,7 +8691,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( "urKernelSuggestMaxCooperativeGroupCountExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, @@ -8752,7 +8752,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueTimestampRecordingExp( "urEnqueueTimestampRecordingExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP, ¶ms); @@ -8824,7 +8824,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp( "urEnqueueKernelLaunchCustomExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP, ¶ms); @@ -8864,7 +8864,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuildExp( getContext()->notify_end(UR_FUNCTION_PROGRAM_BUILD_EXP, "urProgramBuildExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_BUILD_EXP, ¶ms); @@ -8906,7 +8906,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCompileExp( getContext()->notify_end(UR_FUNCTION_PROGRAM_COMPILE_EXP, "urProgramCompileExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_COMPILE_EXP, ¶ms); @@ -8956,7 +8956,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramLinkExp( getContext()->notify_end(UR_FUNCTION_PROGRAM_LINK_EXP, "urProgramLinkExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_LINK_EXP, ¶ms); @@ -8992,7 +8992,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMImportExp( getContext()->notify_end(UR_FUNCTION_USM_IMPORT_EXP, "urUSMImportExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_IMPORT_EXP, ¶ms); @@ -9027,7 +9027,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMReleaseExp( getContext()->notify_end(UR_FUNCTION_USM_RELEASE_EXP, "urUSMReleaseExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_RELEASE_EXP, ¶ms); @@ -9067,7 +9067,7 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PEnablePeerAccessExp( "urUsmP2PEnablePeerAccessExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP, ¶ms); @@ -9107,7 +9107,7 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PDisablePeerAccessExp( "urUsmP2PDisablePeerAccessExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_USM_P2P_DISABLE_PEER_ACCESS_EXP, ¶ms); @@ -9161,7 +9161,7 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp( "urUsmP2PPeerAccessGetInfoExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP, ¶ms); @@ -9229,7 +9229,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueNativeCommandExp( "urEnqueueNativeCommandExp", ¶ms, &result, instance); - if (logger.getLevel() <= logger::Level::INFO) { + if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP, ¶ms);