From cbb193545ce3189ff8f68a2e76ebc41ce6e80048 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Fri, 20 Sep 2024 10:04:29 +0100 Subject: [PATCH 1/3] Merge pull request #2106 from winstonzhang-intel/URLZA-391 [L0] Fix urEnqueueDeviceGlobalVariableRead to use device specific modules --- source/adapters/level_zero/kernel.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/adapters/level_zero/kernel.cpp b/source/adapters/level_zero/kernel.cpp index e2514d251a..44079d1c3d 100644 --- a/source/adapters/level_zero/kernel.cpp +++ b/source/adapters/level_zero/kernel.cpp @@ -661,11 +661,19 @@ ur_result_t ur_queue_handle_legacy_t_::enqueueDeviceGlobalVariableRead( std::scoped_lock lock(Queue->Mutex); + ze_module_handle_t ZeModule{}; + auto It = Program->ZeModuleMap.find(Queue->Device->ZeDevice); + if (It != Program->ZeModuleMap.end()) { + ZeModule = It->second; + } else { + ZeModule = Program->ZeModule; + } + // Find global variable pointer size_t GlobalVarSize = 0; void *GlobalVarPtr = nullptr; ZE2UR_CALL(zeModuleGetGlobalPointer, - (Program->ZeModule, Name, &GlobalVarSize, &GlobalVarPtr)); + (ZeModule, Name, &GlobalVarSize, &GlobalVarPtr)); if (GlobalVarSize < Offset + Count) { setErrorMessage("Read from device global variable is out of range.", UR_RESULT_ERROR_INVALID_VALUE, From 222c266749901b8f76737a68b22a934e3db1d19d Mon Sep 17 00:00:00 2001 From: Omar Ahmed Date: Fri, 20 Sep 2024 14:56:40 +0100 Subject: [PATCH 2/3] Merge pull request #2108 from pbalcer/fix-perf-tracing-logs fix perf regression in tracing layer --- scripts/templates/trcddi.cpp.mako | 12 +- source/common/logger/ur_logger_details.hpp | 2 + source/loader/layers/tracing/ur_trcddi.cpp | 2678 +++++++++++++------- 3 files changed, 1732 insertions(+), 960 deletions(-) diff --git a/scripts/templates/trcddi.cpp.mako b/scripts/templates/trcddi.cpp.mako index 671179d3e2..45a2baad76 100644 --- a/scripts/templates/trcddi.cpp.mako +++ b/scripts/templates/trcddi.cpp.mako @@ -45,15 +45,19 @@ namespace ur_tracing_layer ${th.make_pfncb_param_type(n, tags, obj)} params = { &${",&".join(th.make_param_lines(n, tags, obj, format=["name"]))} }; uint64_t instance = getContext()->notify_begin(${th.make_func_etor(n, tags, obj)}, "${th.make_func_name(n, tags, obj)}", ¶ms); - getContext()->logger.info("---> ${th.make_func_name(n, tags, obj)}"); + auto &logger = getContext()->logger; + + logger.info("---> ${th.make_func_name(n, tags, obj)}"); ${x}_result_t result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} ); getContext()->notify_end(${th.make_func_etor(n, tags, obj)}, "${th.make_func_name(n, tags, obj)}", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, ${th.make_func_etor(n, tags, obj)}, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, ${th.make_func_etor(n, tags, obj)}, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } diff --git a/source/common/logger/ur_logger_details.hpp b/source/common/logger/ur_logger_details.hpp index f17d3b3f64..9c9462935e 100644 --- a/source/common/logger/ur_logger_details.hpp +++ b/source/common/logger/ur_logger_details.hpp @@ -30,6 +30,8 @@ class Logger { void setLevel(logger::Level level) { this->level = level; } + logger::Level getLevel() { return this->level; } + void setFlushLevel(logger::Level level) { if (sink) { this->sink->setFlushLevel(level); diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index a368ae7b1a..04716c3987 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -40,16 +40,21 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGet( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_ADAPTER_GET, "urAdapterGet", ¶ms); - getContext()->logger.info("---> urAdapterGet"); + auto &logger = getContext()->logger; + + logger.info("---> urAdapterGet"); ur_result_t result = pfnAdapterGet(NumEntries, phAdapters, pNumAdapters); getContext()->notify_end(UR_FUNCTION_ADAPTER_GET, "urAdapterGet", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_GET, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_GET, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -69,17 +74,21 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRelease( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_ADAPTER_RELEASE, "urAdapterRelease", ¶ms); - getContext()->logger.info("---> urAdapterRelease"); + auto &logger = getContext()->logger; + + logger.info("---> urAdapterRelease"); ur_result_t result = pfnAdapterRelease(hAdapter); getContext()->notify_end(UR_FUNCTION_ADAPTER_RELEASE, "urAdapterRelease", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_RELEASE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_RELEASE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -99,17 +108,21 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRetain( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_ADAPTER_RETAIN, "urAdapterRetain", ¶ms); - getContext()->logger.info("---> urAdapterRetain"); + auto &logger = getContext()->logger; + + logger.info("---> urAdapterRetain"); ur_result_t result = pfnAdapterRetain(hAdapter); getContext()->notify_end(UR_FUNCTION_ADAPTER_RETAIN, "urAdapterRetain", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_RETAIN, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_RETAIN, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -137,7 +150,9 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetLastError( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ADAPTER_GET_LAST_ERROR, "urAdapterGetLastError", ¶ms); - getContext()->logger.info("---> urAdapterGetLastError"); + auto &logger = getContext()->logger; + + logger.info("---> urAdapterGetLastError"); ur_result_t result = pfnAdapterGetLastError(hAdapter, ppMessage, pError); @@ -145,10 +160,12 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetLastError( "urAdapterGetLastError", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ADAPTER_GET_LAST_ERROR, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ADAPTER_GET_LAST_ERROR, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -179,7 +196,9 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetInfo( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_ADAPTER_GET_INFO, "urAdapterGetInfo", ¶ms); - getContext()->logger.info("---> urAdapterGetInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urAdapterGetInfo"); ur_result_t result = pfnAdapterGetInfo(hAdapter, propName, propSize, pPropValue, pPropSizeRet); @@ -187,10 +206,12 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetInfo( getContext()->notify_end(UR_FUNCTION_ADAPTER_GET_INFO, "urAdapterGetInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_GET_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_GET_INFO, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -224,7 +245,9 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGet( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_PLATFORM_GET, "urPlatformGet", ¶ms); - getContext()->logger.info("---> urPlatformGet"); + auto &logger = getContext()->logger; + + logger.info("---> urPlatformGet"); ur_result_t result = pfnGet(phAdapters, NumAdapters, NumEntries, phPlatforms, pNumPlatforms); @@ -232,10 +255,12 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGet( getContext()->notify_end(UR_FUNCTION_PLATFORM_GET, "urPlatformGet", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_PLATFORM_GET, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_PLATFORM_GET, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -266,7 +291,9 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetInfo( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_PLATFORM_GET_INFO, "urPlatformGetInfo", ¶ms); - getContext()->logger.info("---> urPlatformGetInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urPlatformGetInfo"); ur_result_t result = pfnGetInfo(hPlatform, propName, propSize, pPropValue, pPropSizeRet); @@ -274,10 +301,12 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetInfo( getContext()->notify_end(UR_FUNCTION_PLATFORM_GET_INFO, "urPlatformGetInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_PLATFORM_GET_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_PLATFORM_GET_INFO, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -299,7 +328,9 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetApiVersion( getContext()->notify_begin(UR_FUNCTION_PLATFORM_GET_API_VERSION, "urPlatformGetApiVersion", ¶ms); - getContext()->logger.info("---> urPlatformGetApiVersion"); + auto &logger = getContext()->logger; + + logger.info("---> urPlatformGetApiVersion"); ur_result_t result = pfnGetApiVersion(hPlatform, pVersion); @@ -307,10 +338,12 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetApiVersion( "urPlatformGetApiVersion", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_PLATFORM_GET_API_VERSION, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PLATFORM_GET_API_VERSION, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -335,7 +368,9 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetNativeHandle( getContext()->notify_begin(UR_FUNCTION_PLATFORM_GET_NATIVE_HANDLE, "urPlatformGetNativeHandle", ¶ms); - getContext()->logger.info("---> urPlatformGetNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urPlatformGetNativeHandle"); ur_result_t result = pfnGetNativeHandle(hPlatform, phNativePlatform); @@ -343,10 +378,12 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetNativeHandle( "urPlatformGetNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_PLATFORM_GET_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PLATFORM_GET_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -376,7 +413,9 @@ __urdlllocal ur_result_t UR_APICALL urPlatformCreateWithNativeHandle( UR_FUNCTION_PLATFORM_CREATE_WITH_NATIVE_HANDLE, "urPlatformCreateWithNativeHandle", ¶ms); - getContext()->logger.info("---> urPlatformCreateWithNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urPlatformCreateWithNativeHandle"); ur_result_t result = pfnCreateWithNativeHandle(hNativePlatform, hAdapter, pProperties, phPlatform); @@ -385,10 +424,12 @@ __urdlllocal ur_result_t UR_APICALL urPlatformCreateWithNativeHandle( "urPlatformCreateWithNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_PLATFORM_CREATE_WITH_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PLATFORM_CREATE_WITH_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -416,7 +457,9 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetBackendOption( getContext()->notify_begin(UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION, "urPlatformGetBackendOption", ¶ms); - getContext()->logger.info("---> urPlatformGetBackendOption"); + auto &logger = getContext()->logger; + + logger.info("---> urPlatformGetBackendOption"); ur_result_t result = pfnGetBackendOption(hPlatform, pFrontendOption, ppPlatformOption); @@ -425,10 +468,12 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetBackendOption( "urPlatformGetBackendOption", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -461,7 +506,9 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGet( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_DEVICE_GET, "urDeviceGet", ¶ms); - getContext()->logger.info("---> urDeviceGet"); + auto &logger = getContext()->logger; + + logger.info("---> urDeviceGet"); ur_result_t result = pfnGet(hPlatform, DeviceType, NumEntries, phDevices, pNumDevices); @@ -469,9 +516,12 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGet( getContext()->notify_end(UR_FUNCTION_DEVICE_GET, "urDeviceGet", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_GET, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_GET, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -503,7 +553,9 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetInfo( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_DEVICE_GET_INFO, "urDeviceGetInfo", ¶ms); - getContext()->logger.info("---> urDeviceGetInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urDeviceGetInfo"); ur_result_t result = pfnGetInfo(hDevice, propName, propSize, pPropValue, pPropSizeRet); @@ -511,10 +563,12 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetInfo( getContext()->notify_end(UR_FUNCTION_DEVICE_GET_INFO, "urDeviceGetInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_GET_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_GET_INFO, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -535,17 +589,21 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRetain( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_DEVICE_RETAIN, "urDeviceRetain", ¶ms); - getContext()->logger.info("---> urDeviceRetain"); + auto &logger = getContext()->logger; + + logger.info("---> urDeviceRetain"); ur_result_t result = pfnRetain(hDevice); getContext()->notify_end(UR_FUNCTION_DEVICE_RETAIN, "urDeviceRetain", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_RETAIN, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_RETAIN, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -566,17 +624,21 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRelease( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_DEVICE_RELEASE, "urDeviceRelease", ¶ms); - getContext()->logger.info("---> urDeviceRelease"); + auto &logger = getContext()->logger; + + logger.info("---> urDeviceRelease"); ur_result_t result = pfnRelease(hDevice); getContext()->notify_end(UR_FUNCTION_DEVICE_RELEASE, "urDeviceRelease", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_RELEASE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_RELEASE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -607,7 +669,9 @@ __urdlllocal ur_result_t UR_APICALL urDevicePartition( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_DEVICE_PARTITION, "urDevicePartition", ¶ms); - getContext()->logger.info("---> urDevicePartition"); + auto &logger = getContext()->logger; + + logger.info("---> urDevicePartition"); ur_result_t result = pfnPartition(hDevice, pProperties, NumDevices, phSubDevices, pNumDevicesRet); @@ -615,10 +679,12 @@ __urdlllocal ur_result_t UR_APICALL urDevicePartition( getContext()->notify_end(UR_FUNCTION_DEVICE_PARTITION, "urDevicePartition", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_PARTITION, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_PARTITION, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -648,7 +714,9 @@ __urdlllocal ur_result_t UR_APICALL urDeviceSelectBinary( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_DEVICE_SELECT_BINARY, "urDeviceSelectBinary", ¶ms); - getContext()->logger.info("---> urDeviceSelectBinary"); + auto &logger = getContext()->logger; + + logger.info("---> urDeviceSelectBinary"); ur_result_t result = pfnSelectBinary(hDevice, pBinaries, NumBinaries, pSelectedBinary); @@ -657,10 +725,12 @@ __urdlllocal ur_result_t UR_APICALL urDeviceSelectBinary( "urDeviceSelectBinary", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_SELECT_BINARY, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_DEVICE_SELECT_BINARY, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -684,7 +754,9 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetNativeHandle( getContext()->notify_begin(UR_FUNCTION_DEVICE_GET_NATIVE_HANDLE, "urDeviceGetNativeHandle", ¶ms); - getContext()->logger.info("---> urDeviceGetNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urDeviceGetNativeHandle"); ur_result_t result = pfnGetNativeHandle(hDevice, phNativeDevice); @@ -692,10 +764,12 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetNativeHandle( "urDeviceGetNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_DEVICE_GET_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_DEVICE_GET_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -725,7 +799,9 @@ __urdlllocal ur_result_t UR_APICALL urDeviceCreateWithNativeHandle( getContext()->notify_begin(UR_FUNCTION_DEVICE_CREATE_WITH_NATIVE_HANDLE, "urDeviceCreateWithNativeHandle", ¶ms); - getContext()->logger.info("---> urDeviceCreateWithNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urDeviceCreateWithNativeHandle"); ur_result_t result = pfnCreateWithNativeHandle(hNativeDevice, hAdapter, pProperties, phDevice); @@ -734,10 +810,12 @@ __urdlllocal ur_result_t UR_APICALL urDeviceCreateWithNativeHandle( "urDeviceCreateWithNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_DEVICE_CREATE_WITH_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_DEVICE_CREATE_WITH_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -766,7 +844,9 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetGlobalTimestamps( getContext()->notify_begin(UR_FUNCTION_DEVICE_GET_GLOBAL_TIMESTAMPS, "urDeviceGetGlobalTimestamps", ¶ms); - getContext()->logger.info("---> urDeviceGetGlobalTimestamps"); + auto &logger = getContext()->logger; + + logger.info("---> urDeviceGetGlobalTimestamps"); ur_result_t result = pfnGetGlobalTimestamps(hDevice, pDeviceTimestamp, pHostTimestamp); @@ -775,10 +855,12 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetGlobalTimestamps( "urDeviceGetGlobalTimestamps", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_DEVICE_GET_GLOBAL_TIMESTAMPS, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_DEVICE_GET_GLOBAL_TIMESTAMPS, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -805,7 +887,9 @@ __urdlllocal ur_result_t UR_APICALL urContextCreate( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_CONTEXT_CREATE, "urContextCreate", ¶ms); - getContext()->logger.info("---> urContextCreate"); + auto &logger = getContext()->logger; + + logger.info("---> urContextCreate"); ur_result_t result = pfnCreate(DeviceCount, phDevices, pProperties, phContext); @@ -813,10 +897,12 @@ __urdlllocal ur_result_t UR_APICALL urContextCreate( getContext()->notify_end(UR_FUNCTION_CONTEXT_CREATE, "urContextCreate", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_CREATE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_CREATE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -837,17 +923,21 @@ __urdlllocal ur_result_t UR_APICALL urContextRetain( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_CONTEXT_RETAIN, "urContextRetain", ¶ms); - getContext()->logger.info("---> urContextRetain"); + auto &logger = getContext()->logger; + + logger.info("---> urContextRetain"); ur_result_t result = pfnRetain(hContext); getContext()->notify_end(UR_FUNCTION_CONTEXT_RETAIN, "urContextRetain", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_RETAIN, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_RETAIN, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -868,17 +958,21 @@ __urdlllocal ur_result_t UR_APICALL urContextRelease( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_CONTEXT_RELEASE, "urContextRelease", ¶ms); - getContext()->logger.info("---> urContextRelease"); + auto &logger = getContext()->logger; + + logger.info("---> urContextRelease"); ur_result_t result = pfnRelease(hContext); getContext()->notify_end(UR_FUNCTION_CONTEXT_RELEASE, "urContextRelease", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_RELEASE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_RELEASE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -911,7 +1005,9 @@ __urdlllocal ur_result_t UR_APICALL urContextGetInfo( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_CONTEXT_GET_INFO, "urContextGetInfo", ¶ms); - getContext()->logger.info("---> urContextGetInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urContextGetInfo"); ur_result_t result = pfnGetInfo(hContext, propName, propSize, pPropValue, pPropSizeRet); @@ -919,10 +1015,12 @@ __urdlllocal ur_result_t UR_APICALL urContextGetInfo( getContext()->notify_end(UR_FUNCTION_CONTEXT_GET_INFO, "urContextGetInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_GET_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_GET_INFO, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -947,7 +1045,9 @@ __urdlllocal ur_result_t UR_APICALL urContextGetNativeHandle( getContext()->notify_begin(UR_FUNCTION_CONTEXT_GET_NATIVE_HANDLE, "urContextGetNativeHandle", ¶ms); - getContext()->logger.info("---> urContextGetNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urContextGetNativeHandle"); ur_result_t result = pfnGetNativeHandle(hContext, phNativeContext); @@ -955,10 +1055,12 @@ __urdlllocal ur_result_t UR_APICALL urContextGetNativeHandle( "urContextGetNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_CONTEXT_GET_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_CONTEXT_GET_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -993,7 +1095,9 @@ __urdlllocal ur_result_t UR_APICALL urContextCreateWithNativeHandle( UR_FUNCTION_CONTEXT_CREATE_WITH_NATIVE_HANDLE, "urContextCreateWithNativeHandle", ¶ms); - getContext()->logger.info("---> urContextCreateWithNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urContextCreateWithNativeHandle"); ur_result_t result = pfnCreateWithNativeHandle(hNativeContext, hAdapter, numDevices, @@ -1003,10 +1107,12 @@ __urdlllocal ur_result_t UR_APICALL urContextCreateWithNativeHandle( "urContextCreateWithNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_CONTEXT_CREATE_WITH_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_CONTEXT_CREATE_WITH_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1033,7 +1139,9 @@ __urdlllocal ur_result_t UR_APICALL urContextSetExtendedDeleter( getContext()->notify_begin(UR_FUNCTION_CONTEXT_SET_EXTENDED_DELETER, "urContextSetExtendedDeleter", ¶ms); - getContext()->logger.info("---> urContextSetExtendedDeleter"); + auto &logger = getContext()->logger; + + logger.info("---> urContextSetExtendedDeleter"); ur_result_t result = pfnSetExtendedDeleter(hContext, pfnDeleter, pUserData); @@ -1041,10 +1149,12 @@ __urdlllocal ur_result_t UR_APICALL urContextSetExtendedDeleter( "urContextSetExtendedDeleter", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_CONTEXT_SET_EXTENDED_DELETER, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_CONTEXT_SET_EXTENDED_DELETER, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1071,7 +1181,9 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreate( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_MEM_IMAGE_CREATE, "urMemImageCreate", ¶ms); - getContext()->logger.info("---> urMemImageCreate"); + auto &logger = getContext()->logger; + + logger.info("---> urMemImageCreate"); ur_result_t result = pfnImageCreate(hContext, flags, pImageFormat, pImageDesc, pHost, phMem); @@ -1079,10 +1191,12 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreate( getContext()->notify_end(UR_FUNCTION_MEM_IMAGE_CREATE, "urMemImageCreate", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_IMAGE_CREATE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_IMAGE_CREATE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1109,7 +1223,9 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreate( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_MEM_BUFFER_CREATE, "urMemBufferCreate", ¶ms); - getContext()->logger.info("---> urMemBufferCreate"); + auto &logger = getContext()->logger; + + logger.info("---> urMemBufferCreate"); ur_result_t result = pfnBufferCreate(hContext, flags, size, pProperties, phBuffer); @@ -1117,10 +1233,12 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreate( getContext()->notify_end(UR_FUNCTION_MEM_BUFFER_CREATE, "urMemBufferCreate", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_BUFFER_CREATE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_BUFFER_CREATE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1141,16 +1259,21 @@ __urdlllocal ur_result_t UR_APICALL urMemRetain( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_MEM_RETAIN, "urMemRetain", ¶ms); - getContext()->logger.info("---> urMemRetain"); + auto &logger = getContext()->logger; + + logger.info("---> urMemRetain"); ur_result_t result = pfnRetain(hMem); getContext()->notify_end(UR_FUNCTION_MEM_RETAIN, "urMemRetain", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_RETAIN, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_RETAIN, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1171,16 +1294,21 @@ __urdlllocal ur_result_t UR_APICALL urMemRelease( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_MEM_RELEASE, "urMemRelease", ¶ms); - getContext()->logger.info("---> urMemRelease"); + auto &logger = getContext()->logger; + + logger.info("---> urMemRelease"); ur_result_t result = pfnRelease(hMem); getContext()->notify_end(UR_FUNCTION_MEM_RELEASE, "urMemRelease", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_RELEASE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_RELEASE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1208,7 +1336,9 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferPartition( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_MEM_BUFFER_PARTITION, "urMemBufferPartition", ¶ms); - getContext()->logger.info("---> urMemBufferPartition"); + auto &logger = getContext()->logger; + + logger.info("---> urMemBufferPartition"); ur_result_t result = pfnBufferPartition(hBuffer, flags, bufferCreateType, pRegion, phMem); @@ -1217,10 +1347,12 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferPartition( "urMemBufferPartition", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_BUFFER_PARTITION, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_MEM_BUFFER_PARTITION, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1245,7 +1377,9 @@ __urdlllocal ur_result_t UR_APICALL urMemGetNativeHandle( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_MEM_GET_NATIVE_HANDLE, "urMemGetNativeHandle", ¶ms); - getContext()->logger.info("---> urMemGetNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urMemGetNativeHandle"); ur_result_t result = pfnGetNativeHandle(hMem, hDevice, phNativeMem); @@ -1253,10 +1387,12 @@ __urdlllocal ur_result_t UR_APICALL urMemGetNativeHandle( "urMemGetNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_GET_NATIVE_HANDLE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_MEM_GET_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1285,7 +1421,9 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreateWithNativeHandle( UR_FUNCTION_MEM_BUFFER_CREATE_WITH_NATIVE_HANDLE, "urMemBufferCreateWithNativeHandle", ¶ms); - getContext()->logger.info("---> urMemBufferCreateWithNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urMemBufferCreateWithNativeHandle"); ur_result_t result = pfnBufferCreateWithNativeHandle(hNativeMem, hContext, pProperties, phMem); @@ -1294,10 +1432,13 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreateWithNativeHandle( "urMemBufferCreateWithNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_MEM_BUFFER_CREATE_WITH_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_MEM_BUFFER_CREATE_WITH_NATIVE_HANDLE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1330,7 +1471,9 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreateWithNativeHandle( UR_FUNCTION_MEM_IMAGE_CREATE_WITH_NATIVE_HANDLE, "urMemImageCreateWithNativeHandle", ¶ms); - getContext()->logger.info("---> urMemImageCreateWithNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urMemImageCreateWithNativeHandle"); ur_result_t result = pfnImageCreateWithNativeHandle( hNativeMem, hContext, pImageFormat, pImageDesc, pProperties, phMem); @@ -1339,10 +1482,12 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreateWithNativeHandle( "urMemImageCreateWithNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_MEM_IMAGE_CREATE_WITH_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_MEM_IMAGE_CREATE_WITH_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1375,7 +1520,9 @@ __urdlllocal ur_result_t UR_APICALL urMemGetInfo( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_MEM_GET_INFO, "urMemGetInfo", ¶ms); - getContext()->logger.info("---> urMemGetInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urMemGetInfo"); ur_result_t result = pfnGetInfo(hMemory, propName, propSize, pPropValue, pPropSizeRet); @@ -1383,10 +1530,12 @@ __urdlllocal ur_result_t UR_APICALL urMemGetInfo( getContext()->notify_end(UR_FUNCTION_MEM_GET_INFO, "urMemGetInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_GET_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_GET_INFO, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1418,7 +1567,9 @@ __urdlllocal ur_result_t UR_APICALL urMemImageGetInfo( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_MEM_IMAGE_GET_INFO, "urMemImageGetInfo", ¶ms); - getContext()->logger.info("---> urMemImageGetInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urMemImageGetInfo"); ur_result_t result = pfnImageGetInfo(hMemory, propName, propSize, pPropValue, pPropSizeRet); @@ -1426,10 +1577,12 @@ __urdlllocal ur_result_t UR_APICALL urMemImageGetInfo( getContext()->notify_end(UR_FUNCTION_MEM_IMAGE_GET_INFO, "urMemImageGetInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_IMAGE_GET_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_MEM_IMAGE_GET_INFO, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1452,17 +1605,21 @@ __urdlllocal ur_result_t UR_APICALL urSamplerCreate( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_SAMPLER_CREATE, "urSamplerCreate", ¶ms); - getContext()->logger.info("---> urSamplerCreate"); + auto &logger = getContext()->logger; + + logger.info("---> urSamplerCreate"); ur_result_t result = pfnCreate(hContext, pDesc, phSampler); getContext()->notify_end(UR_FUNCTION_SAMPLER_CREATE, "urSamplerCreate", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_CREATE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_CREATE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1483,17 +1640,21 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRetain( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_SAMPLER_RETAIN, "urSamplerRetain", ¶ms); - getContext()->logger.info("---> urSamplerRetain"); + auto &logger = getContext()->logger; + + logger.info("---> urSamplerRetain"); ur_result_t result = pfnRetain(hSampler); getContext()->notify_end(UR_FUNCTION_SAMPLER_RETAIN, "urSamplerRetain", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_RETAIN, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_RETAIN, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1514,17 +1675,21 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRelease( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_SAMPLER_RELEASE, "urSamplerRelease", ¶ms); - getContext()->logger.info("---> urSamplerRelease"); + auto &logger = getContext()->logger; + + logger.info("---> urSamplerRelease"); ur_result_t result = pfnRelease(hSampler); getContext()->notify_end(UR_FUNCTION_SAMPLER_RELEASE, "urSamplerRelease", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_RELEASE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_RELEASE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1553,7 +1718,9 @@ __urdlllocal ur_result_t UR_APICALL urSamplerGetInfo( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_SAMPLER_GET_INFO, "urSamplerGetInfo", ¶ms); - getContext()->logger.info("---> urSamplerGetInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urSamplerGetInfo"); ur_result_t result = pfnGetInfo(hSampler, propName, propSize, pPropValue, pPropSizeRet); @@ -1561,10 +1728,12 @@ __urdlllocal ur_result_t UR_APICALL urSamplerGetInfo( getContext()->notify_end(UR_FUNCTION_SAMPLER_GET_INFO, "urSamplerGetInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_GET_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_GET_INFO, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1589,7 +1758,9 @@ __urdlllocal ur_result_t UR_APICALL urSamplerGetNativeHandle( getContext()->notify_begin(UR_FUNCTION_SAMPLER_GET_NATIVE_HANDLE, "urSamplerGetNativeHandle", ¶ms); - getContext()->logger.info("---> urSamplerGetNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urSamplerGetNativeHandle"); ur_result_t result = pfnGetNativeHandle(hSampler, phNativeSampler); @@ -1597,10 +1768,12 @@ __urdlllocal ur_result_t UR_APICALL urSamplerGetNativeHandle( "urSamplerGetNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_SAMPLER_GET_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_SAMPLER_GET_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1629,7 +1802,9 @@ __urdlllocal ur_result_t UR_APICALL urSamplerCreateWithNativeHandle( UR_FUNCTION_SAMPLER_CREATE_WITH_NATIVE_HANDLE, "urSamplerCreateWithNativeHandle", ¶ms); - getContext()->logger.info("---> urSamplerCreateWithNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urSamplerCreateWithNativeHandle"); ur_result_t result = pfnCreateWithNativeHandle(hNativeSampler, hContext, pProperties, phSampler); @@ -1638,10 +1813,12 @@ __urdlllocal ur_result_t UR_APICALL urSamplerCreateWithNativeHandle( "urSamplerCreateWithNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_SAMPLER_CREATE_WITH_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_SAMPLER_CREATE_WITH_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1669,17 +1846,21 @@ __urdlllocal ur_result_t UR_APICALL urUSMHostAlloc( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_USM_HOST_ALLOC, "urUSMHostAlloc", ¶ms); - getContext()->logger.info("---> urUSMHostAlloc"); + auto &logger = getContext()->logger; + + logger.info("---> urUSMHostAlloc"); ur_result_t result = pfnHostAlloc(hContext, pUSMDesc, pool, size, ppMem); getContext()->notify_end(UR_FUNCTION_USM_HOST_ALLOC, "urUSMHostAlloc", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_HOST_ALLOC, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_HOST_ALLOC, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1708,7 +1889,9 @@ __urdlllocal ur_result_t UR_APICALL urUSMDeviceAlloc( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_USM_DEVICE_ALLOC, "urUSMDeviceAlloc", ¶ms); - getContext()->logger.info("---> urUSMDeviceAlloc"); + auto &logger = getContext()->logger; + + logger.info("---> urUSMDeviceAlloc"); ur_result_t result = pfnDeviceAlloc(hContext, hDevice, pUSMDesc, pool, size, ppMem); @@ -1716,10 +1899,12 @@ __urdlllocal ur_result_t UR_APICALL urUSMDeviceAlloc( getContext()->notify_end(UR_FUNCTION_USM_DEVICE_ALLOC, "urUSMDeviceAlloc", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_DEVICE_ALLOC, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_DEVICE_ALLOC, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1748,7 +1933,9 @@ __urdlllocal ur_result_t UR_APICALL urUSMSharedAlloc( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_USM_SHARED_ALLOC, "urUSMSharedAlloc", ¶ms); - getContext()->logger.info("---> urUSMSharedAlloc"); + auto &logger = getContext()->logger; + + logger.info("---> urUSMSharedAlloc"); ur_result_t result = pfnSharedAlloc(hContext, hDevice, pUSMDesc, pool, size, ppMem); @@ -1756,10 +1943,12 @@ __urdlllocal ur_result_t UR_APICALL urUSMSharedAlloc( getContext()->notify_end(UR_FUNCTION_USM_SHARED_ALLOC, "urUSMSharedAlloc", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_SHARED_ALLOC, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_SHARED_ALLOC, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1780,16 +1969,21 @@ __urdlllocal ur_result_t UR_APICALL urUSMFree( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_USM_FREE, "urUSMFree", ¶ms); - getContext()->logger.info("---> urUSMFree"); + auto &logger = getContext()->logger; + + logger.info("---> urUSMFree"); ur_result_t result = pfnFree(hContext, pMem); getContext()->notify_end(UR_FUNCTION_USM_FREE, "urUSMFree", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_FREE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_FREE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1820,7 +2014,9 @@ __urdlllocal ur_result_t UR_APICALL urUSMGetMemAllocInfo( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_USM_GET_MEM_ALLOC_INFO, "urUSMGetMemAllocInfo", ¶ms); - getContext()->logger.info("---> urUSMGetMemAllocInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urUSMGetMemAllocInfo"); ur_result_t result = pfnGetMemAllocInfo(hContext, pMem, propName, propSize, pPropValue, pPropSizeRet); @@ -1829,10 +2025,12 @@ __urdlllocal ur_result_t UR_APICALL urUSMGetMemAllocInfo( "urUSMGetMemAllocInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_USM_GET_MEM_ALLOC_INFO, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_USM_GET_MEM_ALLOC_INFO, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1856,17 +2054,21 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolCreate( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_USM_POOL_CREATE, "urUSMPoolCreate", ¶ms); - getContext()->logger.info("---> urUSMPoolCreate"); + auto &logger = getContext()->logger; + + logger.info("---> urUSMPoolCreate"); ur_result_t result = pfnPoolCreate(hContext, pPoolDesc, ppPool); getContext()->notify_end(UR_FUNCTION_USM_POOL_CREATE, "urUSMPoolCreate", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_CREATE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_CREATE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1886,17 +2088,21 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRetain( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_USM_POOL_RETAIN, "urUSMPoolRetain", ¶ms); - getContext()->logger.info("---> urUSMPoolRetain"); + auto &logger = getContext()->logger; + + logger.info("---> urUSMPoolRetain"); ur_result_t result = pfnPoolRetain(pPool); getContext()->notify_end(UR_FUNCTION_USM_POOL_RETAIN, "urUSMPoolRetain", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_RETAIN, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_RETAIN, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1916,17 +2122,21 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRelease( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_USM_POOL_RELEASE, "urUSMPoolRelease", ¶ms); - getContext()->logger.info("---> urUSMPoolRelease"); + auto &logger = getContext()->logger; + + logger.info("---> urUSMPoolRelease"); ur_result_t result = pfnPoolRelease(pPool); getContext()->notify_end(UR_FUNCTION_USM_POOL_RELEASE, "urUSMPoolRelease", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_RELEASE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_RELEASE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -1954,7 +2164,9 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetInfo( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_USM_POOL_GET_INFO, "urUSMPoolGetInfo", ¶ms); - getContext()->logger.info("---> urUSMPoolGetInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urUSMPoolGetInfo"); ur_result_t result = pfnPoolGetInfo(hPool, propName, propSize, pPropValue, pPropSizeRet); @@ -1962,10 +2174,12 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetInfo( getContext()->notify_end(UR_FUNCTION_USM_POOL_GET_INFO, "urUSMPoolGetInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_GET_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_GET_INFO, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2002,7 +2216,9 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemGranularityGetInfo( getContext()->notify_begin(UR_FUNCTION_VIRTUAL_MEM_GRANULARITY_GET_INFO, "urVirtualMemGranularityGetInfo", ¶ms); - getContext()->logger.info("---> urVirtualMemGranularityGetInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urVirtualMemGranularityGetInfo"); ur_result_t result = pfnGranularityGetInfo( hContext, hDevice, propName, propSize, pPropValue, pPropSizeRet); @@ -2011,10 +2227,12 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemGranularityGetInfo( "urVirtualMemGranularityGetInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_VIRTUAL_MEM_GRANULARITY_GET_INFO, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_VIRTUAL_MEM_GRANULARITY_GET_INFO, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2044,17 +2262,21 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemReserve( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_VIRTUAL_MEM_RESERVE, "urVirtualMemReserve", ¶ms); - getContext()->logger.info("---> urVirtualMemReserve"); + auto &logger = getContext()->logger; + + logger.info("---> urVirtualMemReserve"); ur_result_t result = pfnReserve(hContext, pStart, size, ppStart); getContext()->notify_end(UR_FUNCTION_VIRTUAL_MEM_RESERVE, "urVirtualMemReserve", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_RESERVE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_VIRTUAL_MEM_RESERVE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2077,17 +2299,21 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemFree( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_VIRTUAL_MEM_FREE, "urVirtualMemFree", ¶ms); - getContext()->logger.info("---> urVirtualMemFree"); + auto &logger = getContext()->logger; + + logger.info("---> urVirtualMemFree"); ur_result_t result = pfnFree(hContext, pStart, size); getContext()->notify_end(UR_FUNCTION_VIRTUAL_MEM_FREE, "urVirtualMemFree", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_FREE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_FREE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2117,7 +2343,9 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemMap( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_VIRTUAL_MEM_MAP, "urVirtualMemMap", ¶ms); - getContext()->logger.info("---> urVirtualMemMap"); + auto &logger = getContext()->logger; + + logger.info("---> urVirtualMemMap"); ur_result_t result = pfnMap(hContext, pStart, size, hPhysicalMem, offset, flags); @@ -2125,10 +2353,12 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemMap( getContext()->notify_end(UR_FUNCTION_VIRTUAL_MEM_MAP, "urVirtualMemMap", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_MAP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_MAP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2151,17 +2381,21 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemUnmap( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_VIRTUAL_MEM_UNMAP, "urVirtualMemUnmap", ¶ms); - getContext()->logger.info("---> urVirtualMemUnmap"); + auto &logger = getContext()->logger; + + logger.info("---> urVirtualMemUnmap"); ur_result_t result = pfnUnmap(hContext, pStart, size); getContext()->notify_end(UR_FUNCTION_VIRTUAL_MEM_UNMAP, "urVirtualMemUnmap", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_UNMAP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_UNMAP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2187,7 +2421,9 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemSetAccess( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_VIRTUAL_MEM_SET_ACCESS, "urVirtualMemSetAccess", ¶ms); - getContext()->logger.info("---> urVirtualMemSetAccess"); + auto &logger = getContext()->logger; + + logger.info("---> urVirtualMemSetAccess"); ur_result_t result = pfnSetAccess(hContext, pStart, size, flags); @@ -2195,10 +2431,12 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemSetAccess( "urVirtualMemSetAccess", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_VIRTUAL_MEM_SET_ACCESS, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_VIRTUAL_MEM_SET_ACCESS, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2233,7 +2471,9 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemGetInfo( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_VIRTUAL_MEM_GET_INFO, "urVirtualMemGetInfo", ¶ms); - getContext()->logger.info("---> urVirtualMemGetInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urVirtualMemGetInfo"); ur_result_t result = pfnGetInfo(hContext, pStart, size, propName, propSize, pPropValue, pPropSizeRet); @@ -2241,10 +2481,12 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemGetInfo( getContext()->notify_end(UR_FUNCTION_VIRTUAL_MEM_GET_INFO, "urVirtualMemGetInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_GET_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_VIRTUAL_MEM_GET_INFO, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2273,7 +2515,9 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemCreate( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_PHYSICAL_MEM_CREATE, "urPhysicalMemCreate", ¶ms); - getContext()->logger.info("---> urPhysicalMemCreate"); + auto &logger = getContext()->logger; + + logger.info("---> urPhysicalMemCreate"); ur_result_t result = pfnCreate(hContext, hDevice, size, pProperties, phPhysicalMem); @@ -2281,10 +2525,12 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemCreate( getContext()->notify_end(UR_FUNCTION_PHYSICAL_MEM_CREATE, "urPhysicalMemCreate", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_PHYSICAL_MEM_CREATE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PHYSICAL_MEM_CREATE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2305,17 +2551,21 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRetain( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_PHYSICAL_MEM_RETAIN, "urPhysicalMemRetain", ¶ms); - getContext()->logger.info("---> urPhysicalMemRetain"); + auto &logger = getContext()->logger; + + logger.info("---> urPhysicalMemRetain"); ur_result_t result = pfnRetain(hPhysicalMem); getContext()->notify_end(UR_FUNCTION_PHYSICAL_MEM_RETAIN, "urPhysicalMemRetain", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_PHYSICAL_MEM_RETAIN, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PHYSICAL_MEM_RETAIN, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2336,7 +2586,9 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRelease( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_PHYSICAL_MEM_RELEASE, "urPhysicalMemRelease", ¶ms); - getContext()->logger.info("---> urPhysicalMemRelease"); + auto &logger = getContext()->logger; + + logger.info("---> urPhysicalMemRelease"); ur_result_t result = pfnRelease(hPhysicalMem); @@ -2344,10 +2596,12 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRelease( "urPhysicalMemRelease", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_PHYSICAL_MEM_RELEASE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PHYSICAL_MEM_RELEASE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2374,7 +2628,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_PROGRAM_CREATE_WITH_IL, "urProgramCreateWithIL", ¶ms); - getContext()->logger.info("---> urProgramCreateWithIL"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramCreateWithIL"); ur_result_t result = pfnCreateWithIL(hContext, pIL, length, pProperties, phProgram); @@ -2383,10 +2639,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL( "urProgramCreateWithIL", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_PROGRAM_CREATE_WITH_IL, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PROGRAM_CREATE_WITH_IL, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2417,7 +2675,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary( getContext()->notify_begin(UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY, "urProgramCreateWithBinary", ¶ms); - getContext()->logger.info("---> urProgramCreateWithBinary"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramCreateWithBinary"); ur_result_t result = pfnCreateWithBinary(hContext, hDevice, size, pBinary, pProperties, phProgram); @@ -2426,10 +2686,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary( "urProgramCreateWithBinary", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2452,17 +2714,21 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuild( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_PROGRAM_BUILD, "urProgramBuild", ¶ms); - getContext()->logger.info("---> urProgramBuild"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramBuild"); ur_result_t result = pfnBuild(hContext, hProgram, pOptions); getContext()->notify_end(UR_FUNCTION_PROGRAM_BUILD, "urProgramBuild", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_BUILD, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_BUILD, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2486,17 +2752,21 @@ __urdlllocal ur_result_t UR_APICALL urProgramCompile( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_PROGRAM_COMPILE, "urProgramCompile", ¶ms); - getContext()->logger.info("---> urProgramCompile"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramCompile"); ur_result_t result = pfnCompile(hContext, hProgram, pOptions); getContext()->notify_end(UR_FUNCTION_PROGRAM_COMPILE, "urProgramCompile", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_COMPILE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_COMPILE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2527,7 +2797,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramLink( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_PROGRAM_LINK, "urProgramLink", ¶ms); - getContext()->logger.info("---> urProgramLink"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramLink"); ur_result_t result = pfnLink(hContext, count, phPrograms, pOptions, phProgram); @@ -2535,10 +2807,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramLink( getContext()->notify_end(UR_FUNCTION_PROGRAM_LINK, "urProgramLink", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_LINK, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_LINK, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2559,17 +2833,21 @@ __urdlllocal ur_result_t UR_APICALL urProgramRetain( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_PROGRAM_RETAIN, "urProgramRetain", ¶ms); - getContext()->logger.info("---> urProgramRetain"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramRetain"); ur_result_t result = pfnRetain(hProgram); getContext()->notify_end(UR_FUNCTION_PROGRAM_RETAIN, "urProgramRetain", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_RETAIN, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_RETAIN, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2590,17 +2868,21 @@ __urdlllocal ur_result_t UR_APICALL urProgramRelease( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_PROGRAM_RELEASE, "urProgramRelease", ¶ms); - getContext()->logger.info("---> urProgramRelease"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramRelease"); ur_result_t result = pfnRelease(hProgram); getContext()->notify_end(UR_FUNCTION_PROGRAM_RELEASE, "urProgramRelease", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_RELEASE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_RELEASE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2632,7 +2914,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetFunctionPointer( getContext()->notify_begin(UR_FUNCTION_PROGRAM_GET_FUNCTION_POINTER, "urProgramGetFunctionPointer", ¶ms); - getContext()->logger.info("---> urProgramGetFunctionPointer"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramGetFunctionPointer"); ur_result_t result = pfnGetFunctionPointer(hDevice, hProgram, pFunctionName, ppFunctionPointer); @@ -2641,10 +2925,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetFunctionPointer( "urProgramGetFunctionPointer", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_PROGRAM_GET_FUNCTION_POINTER, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PROGRAM_GET_FUNCTION_POINTER, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2678,7 +2964,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetGlobalVariablePointer( UR_FUNCTION_PROGRAM_GET_GLOBAL_VARIABLE_POINTER, "urProgramGetGlobalVariablePointer", ¶ms); - getContext()->logger.info("---> urProgramGetGlobalVariablePointer"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramGetGlobalVariablePointer"); ur_result_t result = pfnGetGlobalVariablePointer( hDevice, hProgram, pGlobalVariableName, pGlobalVariableSizeRet, @@ -2688,10 +2976,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetGlobalVariablePointer( "urProgramGetGlobalVariablePointer", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_PROGRAM_GET_GLOBAL_VARIABLE_POINTER, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PROGRAM_GET_GLOBAL_VARIABLE_POINTER, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2723,7 +3013,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetInfo( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_PROGRAM_GET_INFO, "urProgramGetInfo", ¶ms); - getContext()->logger.info("---> urProgramGetInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramGetInfo"); ur_result_t result = pfnGetInfo(hProgram, propName, propSize, pPropValue, pPropSizeRet); @@ -2731,10 +3023,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetInfo( getContext()->notify_end(UR_FUNCTION_PROGRAM_GET_INFO, "urProgramGetInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_GET_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_GET_INFO, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2768,7 +3062,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetBuildInfo( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_PROGRAM_GET_BUILD_INFO, "urProgramGetBuildInfo", ¶ms); - getContext()->logger.info("---> urProgramGetBuildInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramGetBuildInfo"); ur_result_t result = pfnGetBuildInfo(hProgram, hDevice, propName, propSize, pPropValue, pPropSizeRet); @@ -2777,10 +3073,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetBuildInfo( "urProgramGetBuildInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_PROGRAM_GET_BUILD_INFO, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PROGRAM_GET_BUILD_INFO, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2807,7 +3105,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramSetSpecializationConstants( UR_FUNCTION_PROGRAM_SET_SPECIALIZATION_CONSTANTS, "urProgramSetSpecializationConstants", ¶ms); - getContext()->logger.info("---> urProgramSetSpecializationConstants"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramSetSpecializationConstants"); ur_result_t result = pfnSetSpecializationConstants(hProgram, count, pSpecConstants); @@ -2816,10 +3116,13 @@ __urdlllocal ur_result_t UR_APICALL urProgramSetSpecializationConstants( "urProgramSetSpecializationConstants", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_PROGRAM_SET_SPECIALIZATION_CONSTANTS, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PROGRAM_SET_SPECIALIZATION_CONSTANTS, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2844,7 +3147,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetNativeHandle( getContext()->notify_begin(UR_FUNCTION_PROGRAM_GET_NATIVE_HANDLE, "urProgramGetNativeHandle", ¶ms); - getContext()->logger.info("---> urProgramGetNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramGetNativeHandle"); ur_result_t result = pfnGetNativeHandle(hProgram, phNativeProgram); @@ -2852,10 +3157,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetNativeHandle( "urProgramGetNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_PROGRAM_GET_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PROGRAM_GET_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2884,7 +3191,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithNativeHandle( UR_FUNCTION_PROGRAM_CREATE_WITH_NATIVE_HANDLE, "urProgramCreateWithNativeHandle", ¶ms); - getContext()->logger.info("---> urProgramCreateWithNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramCreateWithNativeHandle"); ur_result_t result = pfnCreateWithNativeHandle(hNativeProgram, hContext, pProperties, phProgram); @@ -2893,10 +3202,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithNativeHandle( "urProgramCreateWithNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_PROGRAM_CREATE_WITH_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PROGRAM_CREATE_WITH_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2919,17 +3230,21 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreate( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_KERNEL_CREATE, "urKernelCreate", ¶ms); - getContext()->logger.info("---> urKernelCreate"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelCreate"); ur_result_t result = pfnCreate(hProgram, pKernelName, phKernel); getContext()->notify_end(UR_FUNCTION_KERNEL_CREATE, "urKernelCreate", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_CREATE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_CREATE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2956,7 +3271,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgValue( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_KERNEL_SET_ARG_VALUE, "urKernelSetArgValue", ¶ms); - getContext()->logger.info("---> urKernelSetArgValue"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelSetArgValue"); ur_result_t result = pfnSetArgValue(hKernel, argIndex, argSize, pProperties, pArgValue); @@ -2964,10 +3281,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgValue( getContext()->notify_end(UR_FUNCTION_KERNEL_SET_ARG_VALUE, "urKernelSetArgValue", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_SET_ARG_VALUE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_KERNEL_SET_ARG_VALUE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -2993,7 +3312,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgLocal( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_KERNEL_SET_ARG_LOCAL, "urKernelSetArgLocal", ¶ms); - getContext()->logger.info("---> urKernelSetArgLocal"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelSetArgLocal"); ur_result_t result = pfnSetArgLocal(hKernel, argIndex, argSize, pProperties); @@ -3001,10 +3322,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgLocal( getContext()->notify_end(UR_FUNCTION_KERNEL_SET_ARG_LOCAL, "urKernelSetArgLocal", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_SET_ARG_LOCAL, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_KERNEL_SET_ARG_LOCAL, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3037,7 +3360,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetInfo( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_KERNEL_GET_INFO, "urKernelGetInfo", ¶ms); - getContext()->logger.info("---> urKernelGetInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelGetInfo"); ur_result_t result = pfnGetInfo(hKernel, propName, propSize, pPropValue, pPropSizeRet); @@ -3045,10 +3370,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetInfo( getContext()->notify_end(UR_FUNCTION_KERNEL_GET_INFO, "urKernelGetInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_GET_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_GET_INFO, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3079,7 +3406,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetGroupInfo( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_KERNEL_GET_GROUP_INFO, "urKernelGetGroupInfo", ¶ms); - getContext()->logger.info("---> urKernelGetGroupInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelGetGroupInfo"); ur_result_t result = pfnGetGroupInfo(hKernel, hDevice, propName, propSize, pPropValue, pPropSizeRet); @@ -3088,10 +3417,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetGroupInfo( "urKernelGetGroupInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_GET_GROUP_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_KERNEL_GET_GROUP_INFO, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3124,7 +3455,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetSubGroupInfo( getContext()->notify_begin(UR_FUNCTION_KERNEL_GET_SUB_GROUP_INFO, "urKernelGetSubGroupInfo", ¶ms); - getContext()->logger.info("---> urKernelGetSubGroupInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelGetSubGroupInfo"); ur_result_t result = pfnGetSubGroupInfo(hKernel, hDevice, propName, propSize, pPropValue, pPropSizeRet); @@ -3133,10 +3466,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetSubGroupInfo( "urKernelGetSubGroupInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_KERNEL_GET_SUB_GROUP_INFO, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_KERNEL_GET_SUB_GROUP_INFO, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3156,17 +3491,21 @@ __urdlllocal ur_result_t UR_APICALL urKernelRetain( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_KERNEL_RETAIN, "urKernelRetain", ¶ms); - getContext()->logger.info("---> urKernelRetain"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelRetain"); ur_result_t result = pfnRetain(hKernel); getContext()->notify_end(UR_FUNCTION_KERNEL_RETAIN, "urKernelRetain", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_RETAIN, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_RETAIN, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3187,17 +3526,21 @@ __urdlllocal ur_result_t UR_APICALL urKernelRelease( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_KERNEL_RELEASE, "urKernelRelease", ¶ms); - getContext()->logger.info("---> urKernelRelease"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelRelease"); ur_result_t result = pfnRelease(hKernel); getContext()->notify_end(UR_FUNCTION_KERNEL_RELEASE, "urKernelRelease", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_RELEASE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_RELEASE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3224,7 +3567,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgPointer( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_KERNEL_SET_ARG_POINTER, "urKernelSetArgPointer", ¶ms); - getContext()->logger.info("---> urKernelSetArgPointer"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelSetArgPointer"); ur_result_t result = pfnSetArgPointer(hKernel, argIndex, pProperties, pArgValue); @@ -3233,10 +3578,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgPointer( "urKernelSetArgPointer", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_KERNEL_SET_ARG_POINTER, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_KERNEL_SET_ARG_POINTER, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3264,7 +3611,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetExecInfo( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_KERNEL_SET_EXEC_INFO, "urKernelSetExecInfo", ¶ms); - getContext()->logger.info("---> urKernelSetExecInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelSetExecInfo"); ur_result_t result = pfnSetExecInfo(hKernel, propName, propSize, pProperties, pPropValue); @@ -3272,10 +3621,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetExecInfo( getContext()->notify_end(UR_FUNCTION_KERNEL_SET_EXEC_INFO, "urKernelSetExecInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_SET_EXEC_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_KERNEL_SET_EXEC_INFO, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3300,7 +3651,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgSampler( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_KERNEL_SET_ARG_SAMPLER, "urKernelSetArgSampler", ¶ms); - getContext()->logger.info("---> urKernelSetArgSampler"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelSetArgSampler"); ur_result_t result = pfnSetArgSampler(hKernel, argIndex, pProperties, hArgValue); @@ -3309,10 +3662,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgSampler( "urKernelSetArgSampler", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_KERNEL_SET_ARG_SAMPLER, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_KERNEL_SET_ARG_SAMPLER, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3337,7 +3692,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgMemObj( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_KERNEL_SET_ARG_MEM_OBJ, "urKernelSetArgMemObj", ¶ms); - getContext()->logger.info("---> urKernelSetArgMemObj"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelSetArgMemObj"); ur_result_t result = pfnSetArgMemObj(hKernel, argIndex, pProperties, hArgValue); @@ -3346,10 +3703,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgMemObj( "urKernelSetArgMemObj", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_KERNEL_SET_ARG_MEM_OBJ, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_KERNEL_SET_ARG_MEM_OBJ, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3375,7 +3734,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetSpecializationConstants( UR_FUNCTION_KERNEL_SET_SPECIALIZATION_CONSTANTS, "urKernelSetSpecializationConstants", ¶ms); - getContext()->logger.info("---> urKernelSetSpecializationConstants"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelSetSpecializationConstants"); ur_result_t result = pfnSetSpecializationConstants(hKernel, count, pSpecConstants); @@ -3384,10 +3745,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetSpecializationConstants( "urKernelSetSpecializationConstants", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_KERNEL_SET_SPECIALIZATION_CONSTANTS, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_KERNEL_SET_SPECIALIZATION_CONSTANTS, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3411,7 +3774,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetNativeHandle( getContext()->notify_begin(UR_FUNCTION_KERNEL_GET_NATIVE_HANDLE, "urKernelGetNativeHandle", ¶ms); - getContext()->logger.info("---> urKernelGetNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelGetNativeHandle"); ur_result_t result = pfnGetNativeHandle(hKernel, phNativeKernel); @@ -3419,10 +3784,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetNativeHandle( "urKernelGetNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_KERNEL_GET_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_KERNEL_GET_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3453,7 +3820,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreateWithNativeHandle( getContext()->notify_begin(UR_FUNCTION_KERNEL_CREATE_WITH_NATIVE_HANDLE, "urKernelCreateWithNativeHandle", ¶ms); - getContext()->logger.info("---> urKernelCreateWithNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelCreateWithNativeHandle"); ur_result_t result = pfnCreateWithNativeHandle( hNativeKernel, hContext, hProgram, pProperties, phKernel); @@ -3462,10 +3831,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreateWithNativeHandle( "urKernelCreateWithNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_KERNEL_CREATE_WITH_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_KERNEL_CREATE_WITH_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3503,7 +3874,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetSuggestedLocalWorkSize( UR_FUNCTION_KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE, "urKernelGetSuggestedLocalWorkSize", ¶ms); - getContext()->logger.info("---> urKernelGetSuggestedLocalWorkSize"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelGetSuggestedLocalWorkSize"); ur_result_t result = pfnGetSuggestedLocalWorkSize( hKernel, hQueue, numWorkDim, pGlobalWorkOffset, pGlobalWorkSize, @@ -3513,10 +3886,13 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetSuggestedLocalWorkSize( "urKernelGetSuggestedLocalWorkSize", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3545,7 +3921,9 @@ __urdlllocal ur_result_t UR_APICALL urQueueGetInfo( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_QUEUE_GET_INFO, "urQueueGetInfo", ¶ms); - getContext()->logger.info("---> urQueueGetInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urQueueGetInfo"); ur_result_t result = pfnGetInfo(hQueue, propName, propSize, pPropValue, pPropSizeRet); @@ -3553,10 +3931,12 @@ __urdlllocal ur_result_t UR_APICALL urQueueGetInfo( getContext()->notify_end(UR_FUNCTION_QUEUE_GET_INFO, "urQueueGetInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_GET_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_GET_INFO, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3582,17 +3962,21 @@ __urdlllocal ur_result_t UR_APICALL urQueueCreate( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_QUEUE_CREATE, "urQueueCreate", ¶ms); - getContext()->logger.info("---> urQueueCreate"); + auto &logger = getContext()->logger; + + logger.info("---> urQueueCreate"); ur_result_t result = pfnCreate(hContext, hDevice, pProperties, phQueue); getContext()->notify_end(UR_FUNCTION_QUEUE_CREATE, "urQueueCreate", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_CREATE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_CREATE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3613,17 +3997,21 @@ __urdlllocal ur_result_t UR_APICALL urQueueRetain( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_QUEUE_RETAIN, "urQueueRetain", ¶ms); - getContext()->logger.info("---> urQueueRetain"); + auto &logger = getContext()->logger; + + logger.info("---> urQueueRetain"); ur_result_t result = pfnRetain(hQueue); getContext()->notify_end(UR_FUNCTION_QUEUE_RETAIN, "urQueueRetain", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_RETAIN, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_RETAIN, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3644,17 +4032,21 @@ __urdlllocal ur_result_t UR_APICALL urQueueRelease( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_QUEUE_RELEASE, "urQueueRelease", ¶ms); - getContext()->logger.info("---> urQueueRelease"); + auto &logger = getContext()->logger; + + logger.info("---> urQueueRelease"); ur_result_t result = pfnRelease(hQueue); getContext()->notify_end(UR_FUNCTION_QUEUE_RELEASE, "urQueueRelease", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_RELEASE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_RELEASE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3679,7 +4071,9 @@ __urdlllocal ur_result_t UR_APICALL urQueueGetNativeHandle( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_QUEUE_GET_NATIVE_HANDLE, "urQueueGetNativeHandle", ¶ms); - getContext()->logger.info("---> urQueueGetNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urQueueGetNativeHandle"); ur_result_t result = pfnGetNativeHandle(hQueue, pDesc, phNativeQueue); @@ -3687,10 +4081,12 @@ __urdlllocal ur_result_t UR_APICALL urQueueGetNativeHandle( "urQueueGetNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_QUEUE_GET_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_QUEUE_GET_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3720,7 +4116,9 @@ __urdlllocal ur_result_t UR_APICALL urQueueCreateWithNativeHandle( getContext()->notify_begin(UR_FUNCTION_QUEUE_CREATE_WITH_NATIVE_HANDLE, "urQueueCreateWithNativeHandle", ¶ms); - getContext()->logger.info("---> urQueueCreateWithNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urQueueCreateWithNativeHandle"); ur_result_t result = pfnCreateWithNativeHandle( hNativeQueue, hContext, hDevice, pProperties, phQueue); @@ -3729,10 +4127,12 @@ __urdlllocal ur_result_t UR_APICALL urQueueCreateWithNativeHandle( "urQueueCreateWithNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_QUEUE_CREATE_WITH_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_QUEUE_CREATE_WITH_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3752,17 +4152,21 @@ __urdlllocal ur_result_t UR_APICALL urQueueFinish( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_QUEUE_FINISH, "urQueueFinish", ¶ms); - getContext()->logger.info("---> urQueueFinish"); + auto &logger = getContext()->logger; + + logger.info("---> urQueueFinish"); ur_result_t result = pfnFinish(hQueue); getContext()->notify_end(UR_FUNCTION_QUEUE_FINISH, "urQueueFinish", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_FINISH, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_FINISH, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3782,16 +4186,21 @@ __urdlllocal ur_result_t UR_APICALL urQueueFlush( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_QUEUE_FLUSH, "urQueueFlush", ¶ms); - getContext()->logger.info("---> urQueueFlush"); + auto &logger = getContext()->logger; + + logger.info("---> urQueueFlush"); ur_result_t result = pfnFlush(hQueue); getContext()->notify_end(UR_FUNCTION_QUEUE_FLUSH, "urQueueFlush", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_FLUSH, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_FLUSH, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3818,7 +4227,9 @@ __urdlllocal ur_result_t UR_APICALL urEventGetInfo( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_EVENT_GET_INFO, "urEventGetInfo", ¶ms); - getContext()->logger.info("---> urEventGetInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urEventGetInfo"); ur_result_t result = pfnGetInfo(hEvent, propName, propSize, pPropValue, pPropSizeRet); @@ -3826,10 +4237,12 @@ __urdlllocal ur_result_t UR_APICALL urEventGetInfo( getContext()->notify_end(UR_FUNCTION_EVENT_GET_INFO, "urEventGetInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_GET_INFO, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_GET_INFO, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3861,7 +4274,9 @@ __urdlllocal ur_result_t UR_APICALL urEventGetProfilingInfo( getContext()->notify_begin(UR_FUNCTION_EVENT_GET_PROFILING_INFO, "urEventGetProfilingInfo", ¶ms); - getContext()->logger.info("---> urEventGetProfilingInfo"); + auto &logger = getContext()->logger; + + logger.info("---> urEventGetProfilingInfo"); ur_result_t result = pfnGetProfilingInfo(hEvent, propName, propSize, pPropValue, pPropSizeRet); @@ -3870,10 +4285,12 @@ __urdlllocal ur_result_t UR_APICALL urEventGetProfilingInfo( "urEventGetProfilingInfo", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_EVENT_GET_PROFILING_INFO, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_EVENT_GET_PROFILING_INFO, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3896,16 +4313,21 @@ __urdlllocal ur_result_t UR_APICALL urEventWait( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_EVENT_WAIT, "urEventWait", ¶ms); - getContext()->logger.info("---> urEventWait"); + auto &logger = getContext()->logger; + + logger.info("---> urEventWait"); ur_result_t result = pfnWait(numEvents, phEventWaitList); getContext()->notify_end(UR_FUNCTION_EVENT_WAIT, "urEventWait", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_WAIT, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_WAIT, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3925,17 +4347,21 @@ __urdlllocal ur_result_t UR_APICALL urEventRetain( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_EVENT_RETAIN, "urEventRetain", ¶ms); - getContext()->logger.info("---> urEventRetain"); + auto &logger = getContext()->logger; + + logger.info("---> urEventRetain"); ur_result_t result = pfnRetain(hEvent); getContext()->notify_end(UR_FUNCTION_EVENT_RETAIN, "urEventRetain", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_RETAIN, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_RETAIN, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3955,17 +4381,21 @@ __urdlllocal ur_result_t UR_APICALL urEventRelease( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_EVENT_RELEASE, "urEventRelease", ¶ms); - getContext()->logger.info("---> urEventRelease"); + auto &logger = getContext()->logger; + + logger.info("---> urEventRelease"); ur_result_t result = pfnRelease(hEvent); getContext()->notify_end(UR_FUNCTION_EVENT_RELEASE, "urEventRelease", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_RELEASE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_RELEASE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -3987,7 +4417,9 @@ __urdlllocal ur_result_t UR_APICALL urEventGetNativeHandle( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_EVENT_GET_NATIVE_HANDLE, "urEventGetNativeHandle", ¶ms); - getContext()->logger.info("---> urEventGetNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urEventGetNativeHandle"); ur_result_t result = pfnGetNativeHandle(hEvent, phNativeEvent); @@ -3995,10 +4427,12 @@ __urdlllocal ur_result_t UR_APICALL urEventGetNativeHandle( "urEventGetNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_EVENT_GET_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_EVENT_GET_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4027,7 +4461,9 @@ __urdlllocal ur_result_t UR_APICALL urEventCreateWithNativeHandle( getContext()->notify_begin(UR_FUNCTION_EVENT_CREATE_WITH_NATIVE_HANDLE, "urEventCreateWithNativeHandle", ¶ms); - getContext()->logger.info("---> urEventCreateWithNativeHandle"); + auto &logger = getContext()->logger; + + logger.info("---> urEventCreateWithNativeHandle"); ur_result_t result = pfnCreateWithNativeHandle(hNativeEvent, hContext, pProperties, phEvent); @@ -4036,10 +4472,12 @@ __urdlllocal ur_result_t UR_APICALL urEventCreateWithNativeHandle( "urEventCreateWithNativeHandle", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_EVENT_CREATE_WITH_NATIVE_HANDLE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_EVENT_CREATE_WITH_NATIVE_HANDLE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4064,7 +4502,9 @@ __urdlllocal ur_result_t UR_APICALL urEventSetCallback( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_EVENT_SET_CALLBACK, "urEventSetCallback", ¶ms); - getContext()->logger.info("---> urEventSetCallback"); + auto &logger = getContext()->logger; + + logger.info("---> urEventSetCallback"); ur_result_t result = pfnSetCallback(hEvent, execStatus, pfnNotify, pUserData); @@ -4072,10 +4512,12 @@ __urdlllocal ur_result_t UR_APICALL urEventSetCallback( getContext()->notify_end(UR_FUNCTION_EVENT_SET_CALLBACK, "urEventSetCallback", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_SET_CALLBACK, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_EVENT_SET_CALLBACK, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4129,7 +4571,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH, "urEnqueueKernelLaunch", ¶ms); - getContext()->logger.info("---> urEnqueueKernelLaunch"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueKernelLaunch"); ur_result_t result = pfnKernelLaunch( hQueue, hKernel, workDim, pGlobalWorkOffset, pGlobalWorkSize, @@ -4139,10 +4583,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch( "urEnqueueKernelLaunch", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4173,7 +4619,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWait( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_EVENTS_WAIT, "urEnqueueEventsWait", ¶ms); - getContext()->logger.info("---> urEnqueueEventsWait"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueEventsWait"); ur_result_t result = pfnEventsWait(hQueue, numEventsInWaitList, phEventWaitList, phEvent); @@ -4181,10 +4629,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWait( getContext()->notify_end(UR_FUNCTION_ENQUEUE_EVENTS_WAIT, "urEnqueueEventsWait", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_EVENTS_WAIT, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_EVENTS_WAIT, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4217,7 +4667,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( getContext()->notify_begin(UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER, "urEnqueueEventsWaitWithBarrier", ¶ms); - getContext()->logger.info("---> urEnqueueEventsWaitWithBarrier"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueEventsWaitWithBarrier"); ur_result_t result = pfnEventsWaitWithBarrier(hQueue, numEventsInWaitList, phEventWaitList, phEvent); @@ -4226,10 +4678,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( "urEnqueueEventsWaitWithBarrier", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4267,7 +4721,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ, "urEnqueueMemBufferRead", ¶ms); - getContext()->logger.info("---> urEnqueueMemBufferRead"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueMemBufferRead"); ur_result_t result = pfnMemBufferRead(hQueue, hBuffer, blockingRead, offset, size, pDst, @@ -4277,10 +4733,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( "urEnqueueMemBufferRead", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4321,7 +4779,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( getContext()->notify_begin(UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE, "urEnqueueMemBufferWrite", ¶ms); - getContext()->logger.info("---> urEnqueueMemBufferWrite"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueMemBufferWrite"); ur_result_t result = pfnMemBufferWrite(hQueue, hBuffer, blockingWrite, offset, size, pSrc, @@ -4331,10 +4791,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( "urEnqueueMemBufferWrite", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4396,7 +4858,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( getContext()->notify_begin(UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ_RECT, "urEnqueueMemBufferReadRect", ¶ms); - getContext()->logger.info("---> urEnqueueMemBufferReadRect"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueMemBufferReadRect"); ur_result_t result = pfnMemBufferReadRect( hQueue, hBuffer, blockingRead, bufferOrigin, hostOrigin, region, @@ -4407,10 +4871,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( "urEnqueueMemBufferReadRect", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ_RECT, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ_RECT, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4475,7 +4941,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( getContext()->notify_begin(UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE_RECT, "urEnqueueMemBufferWriteRect", ¶ms); - getContext()->logger.info("---> urEnqueueMemBufferWriteRect"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueMemBufferWriteRect"); ur_result_t result = pfnMemBufferWriteRect( hQueue, hBuffer, blockingWrite, bufferOrigin, hostOrigin, region, @@ -4486,10 +4954,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( "urEnqueueMemBufferWriteRect", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE_RECT, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE_RECT, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4527,7 +4997,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY, "urEnqueueMemBufferCopy", ¶ms); - getContext()->logger.info("---> urEnqueueMemBufferCopy"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueMemBufferCopy"); ur_result_t result = pfnMemBufferCopy(hQueue, hBufferSrc, hBufferDst, srcOffset, dstOffset, @@ -4537,10 +5009,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( "urEnqueueMemBufferCopy", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4591,7 +5065,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( getContext()->notify_begin(UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY_RECT, "urEnqueueMemBufferCopyRect", ¶ms); - getContext()->logger.info("---> urEnqueueMemBufferCopyRect"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueMemBufferCopyRect"); ur_result_t result = pfnMemBufferCopyRect( hQueue, hBufferSrc, hBufferDst, srcOrigin, dstOrigin, region, @@ -4602,10 +5078,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( "urEnqueueMemBufferCopyRect", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY_RECT, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY_RECT, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4648,7 +5126,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_MEM_BUFFER_FILL, "urEnqueueMemBufferFill", ¶ms); - getContext()->logger.info("---> urEnqueueMemBufferFill"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueMemBufferFill"); ur_result_t result = pfnMemBufferFill(hQueue, hBuffer, pPattern, patternSize, offset, size, @@ -4658,10 +5138,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( "urEnqueueMemBufferFill", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_FILL, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_FILL, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4705,7 +5187,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_MEM_IMAGE_READ, "urEnqueueMemImageRead", ¶ms); - getContext()->logger.info("---> urEnqueueMemImageRead"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueMemImageRead"); ur_result_t result = pfnMemImageRead( hQueue, hImage, blockingRead, origin, region, rowPitch, slicePitch, @@ -4715,10 +5199,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( "urEnqueueMemImageRead", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_MEM_IMAGE_READ, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_MEM_IMAGE_READ, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4763,7 +5249,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_MEM_IMAGE_WRITE, "urEnqueueMemImageWrite", ¶ms); - getContext()->logger.info("---> urEnqueueMemImageWrite"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueMemImageWrite"); ur_result_t result = pfnMemImageWrite( hQueue, hImage, blockingWrite, origin, region, rowPitch, slicePitch, @@ -4773,10 +5261,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( "urEnqueueMemImageWrite", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_MEM_IMAGE_WRITE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_MEM_IMAGE_WRITE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4820,7 +5310,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_MEM_IMAGE_COPY, "urEnqueueMemImageCopy", ¶ms); - getContext()->logger.info("---> urEnqueueMemImageCopy"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueMemImageCopy"); ur_result_t result = pfnMemImageCopy(hQueue, hImageSrc, hImageDst, srcOrigin, dstOrigin, @@ -4830,10 +5322,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( "urEnqueueMemImageCopy", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_MEM_IMAGE_COPY, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_MEM_IMAGE_COPY, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4873,7 +5367,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferMap( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_MEM_BUFFER_MAP, "urEnqueueMemBufferMap", ¶ms); - getContext()->logger.info("---> urEnqueueMemBufferMap"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueMemBufferMap"); ur_result_t result = pfnMemBufferMap(hQueue, hBuffer, blockingMap, mapFlags, offset, size, numEventsInWaitList, @@ -4883,10 +5379,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferMap( "urEnqueueMemBufferMap", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_MAP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_MAP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4920,7 +5418,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemUnmap( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_MEM_UNMAP, "urEnqueueMemUnmap", ¶ms); - getContext()->logger.info("---> urEnqueueMemUnmap"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueMemUnmap"); ur_result_t result = pfnMemUnmap(hQueue, hMem, pMappedPtr, numEventsInWaitList, @@ -4929,10 +5429,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemUnmap( getContext()->notify_end(UR_FUNCTION_ENQUEUE_MEM_UNMAP, "urEnqueueMemUnmap", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_MEM_UNMAP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_MEM_UNMAP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -4972,7 +5474,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_ENQUEUE_USM_FILL, "urEnqueueUSMFill", ¶ms); - getContext()->logger.info("---> urEnqueueUSMFill"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueUSMFill"); ur_result_t result = pfnUSMFill(hQueue, pMem, patternSize, pPattern, size, @@ -4981,10 +5485,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( getContext()->notify_end(UR_FUNCTION_ENQUEUE_USM_FILL, "urEnqueueUSMFill", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_FILL, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_FILL, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5021,7 +5527,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_USM_MEMCPY, "urEnqueueUSMMemcpy", ¶ms); - getContext()->logger.info("---> urEnqueueUSMMemcpy"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueUSMMemcpy"); ur_result_t result = pfnUSMMemcpy(hQueue, blocking, pDst, pSrc, size, numEventsInWaitList, @@ -5030,10 +5538,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( getContext()->notify_end(UR_FUNCTION_ENQUEUE_USM_MEMCPY, "urEnqueueUSMMemcpy", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_MEMCPY, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_USM_MEMCPY, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5068,7 +5578,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_USM_PREFETCH, "urEnqueueUSMPrefetch", ¶ms); - getContext()->logger.info("---> urEnqueueUSMPrefetch"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueUSMPrefetch"); ur_result_t result = pfnUSMPrefetch(hQueue, pMem, size, flags, numEventsInWaitList, @@ -5078,10 +5590,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( "urEnqueueUSMPrefetch", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_PREFETCH, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_USM_PREFETCH, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5109,17 +5623,21 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMAdvise( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_USM_ADVISE, "urEnqueueUSMAdvise", ¶ms); - getContext()->logger.info("---> urEnqueueUSMAdvise"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueUSMAdvise"); ur_result_t result = pfnUSMAdvise(hQueue, pMem, size, advice, phEvent); getContext()->notify_end(UR_FUNCTION_ENQUEUE_USM_ADVISE, "urEnqueueUSMAdvise", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_ADVISE, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_USM_ADVISE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5164,7 +5682,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_USM_FILL_2D, "urEnqueueUSMFill2D", ¶ms); - getContext()->logger.info("---> urEnqueueUSMFill2D"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueUSMFill2D"); ur_result_t result = pfnUSMFill2D(hQueue, pMem, pitch, patternSize, pPattern, width, height, @@ -5173,10 +5693,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( getContext()->notify_end(UR_FUNCTION_ENQUEUE_USM_FILL_2D, "urEnqueueUSMFill2D", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_FILL_2D, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_USM_FILL_2D, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5221,7 +5743,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_USM_MEMCPY_2D, "urEnqueueUSMMemcpy2D", ¶ms); - getContext()->logger.info("---> urEnqueueUSMMemcpy2D"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueUSMMemcpy2D"); ur_result_t result = pfnUSMMemcpy2D(hQueue, blocking, pDst, dstPitch, pSrc, srcPitch, width, @@ -5231,10 +5755,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( "urEnqueueUSMMemcpy2D", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_MEMCPY_2D, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_USM_MEMCPY_2D, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5277,7 +5803,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableWrite( UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_WRITE, "urEnqueueDeviceGlobalVariableWrite", ¶ms); - getContext()->logger.info("---> urEnqueueDeviceGlobalVariableWrite"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueDeviceGlobalVariableWrite"); ur_result_t result = pfnDeviceGlobalVariableWrite( hQueue, hProgram, name, blockingWrite, count, offset, pSrc, @@ -5287,10 +5815,13 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableWrite( "urEnqueueDeviceGlobalVariableWrite", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_WRITE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_WRITE, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5333,7 +5864,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableRead( UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_READ, "urEnqueueDeviceGlobalVariableRead", ¶ms); - getContext()->logger.info("---> urEnqueueDeviceGlobalVariableRead"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueDeviceGlobalVariableRead"); ur_result_t result = pfnDeviceGlobalVariableRead( hQueue, hProgram, name, blockingRead, count, offset, pDst, @@ -5343,10 +5876,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableRead( "urEnqueueDeviceGlobalVariableRead", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_READ, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_READ, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5391,7 +5926,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueReadHostPipe( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_READ_HOST_PIPE, "urEnqueueReadHostPipe", ¶ms); - getContext()->logger.info("---> urEnqueueReadHostPipe"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueReadHostPipe"); ur_result_t result = pfnReadHostPipe(hQueue, hProgram, pipe_symbol, blocking, pDst, size, @@ -5401,10 +5938,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueReadHostPipe( "urEnqueueReadHostPipe", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_READ_HOST_PIPE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_READ_HOST_PIPE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5449,7 +5988,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE, "urEnqueueWriteHostPipe", ¶ms); - getContext()->logger.info("---> urEnqueueWriteHostPipe"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueWriteHostPipe"); ur_result_t result = pfnWriteHostPipe(hQueue, hProgram, pipe_symbol, blocking, pSrc, size, @@ -5459,10 +6000,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( "urEnqueueWriteHostPipe", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5497,7 +6040,9 @@ __urdlllocal ur_result_t UR_APICALL urUSMPitchedAllocExp( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_USM_PITCHED_ALLOC_EXP, "urUSMPitchedAllocExp", ¶ms); - getContext()->logger.info("---> urUSMPitchedAllocExp"); + auto &logger = getContext()->logger; + + logger.info("---> urUSMPitchedAllocExp"); ur_result_t result = pfnPitchedAllocExp(hContext, hDevice, pUSMDesc, pool, widthInBytes, @@ -5507,10 +6052,12 @@ __urdlllocal ur_result_t UR_APICALL urUSMPitchedAllocExp( "urUSMPitchedAllocExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_PITCHED_ALLOC_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_USM_PITCHED_ALLOC_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5538,8 +6085,9 @@ urBindlessImagesUnsampledImageHandleDestroyExp( UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP, "urBindlessImagesUnsampledImageHandleDestroyExp", ¶ms); - getContext()->logger.info( - "---> urBindlessImagesUnsampledImageHandleDestroyExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesUnsampledImageHandleDestroyExp"); ur_result_t result = pfnUnsampledImageHandleDestroyExp(hContext, hDevice, hImage); @@ -5549,12 +6097,14 @@ urBindlessImagesUnsampledImageHandleDestroyExp( "urBindlessImagesUnsampledImageHandleDestroyExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, - UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, + UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5582,8 +6132,9 @@ urBindlessImagesSampledImageHandleDestroyExp( UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP, "urBindlessImagesSampledImageHandleDestroyExp", ¶ms); - getContext()->logger.info( - "---> urBindlessImagesSampledImageHandleDestroyExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesSampledImageHandleDestroyExp"); ur_result_t result = pfnSampledImageHandleDestroyExp(hContext, hDevice, hImage); @@ -5593,11 +6144,14 @@ urBindlessImagesSampledImageHandleDestroyExp( "urBindlessImagesSampledImageHandleDestroyExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, + UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5626,7 +6180,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( UR_FUNCTION_BINDLESS_IMAGES_IMAGE_ALLOCATE_EXP, "urBindlessImagesImageAllocateExp", ¶ms); - getContext()->logger.info("---> urBindlessImagesImageAllocateExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesImageAllocateExp"); ur_result_t result = pfnImageAllocateExp(hContext, hDevice, pImageFormat, pImageDesc, phImageMem); @@ -5635,10 +6191,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( "urBindlessImagesImageAllocateExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_ALLOCATE_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_ALLOCATE_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5664,7 +6222,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageFreeExp( getContext()->notify_begin(UR_FUNCTION_BINDLESS_IMAGES_IMAGE_FREE_EXP, "urBindlessImagesImageFreeExp", ¶ms); - getContext()->logger.info("---> urBindlessImagesImageFreeExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesImageFreeExp"); ur_result_t result = pfnImageFreeExp(hContext, hDevice, hImageMem); @@ -5672,10 +6232,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageFreeExp( "urBindlessImagesImageFreeExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_FREE_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_FREE_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5706,7 +6268,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP, "urBindlessImagesUnsampledImageCreateExp", ¶ms); - getContext()->logger.info("---> urBindlessImagesUnsampledImageCreateExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesUnsampledImageCreateExp"); ur_result_t result = pfnUnsampledImageCreateExp( hContext, hDevice, hImageMem, pImageFormat, pImageDesc, phImage); @@ -5715,11 +6279,13 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP, "urBindlessImagesUnsampledImageCreateExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5752,7 +6318,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP, "urBindlessImagesSampledImageCreateExp", ¶ms); - getContext()->logger.info("---> urBindlessImagesSampledImageCreateExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesSampledImageCreateExp"); ur_result_t result = pfnSampledImageCreateExp(hContext, hDevice, hImageMem, pImageFormat, @@ -5762,11 +6330,13 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP, "urBindlessImagesSampledImageCreateExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5822,7 +6392,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp( getContext()->notify_begin(UR_FUNCTION_BINDLESS_IMAGES_IMAGE_COPY_EXP, "urBindlessImagesImageCopyExp", ¶ms); - getContext()->logger.info("---> urBindlessImagesImageCopyExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesImageCopyExp"); ur_result_t result = pfnImageCopyExp( hQueue, pSrc, pDst, pSrcImageDesc, pDstImageDesc, pSrcImageFormat, @@ -5833,10 +6405,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp( "urBindlessImagesImageCopyExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_COPY_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_COPY_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5864,7 +6438,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( UR_FUNCTION_BINDLESS_IMAGES_IMAGE_GET_INFO_EXP, "urBindlessImagesImageGetInfoExp", ¶ms); - getContext()->logger.info("---> urBindlessImagesImageGetInfoExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesImageGetInfoExp"); ur_result_t result = pfnImageGetInfoExp(hContext, hImageMem, propName, pPropValue, pPropSizeRet); @@ -5873,10 +6449,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( "urBindlessImagesImageGetInfoExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_GET_INFO_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_GET_INFO_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5905,7 +6483,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp( UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_GET_LEVEL_EXP, "urBindlessImagesMipmapGetLevelExp", ¶ms); - getContext()->logger.info("---> urBindlessImagesMipmapGetLevelExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesMipmapGetLevelExp"); ur_result_t result = pfnMipmapGetLevelExp(hContext, hDevice, hImageMem, mipmapLevel, phImageMem); @@ -5914,10 +6494,13 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp( "urBindlessImagesMipmapGetLevelExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_GET_LEVEL_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_GET_LEVEL_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5943,7 +6526,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( getContext()->notify_begin(UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_FREE_EXP, "urBindlessImagesMipmapFreeExp", ¶ms); - getContext()->logger.info("---> urBindlessImagesMipmapFreeExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesMipmapFreeExp"); ur_result_t result = pfnMipmapFreeExp(hContext, hDevice, hMem); @@ -5951,10 +6536,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( "urBindlessImagesMipmapFreeExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_FREE_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_FREE_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -5986,7 +6573,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportExternalMemoryExp( UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP, "urBindlessImagesImportExternalMemoryExp", ¶ms); - getContext()->logger.info("---> urBindlessImagesImportExternalMemoryExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesImportExternalMemoryExp"); ur_result_t result = pfnImportExternalMemoryExp(hContext, hDevice, size, memHandleType, @@ -5996,11 +6585,13 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportExternalMemoryExp( UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP, "urBindlessImagesImportExternalMemoryExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6032,7 +6623,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP, "urBindlessImagesMapExternalArrayExp", ¶ms); - getContext()->logger.info("---> urBindlessImagesMapExternalArrayExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesMapExternalArrayExp"); ur_result_t result = pfnMapExternalArrayExp( hContext, hDevice, pImageFormat, pImageDesc, hExternalMem, phImageMem); @@ -6041,10 +6634,13 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( "urBindlessImagesMapExternalArrayExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6074,8 +6670,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMapExternalLinearMemoryExp( UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP, "urBindlessImagesMapExternalLinearMemoryExp", ¶ms); - getContext()->logger.info( - "---> urBindlessImagesMapExternalLinearMemoryExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesMapExternalLinearMemoryExp"); ur_result_t result = pfnMapExternalLinearMemoryExp( hContext, hDevice, offset, size, hExternalMem, ppRetMem); @@ -6085,11 +6682,14 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMapExternalLinearMemoryExp( "urBindlessImagesMapExternalLinearMemoryExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, + UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6115,7 +6715,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalMemoryExp( UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP, "urBindlessImagesReleaseExternalMemoryExp", ¶ms); - getContext()->logger.info("---> urBindlessImagesReleaseExternalMemoryExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesReleaseExternalMemoryExp"); ur_result_t result = pfnReleaseExternalMemoryExp(hContext, hDevice, hExternalMem); @@ -6124,11 +6726,13 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalMemoryExp( UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP, "urBindlessImagesReleaseExternalMemoryExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6160,8 +6764,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportExternalSemaphoreExp( UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP, "urBindlessImagesImportExternalSemaphoreExp", ¶ms); - getContext()->logger.info( - "---> urBindlessImagesImportExternalSemaphoreExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesImportExternalSemaphoreExp"); ur_result_t result = pfnImportExternalSemaphoreExp( hContext, hDevice, semHandleType, pExternalSemaphoreDesc, @@ -6172,11 +6777,13 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportExternalSemaphoreExp( "urBindlessImagesImportExternalSemaphoreExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6203,8 +6810,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalSemaphoreExp( UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_SEMAPHORE_EXP, "urBindlessImagesReleaseExternalSemaphoreExp", ¶ms); - getContext()->logger.info( - "---> urBindlessImagesReleaseExternalSemaphoreExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesReleaseExternalSemaphoreExp"); ur_result_t result = pfnReleaseExternalSemaphoreExp(hContext, hDevice, hExternalSemaphore); @@ -6214,11 +6822,14 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalSemaphoreExp( "urBindlessImagesReleaseExternalSemaphoreExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_SEMAPHORE_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, + UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_SEMAPHORE_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6261,7 +6872,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesWaitExternalSemaphoreExp( UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP, "urBindlessImagesWaitExternalSemaphoreExp", ¶ms); - getContext()->logger.info("---> urBindlessImagesWaitExternalSemaphoreExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesWaitExternalSemaphoreExp"); ur_result_t result = pfnWaitExternalSemaphoreExp( hQueue, hSemaphore, hasWaitValue, waitValue, numEventsInWaitList, @@ -6271,11 +6884,13 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesWaitExternalSemaphoreExp( UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP, "urBindlessImagesWaitExternalSemaphoreExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6319,8 +6934,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSignalExternalSemaphoreExp( UR_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP, "urBindlessImagesSignalExternalSemaphoreExp", ¶ms); - getContext()->logger.info( - "---> urBindlessImagesSignalExternalSemaphoreExp"); + auto &logger = getContext()->logger; + + logger.info("---> urBindlessImagesSignalExternalSemaphoreExp"); ur_result_t result = pfnSignalExternalSemaphoreExp( hQueue, hSemaphore, hasSignalValue, signalValue, numEventsInWaitList, @@ -6331,11 +6947,13 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSignalExternalSemaphoreExp( "urBindlessImagesSignalExternalSemaphoreExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6362,7 +6980,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferCreateExp( getContext()->notify_begin(UR_FUNCTION_COMMAND_BUFFER_CREATE_EXP, "urCommandBufferCreateExp", ¶ms); - getContext()->logger.info("---> urCommandBufferCreateExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferCreateExp"); ur_result_t result = pfnCreateExp(hContext, hDevice, pCommandBufferDesc, phCommandBuffer); @@ -6371,10 +6991,12 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferCreateExp( "urCommandBufferCreateExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_CREATE_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_CREATE_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6396,7 +7018,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainExp( getContext()->notify_begin(UR_FUNCTION_COMMAND_BUFFER_RETAIN_EXP, "urCommandBufferRetainExp", ¶ms); - getContext()->logger.info("---> urCommandBufferRetainExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferRetainExp"); ur_result_t result = pfnRetainExp(hCommandBuffer); @@ -6404,10 +7028,12 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainExp( "urCommandBufferRetainExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_RETAIN_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_RETAIN_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6430,7 +7056,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseExp( getContext()->notify_begin(UR_FUNCTION_COMMAND_BUFFER_RELEASE_EXP, "urCommandBufferReleaseExp", ¶ms); - getContext()->logger.info("---> urCommandBufferReleaseExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferReleaseExp"); ur_result_t result = pfnReleaseExp(hCommandBuffer); @@ -6438,10 +7066,12 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseExp( "urCommandBufferReleaseExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_RELEASE_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_RELEASE_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6464,7 +7094,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferFinalizeExp( getContext()->notify_begin(UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP, "urCommandBufferFinalizeExp", ¶ms); - getContext()->logger.info("---> urCommandBufferFinalizeExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferFinalizeExp"); ur_result_t result = pfnFinalizeExp(hCommandBuffer); @@ -6472,10 +7104,12 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferFinalizeExp( "urCommandBufferFinalizeExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6525,7 +7159,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP, "urCommandBufferAppendKernelLaunchExp", ¶ms); - getContext()->logger.info("---> urCommandBufferAppendKernelLaunchExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferAppendKernelLaunchExp"); ur_result_t result = pfnAppendKernelLaunchExp( hCommandBuffer, hKernel, workDim, pGlobalWorkOffset, pGlobalWorkSize, @@ -6536,10 +7172,13 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP, "urCommandBufferAppendKernelLaunchExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6574,7 +7213,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP, "urCommandBufferAppendUSMMemcpyExp", ¶ms); - getContext()->logger.info("---> urCommandBufferAppendUSMMemcpyExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferAppendUSMMemcpyExp"); ur_result_t result = pfnAppendUSMMemcpyExp(hCommandBuffer, pDst, pSrc, size, numSyncPointsInWaitList, @@ -6584,10 +7225,13 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( "urCommandBufferAppendUSMMemcpyExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6625,7 +7269,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP, "urCommandBufferAppendUSMFillExp", ¶ms); - getContext()->logger.info("---> urCommandBufferAppendUSMFillExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferAppendUSMFillExp"); ur_result_t result = pfnAppendUSMFillExp( hCommandBuffer, pMemory, pPattern, patternSize, size, @@ -6635,10 +7281,12 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( "urCommandBufferAppendUSMFillExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6682,7 +7330,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP, "urCommandBufferAppendMemBufferCopyExp", ¶ms); - getContext()->logger.info("---> urCommandBufferAppendMemBufferCopyExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferAppendMemBufferCopyExp"); ur_result_t result = pfnAppendMemBufferCopyExp( hCommandBuffer, hSrcMem, hDstMem, srcOffset, dstOffset, size, @@ -6692,11 +7342,13 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP, "urCommandBufferAppendMemBufferCopyExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6739,7 +7391,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP, "urCommandBufferAppendMemBufferWriteExp", ¶ms); - getContext()->logger.info("---> urCommandBufferAppendMemBufferWriteExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferAppendMemBufferWriteExp"); ur_result_t result = pfnAppendMemBufferWriteExp( hCommandBuffer, hBuffer, offset, size, pSrc, numSyncPointsInWaitList, @@ -6749,11 +7403,13 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP, "urCommandBufferAppendMemBufferWriteExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6795,7 +7451,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP, "urCommandBufferAppendMemBufferReadExp", ¶ms); - getContext()->logger.info("---> urCommandBufferAppendMemBufferReadExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferAppendMemBufferReadExp"); ur_result_t result = pfnAppendMemBufferReadExp( hCommandBuffer, hBuffer, offset, size, pDst, numSyncPointsInWaitList, @@ -6805,11 +7463,13 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP, "urCommandBufferAppendMemBufferReadExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6864,7 +7524,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP, "urCommandBufferAppendMemBufferCopyRectExp", ¶ms); - getContext()->logger.info("---> urCommandBufferAppendMemBufferCopyRectExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferAppendMemBufferCopyRectExp"); ur_result_t result = pfnAppendMemBufferCopyRectExp( hCommandBuffer, hSrcMem, hDstMem, srcOrigin, dstOrigin, region, @@ -6876,11 +7538,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( "urCommandBufferAppendMemBufferCopyRectExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -6942,8 +7607,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP, "urCommandBufferAppendMemBufferWriteRectExp", ¶ms); - getContext()->logger.info( - "---> urCommandBufferAppendMemBufferWriteRectExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferAppendMemBufferWriteRectExp"); ur_result_t result = pfnAppendMemBufferWriteRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, @@ -6955,11 +7621,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( "urCommandBufferAppendMemBufferWriteRectExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7018,7 +7687,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP, "urCommandBufferAppendMemBufferReadRectExp", ¶ms); - getContext()->logger.info("---> urCommandBufferAppendMemBufferReadRectExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferAppendMemBufferReadRectExp"); ur_result_t result = pfnAppendMemBufferReadRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, @@ -7030,11 +7701,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( "urCommandBufferAppendMemBufferReadRectExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7079,7 +7753,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP, "urCommandBufferAppendMemBufferFillExp", ¶ms); - getContext()->logger.info("---> urCommandBufferAppendMemBufferFillExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferAppendMemBufferFillExp"); ur_result_t result = pfnAppendMemBufferFillExp( hCommandBuffer, hBuffer, pPattern, patternSize, offset, size, @@ -7089,11 +7765,13 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP, "urCommandBufferAppendMemBufferFillExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7133,7 +7811,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP, "urCommandBufferAppendUSMPrefetchExp", ¶ms); - getContext()->logger.info("---> urCommandBufferAppendUSMPrefetchExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferAppendUSMPrefetchExp"); ur_result_t result = pfnAppendUSMPrefetchExp( hCommandBuffer, pMemory, size, flags, numSyncPointsInWaitList, @@ -7143,10 +7823,13 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( "urCommandBufferAppendUSMPrefetchExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7186,7 +7869,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP, "urCommandBufferAppendUSMAdviseExp", ¶ms); - getContext()->logger.info("---> urCommandBufferAppendUSMAdviseExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferAppendUSMAdviseExp"); ur_result_t result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice, numSyncPointsInWaitList, @@ -7196,10 +7881,13 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( "urCommandBufferAppendUSMAdviseExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7234,7 +7922,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( getContext()->notify_begin(UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP, "urCommandBufferEnqueueExp", ¶ms); - getContext()->logger.info("---> urCommandBufferEnqueueExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferEnqueueExp"); ur_result_t result = pfnEnqueueExp( hCommandBuffer, hQueue, numEventsInWaitList, phEventWaitList, phEvent); @@ -7243,10 +7933,12 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( "urCommandBufferEnqueueExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7269,7 +7961,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainCommandExp( UR_FUNCTION_COMMAND_BUFFER_RETAIN_COMMAND_EXP, "urCommandBufferRetainCommandExp", ¶ms); - getContext()->logger.info("---> urCommandBufferRetainCommandExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferRetainCommandExp"); ur_result_t result = pfnRetainCommandExp(hCommand); @@ -7277,10 +7971,12 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainCommandExp( "urCommandBufferRetainCommandExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_RETAIN_COMMAND_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_RETAIN_COMMAND_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7303,7 +7999,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseCommandExp( UR_FUNCTION_COMMAND_BUFFER_RELEASE_COMMAND_EXP, "urCommandBufferReleaseCommandExp", ¶ms); - getContext()->logger.info("---> urCommandBufferReleaseCommandExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferReleaseCommandExp"); ur_result_t result = pfnReleaseCommandExp(hCommand); @@ -7311,10 +8009,12 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseCommandExp( "urCommandBufferReleaseCommandExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_RELEASE_COMMAND_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_RELEASE_COMMAND_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7340,7 +8040,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp( UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP, "urCommandBufferUpdateKernelLaunchExp", ¶ms); - getContext()->logger.info("---> urCommandBufferUpdateKernelLaunchExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferUpdateKernelLaunchExp"); ur_result_t result = pfnUpdateKernelLaunchExp(hCommand, pUpdateKernelLaunch); @@ -7349,10 +8051,13 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp( UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP, "urCommandBufferUpdateKernelLaunchExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7385,7 +8090,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferGetInfoExp( getContext()->notify_begin(UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP, "urCommandBufferGetInfoExp", ¶ms); - getContext()->logger.info("---> urCommandBufferGetInfoExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferGetInfoExp"); ur_result_t result = pfnGetInfoExp(hCommandBuffer, propName, propSize, pPropValue, pPropSizeRet); @@ -7394,10 +8101,12 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferGetInfoExp( "urCommandBufferGetInfoExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7430,7 +8139,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferCommandGetInfoExp( UR_FUNCTION_COMMAND_BUFFER_COMMAND_GET_INFO_EXP, "urCommandBufferCommandGetInfoExp", ¶ms); - getContext()->logger.info("---> urCommandBufferCommandGetInfoExp"); + auto &logger = getContext()->logger; + + logger.info("---> urCommandBufferCommandGetInfoExp"); ur_result_t result = pfnCommandGetInfoExp(hCommand, propName, propSize, pPropValue, pPropSizeRet); @@ -7439,10 +8150,12 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferCommandGetInfoExp( "urCommandBufferCommandGetInfoExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_COMMAND_BUFFER_COMMAND_GET_INFO_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_COMMAND_BUFFER_COMMAND_GET_INFO_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7499,7 +8212,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP, "urEnqueueCooperativeKernelLaunchExp", ¶ms); - getContext()->logger.info("---> urEnqueueCooperativeKernelLaunchExp"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueCooperativeKernelLaunchExp"); ur_result_t result = pfnCooperativeKernelLaunchExp( hQueue, hKernel, workDim, pGlobalWorkOffset, pGlobalWorkSize, @@ -7509,10 +8224,13 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( "urEnqueueCooperativeKernelLaunchExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7543,8 +8261,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP, "urKernelSuggestMaxCooperativeGroupCountExp", ¶ms); - getContext()->logger.info( - "---> urKernelSuggestMaxCooperativeGroupCountExp"); + auto &logger = getContext()->logger; + + logger.info("---> urKernelSuggestMaxCooperativeGroupCountExp"); ur_result_t result = pfnSuggestMaxCooperativeGroupCountExp( hKernel, localWorkSize, dynamicSharedMemorySize, pGroupCountRet); @@ -7554,11 +8273,14 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( "urKernelSuggestMaxCooperativeGroupCountExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, + UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7599,7 +8321,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueTimestampRecordingExp( getContext()->notify_begin(UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP, "urEnqueueTimestampRecordingExp", ¶ms); - getContext()->logger.info("---> urEnqueueTimestampRecordingExp"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueTimestampRecordingExp"); ur_result_t result = pfnTimestampRecordingExp( hQueue, blocking, numEventsInWaitList, phEventWaitList, phEvent); @@ -7608,10 +8332,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueTimestampRecordingExp( "urEnqueueTimestampRecordingExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7663,7 +8389,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp( getContext()->notify_begin(UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP, "urEnqueueKernelLaunchCustomExp", ¶ms); - getContext()->logger.info("---> urEnqueueKernelLaunchCustomExp"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueKernelLaunchCustomExp"); ur_result_t result = pfnKernelLaunchCustomExp( hQueue, hKernel, workDim, pGlobalWorkSize, pLocalWorkSize, @@ -7674,10 +8402,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp( "urEnqueueKernelLaunchCustomExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7703,17 +8433,21 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuildExp( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_PROGRAM_BUILD_EXP, "urProgramBuildExp", ¶ms); - getContext()->logger.info("---> urProgramBuildExp"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramBuildExp"); ur_result_t result = pfnBuildExp(hProgram, numDevices, phDevices, pOptions); getContext()->notify_end(UR_FUNCTION_PROGRAM_BUILD_EXP, "urProgramBuildExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_BUILD_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_BUILD_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7740,7 +8474,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramCompileExp( uint64_t instance = getContext()->notify_begin( UR_FUNCTION_PROGRAM_COMPILE_EXP, "urProgramCompileExp", ¶ms); - getContext()->logger.info("---> urProgramCompileExp"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramCompileExp"); ur_result_t result = pfnCompileExp(hProgram, numDevices, phDevices, pOptions); @@ -7748,10 +8484,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramCompileExp( getContext()->notify_end(UR_FUNCTION_PROGRAM_COMPILE_EXP, "urProgramCompileExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_COMPILE_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_PROGRAM_COMPILE_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7786,7 +8524,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramLinkExp( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_PROGRAM_LINK_EXP, "urProgramLinkExp", ¶ms); - getContext()->logger.info("---> urProgramLinkExp"); + auto &logger = getContext()->logger; + + logger.info("---> urProgramLinkExp"); ur_result_t result = pfnLinkExp(hContext, numDevices, phDevices, count, phPrograms, pOptions, phProgram); @@ -7794,10 +8534,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramLinkExp( getContext()->notify_end(UR_FUNCTION_PROGRAM_LINK_EXP, "urProgramLinkExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_LINK_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_LINK_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7819,17 +8561,21 @@ __urdlllocal ur_result_t UR_APICALL urUSMImportExp( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_USM_IMPORT_EXP, "urUSMImportExp", ¶ms); - getContext()->logger.info("---> urUSMImportExp"); + auto &logger = getContext()->logger; + + logger.info("---> urUSMImportExp"); ur_result_t result = pfnImportExp(hContext, pMem, size); getContext()->notify_end(UR_FUNCTION_USM_IMPORT_EXP, "urUSMImportExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_IMPORT_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_IMPORT_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7850,17 +8596,21 @@ __urdlllocal ur_result_t UR_APICALL urUSMReleaseExp( uint64_t instance = getContext()->notify_begin(UR_FUNCTION_USM_RELEASE_EXP, "urUSMReleaseExp", ¶ms); - getContext()->logger.info("---> urUSMReleaseExp"); + auto &logger = getContext()->logger; + + logger.info("---> urUSMReleaseExp"); ur_result_t result = pfnReleaseExp(hContext, pMem); getContext()->notify_end(UR_FUNCTION_USM_RELEASE_EXP, "urUSMReleaseExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_RELEASE_EXP, - ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_RELEASE_EXP, + ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7885,7 +8635,9 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PEnablePeerAccessExp( getContext()->notify_begin(UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP, "urUsmP2PEnablePeerAccessExp", ¶ms); - getContext()->logger.info("---> urUsmP2PEnablePeerAccessExp"); + auto &logger = getContext()->logger; + + logger.info("---> urUsmP2PEnablePeerAccessExp"); ur_result_t result = pfnEnablePeerAccessExp(commandDevice, peerDevice); @@ -7893,10 +8645,12 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PEnablePeerAccessExp( "urUsmP2PEnablePeerAccessExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7921,7 +8675,9 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PDisablePeerAccessExp( getContext()->notify_begin(UR_FUNCTION_USM_P2P_DISABLE_PEER_ACCESS_EXP, "urUsmP2PDisablePeerAccessExp", ¶ms); - getContext()->logger.info("---> urUsmP2PDisablePeerAccessExp"); + auto &logger = getContext()->logger; + + logger.info("---> urUsmP2PDisablePeerAccessExp"); ur_result_t result = pfnDisablePeerAccessExp(commandDevice, peerDevice); @@ -7929,10 +8685,12 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PDisablePeerAccessExp( "urUsmP2PDisablePeerAccessExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_USM_P2P_DISABLE_PEER_ACCESS_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_USM_P2P_DISABLE_PEER_ACCESS_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -7969,7 +8727,9 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp( getContext()->notify_begin(UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP, "urUsmP2PPeerAccessGetInfoExp", ¶ms); - getContext()->logger.info("---> urUsmP2PPeerAccessGetInfoExp"); + auto &logger = getContext()->logger; + + logger.info("---> urUsmP2PPeerAccessGetInfoExp"); ur_result_t result = pfnPeerAccessGetInfoExp(commandDevice, peerDevice, propName, propSize, @@ -7979,10 +8739,12 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp( "urUsmP2PPeerAccessGetInfoExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } @@ -8032,7 +8794,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueNativeCommandExp( getContext()->notify_begin(UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP, "urEnqueueNativeCommandExp", ¶ms); - getContext()->logger.info("---> urEnqueueNativeCommandExp"); + auto &logger = getContext()->logger; + + logger.info("---> urEnqueueNativeCommandExp"); ur_result_t result = pfnNativeCommandExp( hQueue, pfnNativeEnqueue, data, numMemsInMemList, phMemList, @@ -8042,10 +8806,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueNativeCommandExp( "urEnqueueNativeCommandExp", ¶ms, &result, instance); - std::ostringstream args_str; - ur::extras::printFunctionParams( - args_str, UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP, ¶ms); - getContext()->logger.info("({}) -> {};\n", args_str.str(), result); + if (logger.getLevel() <= logger::Level::INFO) { + std::ostringstream args_str; + ur::extras::printFunctionParams( + args_str, UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP, ¶ms); + logger.info("({}) -> {};\n", args_str.str(), result); + } return result; } From a8b89725d42a76f581aafc2eb8859c0c99c91ac7 Mon Sep 17 00:00:00 2001 From: omarahmed1111 Date: Fri, 20 Sep 2024 15:00:29 +0100 Subject: [PATCH 3/3] bump UR version to 0.10.6 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c539dc080b..9944f61412 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception cmake_minimum_required(VERSION 3.20.0 FATAL_ERROR) -project(unified-runtime VERSION 0.10.5) +project(unified-runtime VERSION 0.10.6) # Check if unified runtime is built as a standalone project. if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR UR_STANDALONE_BUILD)