diff --git a/unified-runtime/scripts/templates/trcddi.cpp.mako b/unified-runtime/scripts/templates/trcddi.cpp.mako index ca910bfa32e7..4c7ba67813da 100644 --- a/unified-runtime/scripts/templates/trcddi.cpp.mako +++ b/unified-runtime/scripts/templates/trcddi.cpp.mako @@ -48,7 +48,7 @@ namespace ur_tracing_layer uint64_t instance = getContext()->notify_begin(${th.make_func_etor(n, tags, obj)}, "${th.make_func_name(n, tags, obj)}", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> ${th.make_func_name(n, tags, obj)}\n"); + UR_LOG_L(logger, INFO, " ---> ${th.make_func_name(n, tags, obj)}\n"); ${x}_result_t result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} ); @@ -57,7 +57,7 @@ namespace ur_tracing_layer if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, ${th.make_func_etor(n, tags, obj)}, ¶ms); - logger.info(" <--- ${th.make_func_name(n, tags, obj)}({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- ${th.make_func_name(n, tags, obj)}({}) -> {};\n", args_str.str(), result); } return result; diff --git a/unified-runtime/scripts/templates/valddi.cpp.mako b/unified-runtime/scripts/templates/valddi.cpp.mako index 574ea09fb922..f11491f4dc2b 100644 --- a/unified-runtime/scripts/templates/valddi.cpp.mako +++ b/unified-runtime/scripts/templates/valddi.cpp.mako @@ -93,7 +93,7 @@ namespace ur_validation_layer %> %if tp_input_handle_funcs and not is_related_create_get_retain_release_func: if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(${tp['name']})) { - getContext()->refCountContext->logInvalidReference(${tp['name']}); + URLOG_CTX_INVALID_REFERENCE(${tp['name']}); } %endif %endfor @@ -239,7 +239,7 @@ namespace ur_validation_layer ${x}_result_t context_t::tearDown() { if (enableLeakChecking) { - getContext()->refCountContext->logInvalidReferences(); + URLOG_CTX_INVALID_REFERENCES(); } return ${X}_RESULT_SUCCESS; diff --git a/unified-runtime/source/CMakeLists.txt b/unified-runtime/source/CMakeLists.txt index f0dd315313e7..4a444dbc7c65 100644 --- a/unified-runtime/source/CMakeLists.txt +++ b/unified-runtime/source/CMakeLists.txt @@ -6,6 +6,9 @@ add_definitions(-DUR_VERSION="${PROJECT_VERSION_MAJOR}") add_definitions(-DUR_VALIDATION_LAYER_SUPPORTED_VERSION="${PROJECT_VERSION_MAJOR}") +string(LENGTH "${CMAKE_SOURCE_DIR}/" SRC_PATH_SIZE) +add_definitions("-DSRC_PATH_SIZE=${SRC_PATH_SIZE}") # for nicer log messages + add_subdirectory(common) add_subdirectory(loader) add_subdirectory(mock) diff --git a/unified-runtime/source/adapters/cuda/common.cpp b/unified-runtime/source/adapters/cuda/common.cpp index 8363ad156d5b..dff84ae40b43 100644 --- a/unified-runtime/source/adapters/cuda/common.cpp +++ b/unified-runtime/source/adapters/cuda/common.cpp @@ -71,7 +71,7 @@ void checkErrorUR(CUresult Result, const char *Function, int Line, << "\n\tDescription: " << ErrorString << "\n\tFunction: " << Function << "\n\tSource Location: " << File << ":" << Line << "\n"; - logger::error("{}", SS.str()); + UR_LOG(ERR, "{}", SS.str()); if (std::getenv("PI_CUDA_ABORT") != nullptr || std::getenv("UR_CUDA_ABORT") != nullptr) { @@ -95,7 +95,7 @@ void checkErrorUR(nvmlReturn_t Result, const char *Function, int Line, << "\n\tDescription: " << ErrorString << "\n\tFunction: " << Function << "\n\tSource Location: " << File << ":" << Line << "\n"; - logger::error("{}", SS.str()); + UR_LOG(ERR, "{}", SS.str()); if (std::getenv("PI_CUDA_ABORT") != nullptr || std::getenv("UR_CUDA_ABORT") != nullptr) { @@ -115,7 +115,7 @@ void checkErrorUR(ur_result_t Result, const char *Function, int Line, SS << "\nUR ERROR:" << "\n\tValue: " << Result << "\n\tFunction: " << Function << "\n\tSource Location: " << File << ":" << Line << "\n"; - logger::error("{}", SS.str()); + UR_LOG(ERR, "{}", SS.str()); if (std::getenv("PI_CUDA_ABORT") != nullptr) { std::abort(); diff --git a/unified-runtime/source/adapters/cuda/device.cpp b/unified-runtime/source/adapters/cuda/device.cpp index 77be26a13604..cd8b23b02911 100644 --- a/unified-runtime/source/adapters/cuda/device.cpp +++ b/unified-runtime/source/adapters/cuda/device.cpp @@ -286,7 +286,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, } else if (std::getenv("SYCL_UR_CUDA_ENABLE_IMAGE_SUPPORT") != nullptr) { Enabled = true; } else { - logger::always( + UR_LOG( + QUIET, "Images are not fully supported by the CUDA BE, their support is " "disabled by default. Their partial support can be activated by " "setting SYCL_UR_CUDA_ENABLE_IMAGE_SUPPORT environment variable at " diff --git a/unified-runtime/source/adapters/cuda/enqueue.cpp b/unified-runtime/source/adapters/cuda/enqueue.cpp index 9ef06a2012a7..d3bb6e887095 100644 --- a/unified-runtime/source/adapters/cuda/enqueue.cpp +++ b/unified-runtime/source/adapters/cuda/enqueue.cpp @@ -97,8 +97,8 @@ ur_result_t setCuMemAdvise(CUdeviceptr DevPtr, size_t Size, for (auto &UnmappedFlag : UnmappedMemAdviceFlags) { if (URAdviceFlags & UnmappedFlag) { - logger::warning("Memory advice ignored because the CUDA backend does not " - "support some of the specified flags."); + UR_LOG(WARN, "Memory advice ignored because the CUDA backend does not " + "support some of the specified flags."); return UR_RESULT_SUCCESS; } } @@ -1608,8 +1608,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch( // for managed memory. Therefore, ignore prefetch hint if concurrent managed // memory access is not available. if (!getAttribute(Device, CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS)) { - logger::warning("Prefetch hint ignored as device does not support " - "concurrent managed access."); + UR_LOG(WARN, "Prefetch hint ignored as device does not support " + "concurrent managed access."); return UR_RESULT_SUCCESS; } @@ -1617,7 +1617,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch( UR_CHECK_ERROR(cuPointerGetAttribute( &IsManaged, CU_POINTER_ATTRIBUTE_IS_MANAGED, (CUdeviceptr)pMem)); if (!IsManaged) { - logger::warning("Prefetch hint ignored as prefetch only works with USM."); + UR_LOG(WARN, "Prefetch hint ignored as prefetch only works with USM."); return UR_RESULT_SUCCESS; } @@ -1668,8 +1668,8 @@ urEnqueueUSMAdvise(ur_queue_handle_t hQueue, const void *pMem, size_t size, (advice & UR_USM_ADVICE_FLAG_DEFAULT)) { ur_device_handle_t Device = hQueue->getDevice(); if (!getAttribute(Device, CU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS)) { - logger::warning("Mem advise ignored as device does not support " - "concurrent managed access."); + UR_LOG(WARN, "Mem advise ignored as device does not support " + "concurrent managed access."); return UR_RESULT_SUCCESS; } diff --git a/unified-runtime/source/adapters/cuda/image.cpp b/unified-runtime/source/adapters/cuda/image.cpp index 23c7b1423108..3469e51d9529 100644 --- a/unified-runtime/source/adapters/cuda/image.cpp +++ b/unified-runtime/source/adapters/cuda/image.cpp @@ -803,8 +803,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( // we don't support copying between different image types. if (pSrcImageDesc->type != pDstImageDesc->type) { - logger::error( - "Unsupported copy operation between different type of images"); + UR_LOG(ERR, + "Unsupported copy operation between different type of images"); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/cuda/usm.cpp b/unified-runtime/source/adapters/cuda/usm.cpp index 240ef55792a2..de7bb9f35a1a 100644 --- a/unified-runtime/source/adapters/cuda/usm.cpp +++ b/unified-runtime/source/adapters/cuda/usm.cpp @@ -361,8 +361,8 @@ ur_usm_pool_handle_t_::ur_usm_pool_handle_t_(ur_context_handle_t Context, // Otherwise, do nothing. // Set maximum size is effectively ignored. if (Limits->maxPoolableSize > 0) - logger::warning("The memory pool maximum size feature requires CUDA " - "12.2 or later.\n"); + UR_LOG(WARN, "The memory pool maximum size feature requires CUDA " + "12.2 or later.\n"); #endif maxSize = Limits->maxPoolableSize; size_t chunkSize = 33554432; // 32MB diff --git a/unified-runtime/source/adapters/hip/common.cpp b/unified-runtime/source/adapters/hip/common.cpp index 28bd36aad723..7e6b5f07c53d 100644 --- a/unified-runtime/source/adapters/hip/common.cpp +++ b/unified-runtime/source/adapters/hip/common.cpp @@ -86,7 +86,7 @@ void checkErrorUR(amd_comgr_status_t Result, const char *Function, int Line, << "\n\tDescription: " << ErrorString << "\n\tFunction: " << Function << "\n\tSource Location: " << File << ":" << Line << "\n"; - logger::error("{}", SS.str()); + UR_LOG(ERR, "{}", SS.str()); if (std::getenv("PI_HIP_ABORT") != nullptr || std::getenv("UR_HIP_ABORT") != nullptr) { @@ -113,7 +113,7 @@ void checkErrorUR(hipError_t Result, const char *Function, int Line, << "\n\tDescription: " << ErrorString << "\n\tFunction: " << Function << "\n\tSource Location: " << File << ":" << Line << "\n"; - logger::error("{}", SS.str()); + UR_LOG(ERR, "{}", SS.str()); if (std::getenv("PI_HIP_ABORT") != nullptr || std::getenv("UR_HIP_ABORT") != nullptr) { @@ -133,7 +133,7 @@ void checkErrorUR(ur_result_t Result, const char *Function, int Line, SS << "\nUR HIP ERROR:" << "\n\tValue: " << Result << "\n\tFunction: " << Function << "\n\tSource Location: " << File << ":" << Line << "\n"; - logger::error("{}", SS.str()); + UR_LOG(ERR, "{}", SS.str()); if (std::getenv("PI_HIP_ABORT") != nullptr || std::getenv("UR_HIP_ABORT") != nullptr) { diff --git a/unified-runtime/source/adapters/hip/enqueue.cpp b/unified-runtime/source/adapters/hip/enqueue.cpp index fefa8f2d0b7d..f24aaedeaf12 100644 --- a/unified-runtime/source/adapters/hip/enqueue.cpp +++ b/unified-runtime/source/adapters/hip/enqueue.cpp @@ -1374,8 +1374,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch( // mem_advise. if (!Device->getManagedMemSupport()) { releaseEvent(); - logger::warning("mem_advise ignored as device does not support " - "managed memory access."); + UR_LOG(WARN, "mem_advise ignored as device does not support " + "managed memory access."); return UR_RESULT_SUCCESS; } @@ -1389,7 +1389,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch( // async prefetch requires USM pointer (or hip SVM) to work. if (!attribs.isManaged) { releaseEvent(); - logger::warning("Prefetch hint ignored as prefetch only works with USM."); + UR_LOG(WARN, "Prefetch hint ignored as prefetch only works with USM."); return UR_RESULT_SUCCESS; } @@ -1444,8 +1444,8 @@ urEnqueueUSMAdvise(ur_queue_handle_t hQueue, const void *pMem, size_t size, // mem_advise. if (!Device->getManagedMemSupport()) { releaseEvent(); - logger::warning("mem_advise ignored as device does not support " - "managed memory access."); + UR_LOG(WARN, "mem_advise ignored as device does not support " + "managed memory access."); return UR_RESULT_SUCCESS; } @@ -1461,8 +1461,8 @@ urEnqueueUSMAdvise(ur_queue_handle_t hQueue, const void *pMem, size_t size, UR_USM_ADVICE_FLAG_DEFAULT)) { if (!Device->getConcurrentManagedAccess()) { releaseEvent(); - logger::warning("mem_advise ignored as device does not support " - "concurrent memory access."); + UR_LOG(WARN, "mem_advise ignored as device does not support " + "concurrent memory access."); return UR_RESULT_SUCCESS; } @@ -1481,8 +1481,8 @@ urEnqueueUSMAdvise(ur_queue_handle_t hQueue, const void *pMem, size_t size, if (auto ptrAttribs = getPointerAttributes(pMem); !ptrAttribs || !ptrAttribs->isManaged) { releaseEvent(); - logger::warning("mem_advise is ignored as the pointer argument is not " - "a shared USM pointer."); + UR_LOG(WARN, "mem_advise is ignored as the pointer argument is not " + "a shared USM pointer."); return UR_RESULT_SUCCESS; } @@ -1510,8 +1510,8 @@ urEnqueueUSMAdvise(ur_queue_handle_t hQueue, const void *pMem, size_t size, // the runtime. if (Result == UR_RESULT_ERROR_INVALID_ENUMERATION) { releaseEvent(); - logger::warning("mem_advise is ignored as the advice argument is not " - "supported by this device."); + UR_LOG(WARN, "mem_advise is ignored as the advice argument is not " + "supported by this device."); return UR_RESULT_SUCCESS; } UR_CHECK_ERROR(Result); diff --git a/unified-runtime/source/adapters/hip/image.cpp b/unified-runtime/source/adapters/hip/image.cpp index 40d69e4cd91e..abf724c20484 100644 --- a/unified-runtime/source/adapters/hip/image.cpp +++ b/unified-runtime/source/adapters/hip/image.cpp @@ -822,8 +822,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( // we don't support copying between different image types. if (pSrcImageDesc->type != pDstImageDesc->type) { - logger::error( - "Unsupported copy operation between different type of images"); + UR_LOG(ERR, + "Unsupported copy operation between different type of images"); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/level_zero/adapter.cpp b/unified-runtime/source/adapters/level_zero/adapter.cpp index 978439ecb9c8..e90cb45a8923 100644 --- a/unified-runtime/source/adapters/level_zero/adapter.cpp +++ b/unified-runtime/source/adapters/level_zero/adapter.cpp @@ -163,7 +163,7 @@ ur_result_t initPlatforms(PlatformVec &platforms, ZE2UR_CALL(zeDriverGet, (&ZeDriverGetCount, ZeDriverGetHandles.data())); } if (ZeDriverGetCount == 0 && GlobalAdapter->ZeInitDriversCount == 0) { - logger::error("\nNo Valid L0 Drivers found.\n"); + UR_LOG(ERR, "\nNo Valid L0 Drivers found.\n"); return UR_RESULT_SUCCESS; } @@ -188,9 +188,10 @@ ur_result_t initPlatforms(PlatformVec &platforms, // newer drivers. if (ZeDriverGetProperties.driverVersion != ZeInitDriverProperties.driverVersion) { - logger::debug("\nzeDriverHandle {} added to the zeInitDrivers list " - "of possible handles.\n", - ZeDriverGetHandles[Y]); + UR_LOG(DEBUG, + "\nzeDriverHandle {} added to the zeInitDrivers list " + "of possible handles.\n", + ZeDriverGetHandles[Y]); ZeDrivers.push_back(ZeDriverGetHandles[Y]); } } @@ -201,7 +202,7 @@ ur_result_t initPlatforms(PlatformVec &platforms, ZeDrivers.assign(ZeDriverGetHandles.begin(), ZeDriverGetHandles.end()); } ZeDriverCount = ZeDrivers.size(); - logger::debug("\n{} L0 Drivers found.\n", ZeDriverCount); + UR_LOG(DEBUG, "\n{} L0 Drivers found.\n", ZeDriverCount); for (uint32_t I = 0; I < ZeDriverCount; ++I) { // Keep track of the first platform init for this Driver bool DriverPlatformInit = false; @@ -359,7 +360,8 @@ ur_adapter_handle_t_::ur_adapter_handle_t_() } if (getenv("SYCL_ENABLE_PCI") != nullptr) { - logger::warning( + UR_LOG( + WARN, "WARNING: SYCL_ENABLE_PCI is deprecated and no longer needed.\n"); } @@ -381,13 +383,13 @@ ur_adapter_handle_t_::ur_adapter_handle_t_() if (UrL0InitAllDrivers) { L0InitFlags |= ZE_INIT_FLAG_VPU_ONLY; } - logger::debug("\nzeInit with flags value of {}\n", - static_cast(L0InitFlags)); + UR_LOG(DEBUG, "\nzeInit with flags value of {}\n", + static_cast(L0InitFlags)); GlobalAdapter->ZeInitResult = ZE_CALL_NOCHECK(zeInit, (L0InitFlags)); if (GlobalAdapter->ZeInitResult != ZE_RESULT_SUCCESS) { const char *ErrorString = "Unknown"; zeParseError(GlobalAdapter->ZeInitResult, ErrorString); - logger::error("\nzeInit failed with {}\n", ErrorString); + UR_LOG(ERR, "\nzeInit failed with {}\n", ErrorString); } bool useInitDrivers = false; @@ -403,9 +405,9 @@ ur_adapter_handle_t_::ur_adapter_handle_t_() if (strncmp(versions[i].component_name, "loader", strlen("loader")) == 0) { loader_version = versions[i].component_lib_version; - logger::debug("\nLevel Zero Loader Version: {}.{}.{}\n", - loader_version.major, loader_version.minor, - loader_version.patch); + UR_LOG(DEBUG, "\nLevel Zero Loader Version: {}.{}.{}\n", + loader_version.major, loader_version.minor, + loader_version.patch); break; } } @@ -428,8 +430,8 @@ ur_adapter_handle_t_::ur_adapter_handle_t_() GlobalAdapter->processHandle, "zeInitDrivers"); #endif if (GlobalAdapter->initDriversFunctionPtr) { - logger::debug("\nzeInitDrivers with flags value of {}\n", - static_cast(GlobalAdapter->InitDriversDesc.flags)); + UR_LOG(DEBUG, "\nzeInitDrivers with flags value of {}\n", + static_cast(GlobalAdapter->InitDriversDesc.flags)); GlobalAdapter->ZeInitDriversResult = ZE_CALL_NOCHECK(GlobalAdapter->initDriversFunctionPtr, (&GlobalAdapter->ZeInitDriversCount, nullptr, @@ -439,7 +441,7 @@ ur_adapter_handle_t_::ur_adapter_handle_t_() } else { const char *ErrorString = "Unknown"; zeParseError(GlobalAdapter->ZeInitDriversResult, ErrorString); - logger::error("\nzeInitDrivers failed with {}\n", ErrorString); + UR_LOG(ERR, "\nzeInitDrivers failed with {}\n", ErrorString); } } } @@ -457,12 +459,12 @@ ur_adapter_handle_t_::ur_adapter_handle_t_() // Absorb the ZE_RESULT_ERROR_UNINITIALIZED and just return 0 Platforms. if (*GlobalAdapter->ZeResult == ZE_RESULT_ERROR_UNINITIALIZED) { - logger::error("Level Zero Uninitialized\n"); + UR_LOG(ERR, "Level Zero Uninitialized\n"); result = std::move(platforms); return; } if (*GlobalAdapter->ZeResult != ZE_RESULT_SUCCESS) { - logger::error("Level Zero initialization failure\n"); + UR_LOG(ERR, "Level Zero initialization failure\n"); result = ze2urResult(*GlobalAdapter->ZeResult); return; @@ -509,8 +511,8 @@ ur_adapter_handle_t_::ur_adapter_handle_t_() GlobalAdapter->getSysManDriversFunctionPtr && GlobalAdapter->sysManInitFunctionPtr) { ze_init_flags_t L0ZesInitFlags = 0; - logger::debug("\nzesInit with flags value of {}\n", - static_cast(L0ZesInitFlags)); + UR_LOG(DEBUG, "\nzesInit with flags value of {}\n", + static_cast(L0ZesInitFlags)); GlobalAdapter->ZesResult = ZE_CALL_NOCHECK( GlobalAdapter->sysManInitFunctionPtr, (L0ZesInitFlags)); } else { diff --git a/unified-runtime/source/adapters/level_zero/async_alloc.cpp b/unified-runtime/source/adapters/level_zero/async_alloc.cpp index 6a858338ea23..84b410376ca4 100644 --- a/unified-runtime/source/adapters/level_zero/async_alloc.cpp +++ b/unified-runtime/source/adapters/level_zero/async_alloc.cpp @@ -92,7 +92,7 @@ static ur_result_t enqueueUSMAllocHelper( CommandType = UR_COMMAND_ENQUEUE_USM_SHARED_ALLOC_EXP; break; default: - logger::error("enqueueUSMAllocHelper: unsupported USM type"); + UR_LOG(ERR, "enqueueUSMAllocHelper: unsupported USM type"); throw UR_RESULT_ERROR_UNKNOWN; } UR_CALL(createEventAndAssociateQueue(Queue, Event, CommandType, CommandList, diff --git a/unified-runtime/source/adapters/level_zero/command_buffer.cpp b/unified-runtime/source/adapters/level_zero/command_buffer.cpp index 6ae1f31bcf78..2ade3ca460c9 100644 --- a/unified-runtime/source/adapters/level_zero/command_buffer.cpp +++ b/unified-runtime/source/adapters/level_zero/command_buffer.cpp @@ -19,7 +19,7 @@ */ // Print the name of a variable and its value in the L0 debug log -#define DEBUG_LOG(VAR) logger::debug(#VAR " {}", VAR); +#define DEBUG_LOG(VAR) UR_LOG(DEBUG, #VAR " {}", VAR); namespace { @@ -44,17 +44,18 @@ bool checkImmediateAppendSupport(ur_context_handle_t Context, const bool EnableAppendPath = std::atoi(UrRet) == 1; if (EnableAppendPath && !Device->ImmCommandListUsed) { - logger::error("{} is set but immediate command-lists are currently " - "disabled. Immediate command-lists are " - "required to use the immediate append path.", - AppendEnvVarName); + UR_LOG(ERR, + "{} is set but immediate command-lists are currently " + "disabled. Immediate command-lists are " + "required to use the immediate append path.", + AppendEnvVarName); std::abort(); } if (EnableAppendPath && !DriverSupportsImmediateAppend) { - logger::error("{} is set but " - "the current driver does not support the " - "zeCommandListImmediateAppendCommandListsExp entrypoint.", - AppendEnvVarName); + UR_LOG(ERR, + "{} is set but the current driver does not support the " + "zeCommandListImmediateAppendCommandListsExp entrypoint.", + AppendEnvVarName); std::abort(); } @@ -1846,7 +1847,7 @@ ur_result_t validateCommandDesc( auto SupportedFeatures = CommandBuffer->Device->ZeDeviceMutableCmdListsProperties ->mutableCommandFlags; - logger::debug("Mutable features supported by device {}", SupportedFeatures); + UR_LOG(DEBUG, "Mutable features supported by device {}", SupportedFeatures); auto Command = static_cast(CommandDesc.hCommand); UR_ASSERT(CommandBuffer == Command->CommandBuffer, @@ -1875,7 +1876,7 @@ ur_result_t validateCommandDesc( if (NewGlobalWorkOffset) { if (!CommandBuffer->Context->getPlatform() ->ZeDriverGlobalOffsetExtensionFound) { - logger::error("No global offset extension found on this driver"); + UR_LOG(ERR, "No global offset extension found on this driver"); return UR_RESULT_ERROR_INVALID_VALUE; } } diff --git a/unified-runtime/source/adapters/level_zero/common.cpp b/unified-runtime/source/adapters/level_zero/common.cpp index 94d864108e68..dd4c27c0f67d 100644 --- a/unified-runtime/source/adapters/level_zero/common.cpp +++ b/unified-runtime/source/adapters/level_zero/common.cpp @@ -76,8 +76,9 @@ bool setEnvVar(const char *name, const char *value) { int Res = setenv(name, value, 1); #endif if (Res != 0) { - logger::debug( - "UR L0 Adapter was unable to set the environment variable: {}", name); + UR_LOG(DEBUG, + "UR L0 Adapter was unable to set the environment variable: {}", + name); return false; } return true; @@ -138,7 +139,7 @@ void zeParseError(ze_result_t ZeError, const char *&ErrorString) { ze_result_t ZeCall::doCall(ze_result_t ZeResult, const char *ZeName, const char *ZeArgs, bool TraceError) { - logger::debug("ZE ---> {}{}", ZeName, ZeArgs); + UR_LOG(DEBUG, "ZE ---> {}{}", ZeName, ZeArgs); if (ZeResult == ZE_RESULT_SUCCESS) { if (UrL0LeaksDebug) { @@ -150,7 +151,7 @@ ze_result_t ZeCall::doCall(ze_result_t ZeResult, const char *ZeName, if (TraceError) { const char *ErrorString = "Unknown"; zeParseError(ZeResult, ErrorString); - logger::error("Error ({}) in {}", ErrorString, ZeName); + UR_LOG(ERR, "Error ({}) in {}", ErrorString, ZeName); } return ZeResult; } diff --git a/unified-runtime/source/adapters/level_zero/common.hpp b/unified-runtime/source/adapters/level_zero/common.hpp index ad77ae8d22ab..523751a8a575 100644 --- a/unified-runtime/source/adapters/level_zero/common.hpp +++ b/unified-runtime/source/adapters/level_zero/common.hpp @@ -45,8 +45,8 @@ struct _ur_platform_handle_t; } } catch (...) { } - logger::debug( - "ZE ---> checkL0LoaderTeardown: Loader is in teardown or is unstable"); + UR_LOG(DEBUG, + "ZE ---> checkL0LoaderTeardown: Loader is in teardown or is unstable"); return false; } diff --git a/unified-runtime/source/adapters/level_zero/context.cpp b/unified-runtime/source/adapters/level_zero/context.cpp index 143d46080f59..3209b8b78915 100644 --- a/unified-runtime/source/adapters/level_zero/context.cpp +++ b/unified-runtime/source/adapters/level_zero/context.cpp @@ -167,7 +167,8 @@ ur_result_t urContextSetExtendedDeleter( ur_context_extended_deleter_t /*Deleter*/, /// [in][out][optional] pointer to data to be passed to callback. void * /*UserData*/) { - logger::error(logger::LegacyMessage("[UR][L0] {} function not implemented!"), + UR_LOG_LEGACY(ERR, + logger::LegacyMessage("[UR][L0] {} function not implemented!"), "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -205,7 +206,8 @@ ur_result_t ur_context_handle_t_::initialize() { if (Device->Platform->allowDriverInOrderLists( true /*Only Allow Driver In Order List if requested*/) && Device->useDriverCounterBasedEvents()) { - logger::debug( + UR_LOG( + DEBUG, "L0 Synchronous Immediate Command List needed with In Order property."); ZeCommandQueueDesc.flags |= ZE_COMMAND_QUEUE_FLAG_IN_ORDER; } @@ -457,8 +459,8 @@ ur_result_t ur_context_handle_t_::getFreeSlotInExistingOrNewPool( ZeEventPoolDesc.flags |= ZE_EVENT_POOL_FLAG_HOST_VISIBLE; if (ProfilingEnabled) ZeEventPoolDesc.flags |= ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP; - logger::debug("ze_event_pool_desc_t flags set to: {}", - ZeEventPoolDesc.flags); + UR_LOG(DEBUG, "ze_event_pool_desc_t flags set to: {}", + ZeEventPoolDesc.flags); if (CounterBasedEventEnabled) { if (UsingImmCmdList) { counterBasedExt.flags = ZE_EVENT_POOL_COUNTER_BASED_EXP_FLAG_IMMEDIATE; @@ -466,8 +468,8 @@ ur_result_t ur_context_handle_t_::getFreeSlotInExistingOrNewPool( counterBasedExt.flags = ZE_EVENT_POOL_COUNTER_BASED_EXP_FLAG_NON_IMMEDIATE; } - logger::debug("ze_event_pool_desc_t counter based flags set to: {}", - counterBasedExt.flags); + UR_LOG(DEBUG, "ze_event_pool_desc_t counter based flags set to: {}", + counterBasedExt.flags); if (InterruptBasedEventEnabled) { counterBasedExt.pNext = &eventSyncMode; } @@ -507,10 +509,11 @@ ur_event_handle_t ur_context_handle_t_::getEventFromContextCache( getEventCache(HostVisible, WithProfiling, Device, CounterBasedEventEnabled, InterruptBasedEventEnabled); if (Cache->empty()) { - logger::info("Cache empty (Host Visible: {}, Profiling: {}, Counter: {}, " - "Interrupt: {}, Device: {})", - HostVisible, WithProfiling, CounterBasedEventEnabled, - InterruptBasedEventEnabled, Device); + UR_LOG(INFO, + "Cache empty (Host Visible: {}, Profiling: {}, Counter: {}, " + "Interrupt: {}, Device: {})", + HostVisible, WithProfiling, CounterBasedEventEnabled, + InterruptBasedEventEnabled, Device); return nullptr; } @@ -521,11 +524,12 @@ ur_event_handle_t ur_context_handle_t_::getEventFromContextCache( // We have to reset event before using it. Event->reset(); - logger::info("Using {} event (Host Visible: {}, Profiling: {}, Counter: {}, " - "Interrupt: {}, Device: {}) from cache {}", - Event, Event->HostVisibleEvent, Event->isProfilingEnabled(), - Event->CounterBasedEventsEnabled, - Event->InterruptBasedEventsEnabled, Device, Cache); + UR_LOG(INFO, + "Using {} event (Host Visible: {}, Profiling: {}, Counter: {}, " + "Interrupt: {}, Device: {}) from cache {}", + Event, Event->HostVisibleEvent, Event->isProfilingEnabled(), + Event->CounterBasedEventsEnabled, Event->InterruptBasedEventsEnabled, + Device, Cache); return Event; } @@ -541,10 +545,11 @@ void ur_context_handle_t_::addEventToContextCache(ur_event_handle_t Event) { auto Cache = getEventCache( Event->isHostVisible(), Event->isProfilingEnabled(), Device, Event->CounterBasedEventsEnabled, Event->InterruptBasedEventsEnabled); - logger::info("Inserting {} event (Host Visible: {}, Profiling: {}, Counter: " - "{}, Device: {}) into cache {}", - Event, Event->HostVisibleEvent, Event->isProfilingEnabled(), - Event->CounterBasedEventsEnabled, Device, Cache); + UR_LOG(INFO, + "Inserting {} event (Host Visible: {}, Profiling: {}, Counter: {}, " + "Device: {}) into cache {}", + Event, Event->HostVisibleEvent, Event->isProfilingEnabled(), + Event->CounterBasedEventsEnabled, Device, Cache); Cache->emplace_back(Event); } diff --git a/unified-runtime/source/adapters/level_zero/device.cpp b/unified-runtime/source/adapters/level_zero/device.cpp index e160d4cdfa84..da7de39f0bc0 100644 --- a/unified-runtime/source/adapters/level_zero/device.cpp +++ b/unified-runtime/source/adapters/level_zero/device.cpp @@ -52,8 +52,8 @@ getRangeOfAllowedCopyEngines(const ur_device_handle_t &Device) { int UpperCopyEngineIndex = std::stoi(CopyEngineRange.substr(pos + 1)); if ((LowerCopyEngineIndex > UpperCopyEngineIndex) || (LowerCopyEngineIndex < -1) || (UpperCopyEngineIndex < -1)) { - logger::error("UR_L0_LEVEL_ZERO_USE_COPY_ENGINE: invalid value provided, " - "default set."); + UR_LOG(ERR, "UR_L0_LEVEL_ZERO_USE_COPY_ENGINE: invalid value provided, " + "default set."); LowerCopyEngineIndex = 0; UpperCopyEngineIndex = INT_MAX; } @@ -141,7 +141,7 @@ ur_result_t urDeviceGet( break; default: Matched = false; - logger::warning("Unknown device type"); + UR_LOG(WARN, "Unknown device type"); break; } @@ -194,8 +194,8 @@ static std::tuple getZesDeviceData(ur_device_handle_t Device) { bool SysManEnv = getenv_tobool("ZES_ENABLE_SYSMAN", false); if ((Device->Platform->ZedeviceToZesDeviceMap.size() == 0) && !SysManEnv) { - logger::error("SysMan support is unavailable on this system. Please " - "check your level zero driver installation."); + UR_LOG(ERR, "SysMan support is unavailable on this system. Please " + "check your level zero driver installation."); return {nullptr, {}, UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION}; } @@ -250,7 +250,7 @@ ur_result_t urDeviceGetInfo( case ZE_DEVICE_TYPE_FPGA: return ReturnValue(UR_DEVICE_TYPE_FPGA); default: - logger::error("This device type is not supported"); + UR_LOG(ERR, "This device type is not supported"); return UR_RESULT_ERROR_INVALID_VALUE; } } @@ -1107,8 +1107,8 @@ ur_result_t urDeviceGetInfo( case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP: case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP: case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP: - logger::error("Unsupported ParamName in urGetDeviceInfo"); - logger::error("ParamName=%{}(0x{})", ParamName, logger::toHex(ParamName)); + UR_LOG(ERR, "Unsupported ParamName in urGetDeviceInfo"); + UR_LOG(ERR, "ParamName=%{}(0x{})", ParamName, logger::toHex(ParamName)); return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; case UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP: { // L0 does not support mipmaps. @@ -1119,8 +1119,8 @@ ur_result_t urDeviceGetInfo( return ReturnValue(false); } case UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP: - logger::error("Unsupported ParamName in urGetDeviceInfo"); - logger::error("ParamName=%{}(0x{})", ParamName, logger::toHex(ParamName)); + UR_LOG(ERR, "Unsupported ParamName in urGetDeviceInfo"); + UR_LOG(ERR, "ParamName=%{}(0x{})", ParamName, logger::toHex(ParamName)); return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; case UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP: { // L0 does not support creation of images from individual mipmap levels. @@ -1338,9 +1338,9 @@ ur_result_t urDeviceGetInfo( } } default: - logger::error("Unsupported ParamName in urGetDeviceInfo"); - logger::error("ParamNameParamName={}(0x{})", ParamName, - logger::toHex(ParamName)); + UR_LOG(ERR, "Unsupported ParamName in urGetDeviceInfo"); + UR_LOG(ERR, "ParamNameParamName={}(0x{})", ParamName, + logger::toHex(ParamName)); return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; } @@ -1651,8 +1651,8 @@ ur_device_handle_t_::useImmediateCommandLists() { } } - logger::info("NOTE: L0 Immediate CommandList Setting: {}", - ImmediateCommandlistsSetting); + UR_LOG(INFO, "NOTE: L0 Immediate CommandList Setting: {}", + ImmediateCommandlistsSetting); switch (ImmediateCommandlistsSetting) { case 0: @@ -1793,8 +1793,10 @@ ur_result_t ur_device_handle_t_::initialize(int SubSubDeviceOrdinal, if (numQueueGroups == 0) { return UR_RESULT_ERROR_UNKNOWN; } - logger::info(logger::LegacyMessage("NOTE: Number of queue groups = {}"), - "Number of queue groups = {}", numQueueGroups); + UR_LOG_LEGACY(INFO, + logger::LegacyMessage("NOTE: Number of queue groups = {}"), + "Number of queue groups = {}", numQueueGroups); + std::vector> QueueGroupProperties(numQueueGroups); ZE2UR_CALL(zeDeviceGetCommandQueueGroupProperties, @@ -1847,22 +1849,26 @@ ur_result_t ur_device_handle_t_::initialize(int SubSubDeviceOrdinal, } } if (QueueGroup[queue_group_info_t::MainCopy].ZeOrdinal < 0) - logger::info(logger::LegacyMessage( - "NOTE: main blitter/copy engine is not available"), - "main blitter/copy engine is not available"); + UR_LOG_LEGACY(INFO, + logger::LegacyMessage( + "NOTE: main blitter/copy engine is not available"), + "main blitter/copy engine is not available") else - logger::info(logger::LegacyMessage( - "NOTE: main blitter/copy engine is available"), - "main blitter/copy engine is available"); + UR_LOG_LEGACY(INFO, + logger::LegacyMessage( + "NOTE: main blitter/copy engine is available"), + "main blitter/copy engine is available") if (QueueGroup[queue_group_info_t::LinkCopy].ZeOrdinal < 0) - logger::info(logger::LegacyMessage( - "NOTE: link blitter/copy engines are not available"), - "link blitter/copy engines are not available"); + UR_LOG_LEGACY(INFO, + logger::LegacyMessage( + "NOTE: link blitter/copy engines are not available"), + "link blitter/copy engines are not available") else - logger::info(logger::LegacyMessage( - "NOTE: link blitter/copy engines are available"), - "link blitter/copy engines are available"); + UR_LOG_LEGACY(INFO, + logger::LegacyMessage( + "NOTE: link blitter/copy engines are available"), + "link blitter/copy engines are available") } } diff --git a/unified-runtime/source/adapters/level_zero/event.cpp b/unified-runtime/source/adapters/level_zero/event.cpp index fc690cf47a31..96459a1d3799 100644 --- a/unified-runtime/source/adapters/level_zero/event.cpp +++ b/unified-runtime/source/adapters/level_zero/event.cpp @@ -29,7 +29,7 @@ void printZeEventList(const ur_ze_event_list_t &UrZeEventList) { for (uint32_t I = 0; I < UrZeEventList.Length; I++) { ss << " " << ur_cast(UrZeEventList.ZeEventList[I]); } - logger::debug(ss.str().c_str()); + UR_LOG(DEBUG, ss.str().c_str()); } } @@ -510,9 +510,8 @@ ur_result_t urEventGetInfo( return ReturnValue(Event->RefCount.load()); } default: - logger::error( - "Unsupported ParamName in urEventGetInfo: ParamName=ParamName={}(0x{})", - PropName, logger::toHex(PropName)); + UR_LOG(ERR, "Unsupported ParamName in urEventGetInfo: ParamName={}(0x{})", + PropName, logger::toHex(PropName)); return UR_RESULT_ERROR_INVALID_VALUE; } @@ -597,11 +596,11 @@ ur_result_t urEventGetProfilingInfo( return ReturnValue(ContextEndTime); } case UR_PROFILING_INFO_COMMAND_COMPLETE: - logger::error("urEventGetProfilingInfo: " - "UR_PROFILING_INFO_COMMAND_COMPLETE not supported"); + UR_LOG(ERR, "urEventGetProfilingInfo: " + "UR_PROFILING_INFO_COMMAND_COMPLETE not supported"); return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; default: - logger::error("urEventGetProfilingInfo: not supported ParamName"); + UR_LOG(ERR, "urEventGetProfilingInfo: not supported ParamName"); return UR_RESULT_ERROR_INVALID_VALUE; } } @@ -664,11 +663,11 @@ ur_result_t urEventGetProfilingInfo( return ReturnValue(ContextEndTime); } case UR_PROFILING_INFO_COMMAND_COMPLETE: - logger::error("urEventGetProfilingInfo: " - "UR_PROFILING_INFO_COMMAND_COMPLETE not supported"); + UR_LOG(ERR, "urEventGetProfilingInfo: " + "UR_PROFILING_INFO_COMMAND_COMPLETE not supported"); return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; default: - logger::error("urEventGetProfilingInfo: not supported ParamName"); + UR_LOG(ERR, "urEventGetProfilingInfo: not supported ParamName"); return UR_RESULT_ERROR_INVALID_VALUE; } } else { @@ -711,11 +710,11 @@ ur_result_t urEventGetProfilingInfo( // return ReturnValue(uint64_t{0}); case UR_PROFILING_INFO_COMMAND_COMPLETE: - logger::error("urEventGetProfilingInfo: UR_PROFILING_INFO_COMMAND_COMPLETE " - "not supported"); + UR_LOG(ERR, "urEventGetProfilingInfo: UR_PROFILING_INFO_COMMAND_COMPLETE " + "not supported"); return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; default: - logger::error("urEventGetProfilingInfo: not supported ParamName"); + UR_LOG(ERR, "urEventGetProfilingInfo: not supported ParamName"); return UR_RESULT_ERROR_INVALID_VALUE; } @@ -830,7 +829,7 @@ urEventWait(uint32_t NumEvents, die("The host-visible proxy event missing"); ze_event_handle_t ZeEvent = HostVisibleEvent->ZeEvent; - logger::debug("ZeEvent = {}", ur_cast(ZeEvent)); + UR_LOG(DEBUG, "ZeEvent = {}", ur_cast(ZeEvent)); // If this event was an inner batched event, then sync with // the Queue instead of waiting on the event. if (HostVisibleEvent->IsInnerBatchedEvent && Event->ZeBatchedQueue) { @@ -1010,7 +1009,8 @@ ur_result_t urEventSetCallback( ur_event_callback_t /*Notify*/, /// [in][out][optional] pointer to data to be passed to callback. void * /*UserData*/) { - logger::error(logger::LegacyMessage("[UR][L0] {} function not implemented!"), + UR_LOG_LEGACY(ERR, + logger::LegacyMessage("[UR][L0] {} function not implemented!"), "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/level_zero/helpers/image_helpers.cpp b/unified-runtime/source/adapters/level_zero/helpers/image_helpers.cpp index 9da1750e8c1f..a119c915caa0 100644 --- a/unified-runtime/source/adapters/level_zero/helpers/image_helpers.cpp +++ b/unified-runtime/source/adapters/level_zero/helpers/image_helpers.cpp @@ -35,9 +35,9 @@ ur_result_t ze2urImageFormat(const ze_image_desc_t *ZeImageDesc, ZeImageFormatTypeSize = 32; break; default: - logger::error( - "ze2urImageFormat: unsupported image format layout: layout = {}", - ZeImageFormat.layout); + UR_LOG(ERR, + "ze2urImageFormat: unsupported image format layout: layout = {}", + ZeImageFormat.layout); return UR_RESULT_ERROR_INVALID_VALUE; } @@ -54,9 +54,8 @@ ur_result_t ze2urImageFormat(const ze_image_desc_t *ZeImageDesc, ChannelOrder = UR_IMAGE_CHANNEL_ORDER_A; break; default: - logger::error( - "ze2urImageFormat: unexpected image format channel x: x = {}", - ZeImageFormat.x); + UR_LOG(ERR, "ze2urImageFormat: unexpected image format channel x: x = {}", + ZeImageFormat.x); return UR_RESULT_ERROR_INVALID_VALUE; } break; @@ -64,9 +63,8 @@ ur_result_t ze2urImageFormat(const ze_image_desc_t *ZeImageDesc, case ZE_IMAGE_FORMAT_LAYOUT_16_16: case ZE_IMAGE_FORMAT_LAYOUT_32_32: if (ZeImageFormat.x != ZE_IMAGE_FORMAT_SWIZZLE_R) { - logger::error( - "ze2urImageFormat: unexpected image format channel x: x = {}", - ZeImageFormat.x); + UR_LOG(ERR, "ze2urImageFormat: unexpected image format channel x: x = {}", + ZeImageFormat.x); return UR_RESULT_ERROR_INVALID_VALUE; } switch (ZeImageFormat.y) { @@ -80,9 +78,9 @@ ur_result_t ze2urImageFormat(const ze_image_desc_t *ZeImageDesc, ChannelOrder = UR_IMAGE_CHANNEL_ORDER_RX; break; default: - logger::error( - "ze2urImageFormat: unexpected image format channel y: y = {}\n", - ZeImageFormat.y); + UR_LOG(ERR, + "ze2urImageFormat: unexpected image format channel y: y = {}\n", + ZeImageFormat.y); return UR_RESULT_ERROR_INVALID_VALUE; } break; @@ -99,13 +97,13 @@ ur_result_t ze2urImageFormat(const ze_image_desc_t *ZeImageDesc, ChannelOrder = UR_IMAGE_CHANNEL_ORDER_RGX; break; default: - logger::error( - "ze2urImageFormat: unexpected image format channel z: z = {}\n", - ZeImageFormat.z); + UR_LOG(ERR, + "ze2urImageFormat: unexpected image format channel z: z = {}\n", + ZeImageFormat.z); return UR_RESULT_ERROR_INVALID_VALUE; } } else { - logger::error("ze2urImageFormat: unexpected image format channel"); + UR_LOG(ERR, "ze2urImageFormat: unexpected image format channel"); return UR_RESULT_ERROR_INVALID_VALUE; } break; @@ -123,9 +121,9 @@ ur_result_t ze2urImageFormat(const ze_image_desc_t *ZeImageDesc, ChannelOrder = UR_IMAGE_CHANNEL_ORDER_RGBA; break; default: - logger::error("ze2urImageFormat: unexpected image format channel w: w " - "= {}", - ZeImageFormat.x); + UR_LOG(ERR, + "ze2urImageFormat: unexpected image format channel w: w = {}", + ZeImageFormat.w); return UR_RESULT_ERROR_INVALID_VALUE; } } else if (ZeImageFormat.x == ZE_IMAGE_FORMAT_SWIZZLE_A && @@ -139,14 +137,14 @@ ur_result_t ze2urImageFormat(const ze_image_desc_t *ZeImageDesc, ZeImageFormat.w == ZE_IMAGE_FORMAT_SWIZZLE_A) { ChannelOrder = UR_IMAGE_CHANNEL_ORDER_BGRA; } else { - logger::error("ze2urImageFormat: unexpected image format channel"); + UR_LOG(ERR, "ze2urImageFormat: unexpected image format channel"); return UR_RESULT_ERROR_INVALID_VALUE; } break; default: - logger::error( - "ze2urImageFormat: unsupported image format layout: layout = {}", - ZeImageFormat.layout); + UR_LOG(ERR, + "ze2urImageFormat: unsupported image format layout: layout = {}", + ZeImageFormat.layout); return UR_RESULT_ERROR_INVALID_VALUE; } @@ -164,9 +162,9 @@ ur_result_t ze2urImageFormat(const ze_image_desc_t *ZeImageDesc, ChannelType = UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32; break; default: - logger::error("ze2urImageFormat: unexpected image format type size: size " - "= {}", - ZeImageFormatTypeSize); + UR_LOG(ERR, + "ze2urImageFormat: unexpected image format type size: size = {}", + ZeImageFormatTypeSize); return UR_RESULT_ERROR_INVALID_VALUE; } break; @@ -182,9 +180,9 @@ ur_result_t ze2urImageFormat(const ze_image_desc_t *ZeImageDesc, ChannelType = UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32; break; default: - logger::error("ze2urImageFormat: unexpected image format type size: size " - "= {}", - ZeImageFormatTypeSize); + UR_LOG(ERR, + "ze2urImageFormat: unexpected image format type size: size = {}", + ZeImageFormatTypeSize); return UR_RESULT_ERROR_INVALID_VALUE; } break; @@ -197,9 +195,9 @@ ur_result_t ze2urImageFormat(const ze_image_desc_t *ZeImageDesc, ChannelType = UR_IMAGE_CHANNEL_TYPE_UNORM_INT16; break; default: - logger::error("ze2urImageFormat: unexpected image format type size: size " - "= {}", - ZeImageFormatTypeSize); + UR_LOG(ERR, + "ze2urImageFormat: unexpected image format type size: size = {}", + ZeImageFormatTypeSize); return UR_RESULT_ERROR_INVALID_VALUE; } break; @@ -212,9 +210,9 @@ ur_result_t ze2urImageFormat(const ze_image_desc_t *ZeImageDesc, ChannelType = UR_IMAGE_CHANNEL_TYPE_SNORM_INT16; break; default: - logger::error("ze2urImageFormat: unexpected image format type size: size " - "= {}", - ZeImageFormatTypeSize); + UR_LOG(ERR, + "ze2urImageFormat: unexpected image format type size: size = {}", + ZeImageFormatTypeSize); return UR_RESULT_ERROR_INVALID_VALUE; } break; @@ -227,15 +225,15 @@ ur_result_t ze2urImageFormat(const ze_image_desc_t *ZeImageDesc, ChannelType = UR_IMAGE_CHANNEL_TYPE_FLOAT; break; default: - logger::error("ze2urImageFormat: unexpected image format type size: size " - "= {}", - ZeImageFormatTypeSize); + UR_LOG(ERR, + "ze2urImageFormat: unexpected image format type size: size = {}", + ZeImageFormatTypeSize); return UR_RESULT_ERROR_INVALID_VALUE; } break; default: - logger::error("ze2urImageFormat: unsupported image format type: type = {}", - ZeImageFormat.type); + UR_LOG(ERR, "ze2urImageFormat: unsupported image format type: type = {}", + ZeImageFormat.type); return UR_RESULT_ERROR_INVALID_VALUE; } @@ -281,13 +279,13 @@ ur_result_t ur2zeImageDesc(const ur_image_format_t *ImageFormat, ZeImageFormatLayout = ZE_IMAGE_FORMAT_LAYOUT_32_32_32_32; break; default: - logger::error("ur2zeImageDesc: unexpected data type Size\n"); + UR_LOG(ERR, "ur2zeImageDesc: unexpected data type Size\n"); return UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT; } break; } default: - logger::error("format layout = {}", ImageFormat->channelOrder); + UR_LOG(ERR, "format layout = {}", ImageFormat->channelOrder); return UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT; break; } @@ -316,7 +314,7 @@ ur_result_t ur2zeImageDesc(const ur_image_format_t *ImageFormat, ZeImageType = ZE_IMAGE_TYPE_2DARRAY; break; default: - logger::error("ur2zeImageDesc: unsupported image type"); + UR_LOG(ERR, "ur2zeImageDesc: unsupported image type"); return UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR; } @@ -513,8 +511,8 @@ getImageFormatTypeAndSize(const ur_image_format_t *ImageFormat) { break; } default: - logger::error("ur2zeImageDesc: unsupported image data type: data type = {}", - ImageFormat->channelType); + UR_LOG(ERR, "ur2zeImageDesc: unsupported image data type: data type = {}", + ImageFormat->channelType); ZeImageFormatType = ZE_IMAGE_FORMAT_TYPE_FORCE_UINT32; ZeImageFormatTypeSize = 0; } diff --git a/unified-runtime/source/adapters/level_zero/helpers/kernel_helpers.cpp b/unified-runtime/source/adapters/level_zero/helpers/kernel_helpers.cpp index 895dbbe7d9ce..97aac29a84fb 100644 --- a/unified-runtime/source/adapters/level_zero/helpers/kernel_helpers.cpp +++ b/unified-runtime/source/adapters/level_zero/helpers/kernel_helpers.cpp @@ -52,15 +52,15 @@ ur_result_t getSuggestedLocalWorkSize(ur_device_handle_t hDevice, --GroupSize[I]; } if (GlobalWorkSize3D[I] / GroupSize[I] > UINT32_MAX) { - logger::error("getSuggestedLocalWorkSize: can't find a WG size " - "suitable for global work size > UINT32_MAX"); + UR_LOG(ERR, "getSuggestedLocalWorkSize: can't find a WG size " + "suitable for global work size > UINT32_MAX"); return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; } WG[I] = GroupSize[I]; } - logger::debug( - "getSuggestedLocalWorkSize: using computed WG size = {{{}, {}, {}}}", - WG[0], WG[1], WG[2]); + UR_LOG(DEBUG, + "getSuggestedLocalWorkSize: using computed WG size = {{{}, {}, {}}}", + WG[0], WG[1], WG[2]); } return UR_RESULT_SUCCESS; @@ -70,7 +70,7 @@ ur_result_t setKernelGlobalOffset(ur_context_handle_t Context, ze_kernel_handle_t Kernel, uint32_t WorkDim, const size_t *GlobalWorkOffset) { if (!Context->getPlatform()->ZeDriverGlobalOffsetExtensionFound) { - logger::debug("No global offset extension found on this driver"); + UR_LOG(DEBUG, "No global offset extension found on this driver"); return UR_RESULT_ERROR_INVALID_VALUE; } @@ -130,27 +130,27 @@ ur_result_t calculateKernelWorkDimensions( break; default: - logger::error("calculateKernelWorkDimensions: unsupported work_dim"); + UR_LOG(ERR, "calculateKernelWorkDimensions: unsupported work_dim"); return UR_RESULT_ERROR_INVALID_VALUE; } // Error handling for non-uniform group size case if (GlobalWorkSize3D[0] != size_t(ZeThreadGroupDimensions.groupCountX) * WG[0]) { - logger::error("calculateKernelWorkDimensions: invalid work_dim. The range " - "is not a multiple of the group size in the 1st dimension"); + UR_LOG(ERR, "calculateKernelWorkDimensions: invalid work_dim. The range " + "is not a multiple of the group size in the 1st dimension"); return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; } if (GlobalWorkSize3D[1] != size_t(ZeThreadGroupDimensions.groupCountY) * WG[1]) { - logger::error("calculateKernelWorkDimensions: invalid work_dim. The range " - "is not a multiple of the group size in the 2nd dimension"); + UR_LOG(ERR, "calculateKernelWorkDimensions: invalid work_dim. The range " + "is not a multiple of the group size in the 2nd dimension"); return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; } if (GlobalWorkSize3D[2] != size_t(ZeThreadGroupDimensions.groupCountZ) * WG[2]) { - logger::error("calculateKernelWorkDimensions: invalid work_dim. The range " - "is not a multiple of the group size in the 3rd dimension"); + UR_LOG(ERR, "calculateKernelWorkDimensions: invalid work_dim. The range " + "is not a multiple of the group size in the 3rd dimension"); return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; } diff --git a/unified-runtime/source/adapters/level_zero/image.cpp b/unified-runtime/source/adapters/level_zero/image.cpp index 5bf70d209e52..e4905ffe82fc 100644 --- a/unified-runtime/source/adapters/level_zero/image.cpp +++ b/unified-runtime/source/adapters/level_zero/image.cpp @@ -56,7 +56,7 @@ ur2zeImageDescBindless(const ur_image_format_t *ImageFormat, ZeImageFormatLayout = ZE_IMAGE_FORMAT_LAYOUT_32; break; default: - logger::error("ur2zeImageDescBindless: unexpected data type size"); + UR_LOG(ERR, "ur2zeImageDescBindless: unexpected data type size"); return UR_RESULT_ERROR_INVALID_VALUE; } break; @@ -75,7 +75,7 @@ ur2zeImageDescBindless(const ur_image_format_t *ImageFormat, ZeImageFormatLayout = ZE_IMAGE_FORMAT_LAYOUT_32_32; break; default: - logger::error("ur2zeImageDescBindless: unexpected data type size"); + UR_LOG(ERR, "ur2zeImageDescBindless: unexpected data type size"); return UR_RESULT_ERROR_INVALID_VALUE; } break; @@ -95,7 +95,7 @@ ur2zeImageDescBindless(const ur_image_format_t *ImageFormat, ZeImageFormatLayout = ZE_IMAGE_FORMAT_LAYOUT_32_32_32_32; break; default: - logger::error("ur2zeImageDescBindless: unexpected data type size"); + UR_LOG(ERR, "ur2zeImageDescBindless: unexpected data type size"); return UR_RESULT_ERROR_INVALID_VALUE; } break; @@ -113,13 +113,13 @@ ur2zeImageDescBindless(const ur_image_format_t *ImageFormat, ZeImageFormatLayout = ZE_IMAGE_FORMAT_LAYOUT_32_32_32; break; default: - logger::error("ur2zeImageDescBindless: unexpected data type size"); + UR_LOG(ERR, "ur2zeImageDescBindless: unexpected data type size"); return UR_RESULT_ERROR_INVALID_VALUE; } break; } default: - logger::error("format channel order = {}", ImageFormat->channelOrder); + UR_LOG(ERR, "format channel order = {}", ImageFormat->channelOrder); die("ur2zeImageDescBindless: unsupported image channel order\n"); break; } @@ -148,7 +148,7 @@ ur2zeImageDescBindless(const ur_image_format_t *ImageFormat, ZeImageType = ZE_IMAGE_TYPE_2DARRAY; break; default: - logger::error("ur2zeImageDescBindless: unsupported image type"); + UR_LOG(ERR, "ur2zeImageDescBindless: unsupported image type"); return UR_RESULT_ERROR_INVALID_VALUE; } @@ -237,9 +237,10 @@ ur_result_t bindlessImagesCreateImpl(ur_context_handle_t hContext, DriverHandle, "zeImageGetDeviceOffsetExp", (void **)&zeImageGetDeviceOffsetExpFunctionPtr); if (Result != ZE_RESULT_SUCCESS) - logger::error("zeDriverGetExtensionFunctionAddress " - "zeImageGetDeviceOffsetExpv failed, err = {}", - Result); + UR_LOG(ERR, + "zeDriverGetExtensionFunctionAddress zeImageGetDeviceOffsetExpv " + "failed, err = {}", + Result); }); if (!zeImageGetDeviceOffsetExpFunctionPtr) return UR_RESULT_ERROR_INVALID_OPERATION; @@ -280,10 +281,10 @@ ur_result_t urUSMPitchedAllocExp(ur_context_handle_t hContext, DriverHandle, "zeMemGetPitchFor2dImage", (void **)&zeMemGetPitchFor2dImageFunctionPtr); if (Result != ZE_RESULT_SUCCESS) - logger::error( - "zeDriverGetExtensionFunctionAddress zeMemGetPitchFor2dImage " - "failed, err = {}", - Result); + UR_LOG(ERR, + "zeDriverGetExtensionFunctionAddress zeMemGetPitchFor2dImage " + "failed, err = {}", + Result); }); if (!zeMemGetPitchFor2dImageFunctionPtr) return UR_RESULT_ERROR_INVALID_OPERATION; @@ -551,7 +552,7 @@ ur_result_t urBindlessImagesImageCopyExp( &DstRegion, &SrcRegion, ZeEvent, WaitList.Length, WaitList.ZeEventList)); } else { - logger::error("urBindlessImagesImageCopyExp: unexpected imageCopyFlags"); + UR_LOG(ERR, "urBindlessImagesImageCopyExp: unexpected imageCopyFlags"); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -614,7 +615,8 @@ ur_result_t urBindlessImagesMipmapGetLevelExp( ur_context_handle_t /*hContext*/, ur_device_handle_t /*hDevice*/, ur_exp_image_mem_native_handle_t /*hImageMem*/, uint32_t /*mipmapLevel*/, ur_exp_image_mem_native_handle_t * /*phImageMem*/) { - logger::error(logger::LegacyMessage("[UR][L0] {} function not implemented!"), + UR_LOG_LEGACY(ERR, + logger::LegacyMessage("[UR][L0] {} function not implemented!"), "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -798,7 +800,7 @@ ur_result_t urBindlessImagesImportExternalSemaphoreExp( auto UrPlatform = hContext->getPlatform(); if (UrPlatform->ZeExternalSemaphoreExt.Supported == false) { - logger::error(logger::LegacyMessage("[UR][L0] "), + UR_LOG_LEGACY(ERR, logger::LegacyMessage("[UR][L0] "), " {} function not supported!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -930,7 +932,7 @@ ur_result_t urBindlessImagesReleaseExternalSemaphoreExp( ur_exp_external_semaphore_handle_t hExternalSemaphore) { auto UrPlatform = hContext->getPlatform(); if (UrPlatform->ZeExternalSemaphoreExt.Supported == false) { - logger::error(logger::LegacyMessage("[UR][L0] "), + UR_LOG_LEGACY(ERR, logger::LegacyMessage("[UR][L0] "), " {} function not supported!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -953,8 +955,9 @@ ur_result_t urBindlessImagesWaitExternalSemaphoreExp( const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { auto UrPlatform = hQueue->Context->getPlatform(); if (UrPlatform->ZeExternalSemaphoreExt.Supported == false) { - logger::error(logger::LegacyMessage("[UR][L0] "), - " {} function not supported!", __FUNCTION__); + UR_LOG_LEGACY(ERR, + logger::LegacyMessage("[UR][L0] {} function not supported!"), + "{} function not supported!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -1037,8 +1040,9 @@ ur_result_t urBindlessImagesSignalExternalSemaphoreExp( const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { auto UrPlatform = hQueue->Context->getPlatform(); if (UrPlatform->ZeExternalSemaphoreExt.Supported == false) { - logger::error(logger::LegacyMessage("[UR][L0] "), - " {} function not supported!", __FUNCTION__); + UR_LOG_LEGACY(ERR, + logger::LegacyMessage("[UR][L0] {} function not supported!"), + "{} function not supported!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/level_zero/kernel.cpp b/unified-runtime/source/adapters/level_zero/kernel.cpp index b4bbbb159488..8658adc58bcf 100644 --- a/unified-runtime/source/adapters/level_zero/kernel.cpp +++ b/unified-runtime/source/adapters/level_zero/kernel.cpp @@ -189,9 +189,8 @@ ur_result_t urEnqueueKernelLaunch( (*Event)->WaitList.Length, (*Event)->WaitList.ZeEventList)); } - logger::debug("calling zeCommandListAppendLaunchKernel() with" - " ZeEvent {}", - ur_cast(ZeEvent)); + UR_LOG(DEBUG, "calling zeCommandListAppendLaunchKernel() with ZeEvent {}", + ur_cast(ZeEvent)); printZeEventList((*Event)->WaitList); // Execute command list asynchronously, as the event will be used @@ -317,16 +316,17 @@ ur_result_t urEnqueueCooperativeKernelLaunchExp( } if (GlobalWorkSize3D[I] / GroupSize[I] > UINT32_MAX) { - logger::error( - "urEnqueueCooperativeKernelLaunchExp: can't find a WG size " - "suitable for global work size > UINT32_MAX"); + UR_LOG(ERR, + "urEnqueueCooperativeKernelLaunchExp: can't find a WG size " + "suitable for global work size > UINT32_MAX"); return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; } WG[I] = GroupSize[I]; } - logger::debug("urEnqueueCooperativeKernelLaunchExp: using computed WG " - "size = {{{}, {}, {}}}", - WG[0], WG[1], WG[2]); + UR_LOG(DEBUG, + "urEnqueueCooperativeKernelLaunchExp: using computed WG " + "size = {{{}, {}, {}}}", + WG[0], WG[1], WG[2]); } } @@ -355,30 +355,30 @@ ur_result_t urEnqueueCooperativeKernelLaunchExp( break; default: - logger::error("urEnqueueCooperativeKernelLaunchExp: unsupported work_dim"); + UR_LOG(ERR, "urEnqueueCooperativeKernelLaunchExp: unsupported work_dim"); return UR_RESULT_ERROR_INVALID_VALUE; } // Error handling for non-uniform group size case if (GlobalWorkSize3D[0] != size_t(ZeThreadGroupDimensions.groupCountX) * WG[0]) { - logger::error("urEnqueueCooperativeKernelLaunchExp: invalid work_dim. The " - "range is not a " - "multiple of the group size in the 1st dimension"); + UR_LOG(ERR, + "urEnqueueCooperativeKernelLaunchExp: invalid work_dim. The " + "range is not a multiple of the group size in the 1st dimension"); return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; } if (GlobalWorkSize3D[1] != size_t(ZeThreadGroupDimensions.groupCountY) * WG[1]) { - logger::error("urEnqueueCooperativeKernelLaunchExp: invalid work_dim. The " - "range is not a " - "multiple of the group size in the 2nd dimension"); + UR_LOG(ERR, + "urEnqueueCooperativeKernelLaunchExp: invalid work_dim. The " + "range is not a multiple of the group size in the 2nd dimension"); return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; } if (GlobalWorkSize3D[2] != size_t(ZeThreadGroupDimensions.groupCountZ) * WG[2]) { - logger::debug("urEnqueueCooperativeKernelLaunchExp: invalid work_dim. The " - "range is not a " - "multiple of the group size in the 3rd dimension"); + UR_LOG(DEBUG, + "urEnqueueCooperativeKernelLaunchExp: invalid work_dim. The " + "range is not a multiple of the group size in the 3rd dimension"); return UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE; } @@ -449,9 +449,9 @@ ur_result_t urEnqueueCooperativeKernelLaunchExp( (*Event)->WaitList.Length, (*Event)->WaitList.ZeEventList)); } - logger::debug("calling zeCommandListAppendLaunchCooperativeKernel() with" - " ZeEvent {}", - ur_cast(ZeEvent)); + UR_LOG(DEBUG, + "calling zeCommandListAppendLaunchCooperativeKernel() with ZeEvent {}", + ur_cast(ZeEvent)); printZeEventList((*Event)->WaitList); // Execute command list asynchronously, as the event will be used @@ -788,9 +788,8 @@ ur_result_t urKernelGetInfo( return UR_RESULT_ERROR_UNKNOWN; } default: - logger::error( - "Unsupported ParamName in urKernelGetInfo: ParamName={}(0x{})", - ParamName, logger::toHex(ParamName)); + UR_LOG(ERR, "Unsupported ParamName in urKernelGetInfo: ParamName={}(0x{})", + ParamName, logger::toHex(ParamName)); return UR_RESULT_ERROR_INVALID_VALUE; } @@ -877,9 +876,8 @@ ur_result_t urKernelGetGroupInfo( // No corresponding enumeration in Level Zero return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; default: { - logger::error( - "Unknown ParamName in urKernelGetGroupInfo: ParamName={}(0x{})", - ParamName, logger::toHex(ParamName)); + UR_LOG(ERR, "Unknown ParamName in urKernelGetGroupInfo: ParamName={}(0x{})", + ParamName, logger::toHex(ParamName)); return UR_RESULT_ERROR_INVALID_VALUE; } } @@ -1019,7 +1017,7 @@ ur_result_t urKernelSetExecInfo( return UR_RESULT_ERROR_INVALID_VALUE; ZE2UR_CALL(zeKernelSetCacheConfig, (ZeKernel, ZeCacheConfig);); } else { - logger::error("urKernelSetExecInfo: unsupported ParamName"); + UR_LOG(ERR, "urKernelSetExecInfo: unsupported ParamName"); return UR_RESULT_ERROR_INVALID_VALUE; } } @@ -1166,7 +1164,8 @@ ur_result_t urKernelSetSpecializationConstants( const ur_specialization_constant_info_t /// [in] array of specialization constant value descriptions * /*SpecConstants*/) { - logger::error(logger::LegacyMessage("[UR][L0] {} function not implemented!"), + UR_LOG_LEGACY(ERR, + logger::LegacyMessage("[UR][L0] {} function not implemented!"), "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/level_zero/memory.cpp b/unified-runtime/source/adapters/level_zero/memory.cpp index d68fdc027ba2..d1b7344968af 100644 --- a/unified-runtime/source/adapters/level_zero/memory.cpp +++ b/unified-runtime/source/adapters/level_zero/memory.cpp @@ -117,9 +117,8 @@ ur_result_t enqueueMemCopyHelper(ur_command_t CommandType, const auto &ZeCommandList = CommandList->first; const auto &WaitList = (*Event)->WaitList; - logger::debug("calling zeCommandListAppendMemoryCopy() with" - " ZeEvent {}", - ur_cast(ZeEvent)); + UR_LOG(DEBUG, "calling zeCommandListAppendMemoryCopy() with ZeEvent {}", + ur_cast(ZeEvent)); printZeEventList(WaitList); ZE2UR_CALL(zeCommandListAppendMemoryCopy, @@ -170,9 +169,8 @@ ur_result_t enqueueMemCopyRectHelper( const auto &ZeCommandList = CommandList->first; const auto &WaitList = (*Event)->WaitList; - logger::debug("calling zeCommandListAppendMemoryCopy() with" - " ZeEvent {}", - ur_cast(ZeEvent)); + UR_LOG(DEBUG, "calling zeCommandListAppendMemoryCopy() with ZeEvent {}", + ur_cast(ZeEvent)); printZeEventList(WaitList); auto ZeParams = ur2zeRegionParams(SrcOrigin, DstOrigin, Region, SrcRowPitch, @@ -184,7 +182,7 @@ ur_result_t enqueueMemCopyRectHelper( ZeParams.srcPitch, ZeParams.srcSlicePitch, ZeEvent, WaitList.Length, WaitList.ZeEventList)); - logger::debug("calling zeCommandListAppendMemoryCopyRegion()"); + UR_LOG(DEBUG, "calling zeCommandListAppendMemoryCopyRegion()"); UR_CALL(Queue->executeCommandList(CommandList, Blocking, OkToBatch)); @@ -259,9 +257,8 @@ static ur_result_t enqueueMemFillHelper(ur_command_t CommandType, (ZeCommandList, Ptr, Pattern, PatternSize, Size, ZeEvent, WaitList.Length, WaitList.ZeEventList)); - logger::debug("calling zeCommandListAppendMemoryFill() with" - " ZeEvent {}", - ur_cast(ZeEvent)); + UR_LOG(DEBUG, "calling zeCommandListAppendMemoryFill() with ZeEvent {}", + ur_cast(ZeEvent)); printZeEventList(WaitList); // Execute command list asynchronously, as the event will be used @@ -281,9 +278,8 @@ static ur_result_t enqueueMemFillHelper(ur_command_t CommandType, WaitList.Length, WaitList.ZeEventList)); } - logger::debug("calling zeCommandListAppendMemoryCopy() with" - " ZeEvent {}", - ur_cast(ZeEvent)); + UR_LOG(DEBUG, "calling zeCommandListAppendMemoryCopy() with ZeEvent {}", + ur_cast(ZeEvent)); printZeEventList(WaitList); // Execute command list synchronously. @@ -464,7 +460,7 @@ static ur_result_t enqueueMemImageCommandHelper( ur_cast(ZeHandleSrc), &ZeDstRegion, &ZeSrcRegion, ZeEvent, 0, nullptr)); } else { - logger::error("enqueueMemImageUpdate: unsupported image command type"); + UR_LOG(ERR, "enqueueMemImageUpdate: unsupported image command type"); return UR_RESULT_ERROR_INVALID_OPERATION; } @@ -1041,7 +1037,7 @@ ur_result_t urEnqueueMemBufferMap( // False as the second value in pair means that mapping was not inserted // because mapping already exists. if (!Res.second) { - logger::error("urEnqueueMemBufferMap: duplicate mapping detected"); + UR_LOG(ERR, "urEnqueueMemBufferMap: duplicate mapping detected"); return UR_RESULT_ERROR_INVALID_VALUE; } @@ -1102,7 +1098,7 @@ ur_result_t urEnqueueMemBufferMap( // False as the second value in pair means that mapping was not inserted // because mapping already exists. if (!Res.second) { - logger::error("urEnqueueMemBufferMap: duplicate mapping detected"); + UR_LOG(ERR, "urEnqueueMemBufferMap: duplicate mapping detected"); return UR_RESULT_ERROR_INVALID_VALUE; } return UR_RESULT_SUCCESS; @@ -1156,7 +1152,7 @@ ur_result_t urEnqueueMemUnmap( std::scoped_lock Guard(Buffer->Mutex); auto It = Buffer->Mappings.find(MappedPtr); if (It == Buffer->Mappings.end()) { - logger::error("urEnqueueMemUnmap: unknown memory mapping"); + UR_LOG(ERR, "urEnqueueMemUnmap: unknown memory mapping"); return UR_RESULT_ERROR_INVALID_VALUE; } MapInfo = It->second; @@ -1428,7 +1424,8 @@ ur_result_t urEnqueueUSMFill2D( /// [in,out][optional] return an event object that identifies this /// particular kernel execution instance. ur_event_handle_t * /*OutEvent*/) { - logger::error(logger::LegacyMessage("[UR][L0] {} function not implemented!"), + UR_LOG_LEGACY(ERR, + logger::LegacyMessage("[UR][L0] {} function not implemented!"), "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -1871,7 +1868,8 @@ ur_result_t urMemImageGetInfo( /// [out][optional] pointer to the actual size in bytes of data queried by /// pImgInfo. size_t * /*PropSizeRet*/) { - logger::error(logger::LegacyMessage("[UR][L0] {} function not implemented!"), + UR_LOG_LEGACY(ERR, + logger::LegacyMessage("[UR][L0] {} function not implemented!"), "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -1917,7 +1915,8 @@ ur_result_t urEnqueueReadHostPipe(ur_queue_handle_t /*hQueue*/, uint32_t /*numEventsInWaitList*/, const ur_event_handle_t * /*phEventWaitList*/, ur_event_handle_t * /*phEvent*/) { - logger::error(logger::LegacyMessage("[UR][L0] {} function not implemented!"), + UR_LOG_LEGACY(ERR, + logger::LegacyMessage("[UR][L0] {} function not implemented!"), "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -1928,7 +1927,8 @@ ur_result_t urEnqueueWriteHostPipe( size_t /*size*/, uint32_t /*numEventsInWaitList*/, const ur_event_handle_t * /*phEventWaitList*/, ur_event_handle_t * /*phEvent*/) { - logger::error(logger::LegacyMessage("[UR][L0] {} function not implemented!"), + UR_LOG_LEGACY(ERR, + logger::LegacyMessage("[UR][L0] {} function not implemented!"), "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -2193,8 +2193,8 @@ ur_result_t ur_buffer::getBufferZeHandle(char *&ZeHandle, } } - logger::debug("getZeHandle(pi_device{{{}}}) = {}", (void *)Device, - (void *)Allocation.ZeHandle); + UR_LOG(DEBUG, "getZeHandle(pi_device{{{}}}) = {}", (void *)Device, + (void *)Allocation.ZeHandle); return UR_RESULT_SUCCESS; } diff --git a/unified-runtime/source/adapters/level_zero/platform.cpp b/unified-runtime/source/adapters/level_zero/platform.cpp index 2cd7b63effcf..8c95989035c0 100644 --- a/unified-runtime/source/adapters/level_zero/platform.cpp +++ b/unified-runtime/source/adapters/level_zero/platform.cpp @@ -102,7 +102,7 @@ ur_result_t urPlatformGetInfo( case UR_PLATFORM_INFO_ADAPTER: return ReturnValue(GlobalAdapter); default: - logger::debug("urPlatformGetInfo: unrecognized ParamName"); + UR_LOG(DEBUG, "urPlatformGetInfo: unrecognized ParamName"); return UR_RESULT_ERROR_INVALID_VALUE; } diff --git a/unified-runtime/source/adapters/level_zero/program.cpp b/unified-runtime/source/adapters/level_zero/program.cpp index b5b652e0af4b..a39274ea9bc1 100644 --- a/unified-runtime/source/adapters/level_zero/program.cpp +++ b/unified-runtime/source/adapters/level_zero/program.cpp @@ -439,9 +439,9 @@ ur_result_t urProgramLinkExp( ZeModuleDesc.pInputModule = ZeExtModuleDesc.pInputModules[0]; ZeModuleDesc.pConstants = ZeExtModuleDesc.pConstants[0]; } else { - logger::error( - "urProgramLink: level_zero driver does not have static linking " - "support."); + UR_LOG(ERR, + "urProgramLink: level_zero driver does not have static linking " + "support."); return UR_RESULT_ERROR_INVALID_VALUE; } } @@ -893,7 +893,7 @@ ur_result_t urProgramGetBuildInfo( // program. return ReturnValue(""); } else { - logger::error("urProgramGetBuildInfo: unsupported ParamName"); + UR_LOG(ERR, "urProgramGetBuildInfo: unsupported ParamName"); return UR_RESULT_ERROR_INVALID_VALUE; } return UR_RESULT_SUCCESS; @@ -908,7 +908,8 @@ ur_result_t urProgramSetSpecializationConstant( size_t /*SpecSize*/, /// [in] pointer to the specialization value bytes const void * /*SpecValue*/) { - logger::error(logger::LegacyMessage("[UR][L0] {} function not implemented!"), + UR_LOG_LEGACY(ERR, + logger::LegacyMessage("[UR][L0] {} function not implemented!"), "{} function not implemented!"); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/level_zero/queue.cpp b/unified-runtime/source/adapters/level_zero/queue.cpp index 9dfc437f0b28..6c4a51615a0b 100644 --- a/unified-runtime/source/adapters/level_zero/queue.cpp +++ b/unified-runtime/source/adapters/level_zero/queue.cpp @@ -455,7 +455,8 @@ ur_result_t urQueueGetInfo( return ReturnValue(true); } default: - logger::error( + UR_LOG( + ERR, "Unsupported ParamName in urQueueGetInfo: ParamName=ParamName={}(0x{})", ParamName, logger::toHex(ParamName)); return UR_RESULT_ERROR_INVALID_ENUMERATION; @@ -924,8 +925,8 @@ ur_result_t urEnqueueKernelLaunchCustomExp( uint32_t /*numEventsInWaitList*/, const ur_event_handle_t * /*phEventWaitList*/, ur_event_handle_t * /*phEvent*/) { - logger::error("[UR][L0] {} function not implemented!", - "{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "[UR][L0] {} function not implemented!", + "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -1005,9 +1006,9 @@ static const zeCommandListBatchConfig ZeCommandListBatchConfig(bool IsCopy) { Val = std::stoi(BatchConfig.substr(Pos)); } catch (...) { if (IsCopy) - logger::error("UR_L0_COPY_BATCH_SIZE: failed to parse value"); + UR_LOG(ERR, "UR_L0_COPY_BATCH_SIZE: failed to parse value") else - logger::error("UR_L0_BATCH_SIZE: failed to parse value"); + UR_LOG(ERR, "UR_L0_BATCH_SIZE: failed to parse value") break; } switch (Ord) { @@ -1030,20 +1031,19 @@ static const zeCommandListBatchConfig ZeCommandListBatchConfig(bool IsCopy) { die("Unexpected batch config"); } if (IsCopy) - logger::error("UR_L0_COPY_BATCH_SIZE: dynamic batch param " - "#{}: {}", - (int)Ord, (int)Val); + UR_LOG(ERR, "UR_L0_COPY_BATCH_SIZE: dynamic batch param #{}: {}", + (int)Ord, (int)Val) else - logger::error("UR_L0_BATCH_SIZE: dynamic batch param #{}: {}", - (int)Ord, (int)Val); + UR_LOG(ERR, "UR_L0_BATCH_SIZE: dynamic batch param #{}: {}", (int)Ord, + (int)Val) }; } else { // Negative batch sizes are silently ignored. if (IsCopy) - logger::warning("UR_L0_COPY_BATCH_SIZE: ignored negative value"); + UR_LOG(WARN, "UR_L0_COPY_BATCH_SIZE: ignored negative value") else - logger::warning("UR_L0_BATCH_SIZE: ignored negative value"); + UR_LOG(WARN, "UR_L0_BATCH_SIZE: ignored negative value") } } return Config; @@ -1223,7 +1223,7 @@ void ur_queue_handle_t_::adjustBatchSizeForFullBatch(bool IsCopy) { ZeCommandListBatchConfig.NumTimesClosedFullThreshold) { if (QueueBatchSize < ZeCommandListBatchConfig.DynamicSizeMax) { QueueBatchSize += ZeCommandListBatchConfig.DynamicSizeStep; - logger::debug("Raising QueueBatchSize to {}", QueueBatchSize); + UR_LOG(DEBUG, "Raising QueueBatchSize to {}", QueueBatchSize); } CommandBatch.NumTimesClosedEarly = 0; CommandBatch.NumTimesClosedFull = 0; @@ -1250,7 +1250,7 @@ void ur_queue_handle_t_::adjustBatchSizeForPartialBatch(bool IsCopy) { QueueBatchSize = CommandBatch.OpenCommandList->second.size() - 1; if (QueueBatchSize < 1) QueueBatchSize = 1; - logger::debug("Lowering QueueBatchSize to {}", QueueBatchSize); + UR_LOG(DEBUG, "Lowering QueueBatchSize to {}", QueueBatchSize); CommandBatch.NumTimesClosedEarly = 0; CommandBatch.NumTimesClosedFull = 0; } @@ -1618,14 +1618,15 @@ ur_result_t urQueueReleaseInternal(ur_queue_handle_t Queue) { Queue->clearEndTimeRecordings(); - logger::debug("urQueueRelease(compute) NumTimesClosedFull {}, " - "NumTimesClosedEarly {}", - Queue->ComputeCommandBatch.NumTimesClosedFull, - Queue->ComputeCommandBatch.NumTimesClosedEarly); - logger::debug( - "urQueueRelease(copy) NumTimesClosedFull {}, NumTimesClosedEarly {}", - Queue->CopyCommandBatch.NumTimesClosedFull, - Queue->CopyCommandBatch.NumTimesClosedEarly); + UR_LOG(DEBUG, + "urQueueRelease(compute) NumTimesClosedFull {}, " + "NumTimesClosedEarly {}", + Queue->ComputeCommandBatch.NumTimesClosedFull, + Queue->ComputeCommandBatch.NumTimesClosedEarly); + UR_LOG(DEBUG, + "urQueueRelease(copy) NumTimesClosedFull {}, NumTimesClosedEarly {}", + Queue->CopyCommandBatch.NumTimesClosedFull, + Queue->CopyCommandBatch.NumTimesClosedEarly); delete Queue; @@ -2242,10 +2243,11 @@ ur_queue_handle_t_::ur_queue_group_t::getZeQueue(uint32_t *QueueGroupOrdinal) { ZeCommandQueueDesc.flags = ZE_COMMAND_QUEUE_FLAG_EXPLICIT_ONLY; } - logger::debug("[getZeQueue]: create queue ordinal = {}, index = {} " - "(round robin in [{}, {}]) priority = {}", - ZeCommandQueueDesc.ordinal, ZeCommandQueueDesc.index, - LowerIndex, UpperIndex, Priority); + UR_LOG(DEBUG, + "[getZeQueue]: create queue ordinal = {}, index = {} " + "(round robin in [{}, {}]) priority = {}", + ZeCommandQueueDesc.ordinal, ZeCommandQueueDesc.index, LowerIndex, + UpperIndex, Priority); auto ZeResult = ZE_CALL_NOCHECK( zeCommandQueueCreate, (Queue->Context->ZeContext, Queue->Device->ZeDevice, @@ -2305,7 +2307,8 @@ ur_result_t ur_queue_handle_t_::createCommandList( IsInOrderList = true; } - logger::debug( + UR_LOG( + DEBUG, "create command list ordinal: {}, type: regular, device: {}, inOrder: {}", QueueGroupOrdinal, Device->ZeDevice, IsInOrderList); @@ -2474,14 +2477,15 @@ ur_command_list_ptr_t &ur_queue_handle_t_::ur_queue_group_t::getImmCmdList() { // If cache didn't contain a command list, create one. if (!ZeCommandList) { - logger::debug("[getZeQueue]: create queue ordinal = {}, index = {} " - "(round robin in [{}, {}]) priority = {}", - ZeCommandQueueDesc.ordinal, ZeCommandQueueDesc.index, - LowerIndex, UpperIndex, Priority); - logger::debug("create command list ordinal: {}, type: immediate, device: " - "{}, inOrder: {}", - ZeCommandQueueDesc.ordinal, Queue->Device->ZeDevice, - isInOrderList); + UR_LOG(DEBUG, + "[getZeQueue]: create queue ordinal = {}, index = {} " + "(round robin in [{}, {}]) priority = {}", + ZeCommandQueueDesc.ordinal, ZeCommandQueueDesc.index, LowerIndex, + UpperIndex, Priority); + UR_LOG(DEBUG, + "create command list ordinal: {}, type: immediate, device: " + "{}, inOrder: {}", + ZeCommandQueueDesc.ordinal, Queue->Device->ZeDevice, isInOrderList); ZE_CALL_NOCHECK(zeCommandListCreateImmediate, (Queue->Context->ZeContext, Queue->Device->ZeDevice, diff --git a/unified-runtime/source/adapters/level_zero/sampler.cpp b/unified-runtime/source/adapters/level_zero/sampler.cpp index a3a9f829d641..37b242883c78 100644 --- a/unified-runtime/source/adapters/level_zero/sampler.cpp +++ b/unified-runtime/source/adapters/level_zero/sampler.cpp @@ -83,9 +83,8 @@ ur_result_t urSamplerCreate( ZeSamplerDesc.addressMode = ZE_SAMPLER_ADDRESS_MODE_MIRROR; break; default: - logger::error("urSamplerCreate: unsupported " - "UR_SAMPLER_PROPERTIES_ADDRESSING_MODEE " - "value"); + UR_LOG(ERR, "urSamplerCreate: unsupported " + "UR_SAMPLER_PROPERTIES_ADDRESSING_MODEE value"); return UR_RESULT_ERROR_INVALID_VALUE; } @@ -94,8 +93,7 @@ ur_result_t urSamplerCreate( else if (Props->filterMode == UR_SAMPLER_FILTER_MODE_LINEAR) ZeSamplerDesc.filterMode = ZE_SAMPLER_FILTER_MODE_LINEAR; else { - logger::error( - "urSamplerCreate: unsupported UR_SAMPLER_FILTER_MODE value"); + UR_LOG(ERR, "urSamplerCreate: unsupported UR_SAMPLER_FILTER_MODE value"); return UR_RESULT_ERROR_INVALID_VALUE; } } @@ -155,7 +153,8 @@ ur_result_t urSamplerGetInfo( void * /*PropValue*/, /// [out] size in bytes returned in sampler property value size_t * /*PropSizeRet*/) { - logger::error(logger::LegacyMessage("[UR][L0] {} function not implemented!"), + UR_LOG_LEGACY(ERR, + logger::LegacyMessage("[UR][L0] {} function not implemented!"), "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -165,7 +164,8 @@ ur_result_t urSamplerGetNativeHandle( ur_sampler_handle_t /*Sampler*/, /// [out] a pointer to the native handle of the sampler. ur_native_handle_t * /*NativeSampler*/) { - logger::error(logger::LegacyMessage("[UR][L0] {} function not implemented!"), + UR_LOG_LEGACY(ERR, + logger::LegacyMessage("[UR][L0] {} function not implemented!"), "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -179,7 +179,8 @@ ur_result_t urSamplerCreateWithNativeHandle( const ur_sampler_native_properties_t * /*Properties*/, /// [out] pointer to the handle of the sampler object created. ur_sampler_handle_t * /*Sampler*/) { - logger::error(logger::LegacyMessage("[UR][L0] {} function not implemented!"), + UR_LOG_LEGACY(ERR, + logger::LegacyMessage("[UR][L0] {} function not implemented!"), "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/level_zero/usm.cpp b/unified-runtime/source/adapters/level_zero/usm.cpp index 86edeacafc78..8502770fe19a 100644 --- a/unified-runtime/source/adapters/level_zero/usm.cpp +++ b/unified-runtime/source/adapters/level_zero/usm.cpp @@ -448,7 +448,7 @@ ur_result_t urUSMGetMemAllocInfo( MemAllocaType = UR_USM_TYPE_SHARED; break; default: - logger::error("urUSMGetMemAllocInfo: unexpected usm memory type"); + UR_LOG(ERR, "urUSMGetMemAllocInfo: unexpected usm memory type"); return UR_RESULT_ERROR_INVALID_VALUE; } return ReturnValue(MemAllocaType); @@ -488,7 +488,7 @@ ur_result_t urUSMGetMemAllocInfo( return UR_RESULT_ERROR_INVALID_VALUE; } default: - logger::error("urUSMGetMemAllocInfo: unsupported ParamName"); + UR_LOG(ERR, "urUSMGetMemAllocInfo: unsupported ParamName"); return UR_RESULT_ERROR_INVALID_VALUE; } return UR_RESULT_SUCCESS; @@ -846,7 +846,7 @@ umf_result_t L0MemoryProvider::open_ipc_handle(void *IpcData, void **Ptr) { memcpy(&fdRemote, &zeIpcData->zeHandle, sizeof(fdRemote)); fdLocal = ur_duplicate_fd(zeIpcData->pid, fdRemote); if (fdLocal == -1) { - logger::error("duplicating file descriptor from IPC handle failed"); + UR_LOG(ERR, "duplicating file descriptor from IPC handle failed"); return UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC; } @@ -953,12 +953,12 @@ MakeProvider(ProviderParams *Params = nullptr) { } break; default: - logger::error("urUSMPoolCreate: invalid USM type found"); + UR_LOG(ERR, "urUSMPoolCreate: invalid USM type found"); Ret = UMF_RESULT_ERROR_INVALID_ARGUMENT; } if (Ret != UMF_RESULT_SUCCESS) { - logger::error("urUSMPoolCreate: failed to create UMF provider"); + UR_LOG(ERR, "urUSMPoolCreate: failed to create UMF provider"); throw UsmAllocationException(umf::umf2urResult(Ret)); } @@ -999,13 +999,13 @@ ur_usm_pool_handle_t_::ur_usm_pool_handle_t_(ur_context_handle_t Context, auto Ret = umf::umf2urResult( umfPoolSetTag(usmPool->UmfPool.get(), usmPool.get(), nullptr)); if (Ret) { - logger::error("urUSMPoolCreate: failed to store USM pool tag"); + UR_LOG(ERR, "urUSMPoolCreate: failed to store USM pool tag"); throw UsmAllocationException(Ret); } Ret = PoolManager.addPool(Desc, std::move(usmPool)); if (Ret) { - logger::error("urUSMPoolCreate: failed to store UMF pool"); + UR_LOG(ERR, "urUSMPoolCreate: failed to store UMF pool"); throw UsmAllocationException(Ret); } } @@ -1059,12 +1059,12 @@ ur_usm_pool_handle_t_::ur_usm_pool_handle_t_(ur_context_handle_t Context, auto Ret = umf::umf2urResult( umfPoolSetTag(usmPool->UmfPool.get(), usmPool.get(), nullptr)); if (Ret) { - logger::error("urUSMPoolCreate: failed to store USM pool tag"); + UR_LOG(ERR, "urUSMPoolCreate: failed to store USM pool tag"); throw UsmAllocationException(Ret); } Ret = PoolManager.addPool(Desc, std::move(usmPool)); if (Ret) { - logger::error("urUSMPoolCreate: failed to store UMF pool"); + UR_LOG(ERR, "urUSMPoolCreate: failed to store UMF pool"); throw UsmAllocationException(Ret); } } @@ -1176,9 +1176,9 @@ ur_result_t ur_usm_pool_handle_t_::allocate(ur_context_handle_t Context, } if (*RetMem == nullptr) { auto umfRet = umfPoolGetLastAllocationError(umfPool); - logger::error( - "enqueueUSMAllocHelper: allocation from the UMF pool {} failed", - umfPool); + UR_LOG(ERR, + "enqueueUSMAllocHelper: allocation from the UMF pool {} failed", + umfPool); return umf::umf2urResult(umfRet); } } diff --git a/unified-runtime/source/adapters/level_zero/v2/api.cpp b/unified-runtime/source/adapters/level_zero/v2/api.cpp index 191243452912..d58c14b6945a 100644 --- a/unified-runtime/source/adapters/level_zero/v2/api.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/api.cpp @@ -23,21 +23,21 @@ ur_result_t urContextSetExtendedDeleter(ur_context_handle_t hContext, ur_context_extended_deleter_t pfnDeleter, void *pUserData) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t urKernelSetSpecializationConstants( ur_kernel_handle_t hKernel, uint32_t count, const ur_specialization_constant_info_t *pSpecConstants) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t urEventSetCallback(ur_event_handle_t hEvent, ur_execution_info_t execStatus, ur_event_callback_t pfnNotify, void *pUserData) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -47,21 +47,21 @@ ur_result_t urUSMPitchedAllocExp(ur_context_handle_t hContext, ur_usm_pool_handle_t pool, size_t widthInBytes, size_t height, size_t elementSizeBytes, void **ppMem, size_t *pResultPitch) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t urBindlessImagesUnsampledImageHandleDestroyExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_exp_image_native_handle_t hImage) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t urBindlessImagesSampledImageHandleDestroyExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_exp_image_native_handle_t hImage) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -69,7 +69,7 @@ ur_result_t urBindlessImagesImageAllocateExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, ur_exp_image_mem_native_handle_t *phImageMem) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -77,7 +77,7 @@ ur_result_t urBindlessImagesImageFreeExp(ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_exp_image_mem_native_handle_t hImageMem) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -86,7 +86,7 @@ ur_result_t urBindlessImagesUnsampledImageCreateExp( ur_exp_image_mem_native_handle_t hImageMem, const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, ur_exp_image_native_handle_t *phImage) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -95,14 +95,14 @@ ur_result_t urBindlessImagesSampledImageCreateExp( ur_exp_image_mem_native_handle_t hImageMem, const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, ur_sampler_handle_t hSampler, ur_exp_image_native_handle_t *phImage) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t urBindlessImagesImageGetInfoExp( ur_context_handle_t hContext, ur_exp_image_mem_native_handle_t hImageMem, ur_image_info_t propName, void *pPropValue, size_t *pPropSizeRet) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -110,7 +110,7 @@ ur_result_t urBindlessImagesMipmapGetLevelExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_exp_image_mem_native_handle_t hImageMem, uint32_t mipmapLevel, ur_exp_image_mem_native_handle_t *phImageMem) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -118,7 +118,7 @@ ur_result_t urBindlessImagesMipmapFreeExp(ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_exp_image_mem_native_handle_t hMem) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -127,7 +127,7 @@ ur_result_t urBindlessImagesImportExternalMemoryExp( ur_exp_external_mem_type_t memHandleType, ur_exp_external_mem_desc_t *pExternalMemDesc, ur_exp_external_mem_handle_t *phExternalMem) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -136,21 +136,21 @@ ur_result_t urBindlessImagesMapExternalArrayExp( const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, ur_exp_external_mem_handle_t hExternalMem, ur_exp_image_mem_native_handle_t *phImageMem) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t urBindlessImagesMapExternalLinearMemoryExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, uint64_t offset, uint64_t size, ur_exp_external_mem_handle_t hExternalMem, void **ppRetMem) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t urBindlessImagesReleaseExternalMemoryExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_exp_external_mem_handle_t hExternalMem) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -159,14 +159,14 @@ ur_result_t urBindlessImagesImportExternalSemaphoreExp( ur_exp_external_semaphore_type_t semHandleType, ur_exp_external_semaphore_desc_t *pExternalSemaphoreDesc, ur_exp_external_semaphore_handle_t *phExternalSemaphore) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t urBindlessImagesReleaseExternalSemaphoreExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_exp_external_semaphore_handle_t hExternalSemaphore) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -174,21 +174,21 @@ ur_result_t urCommandBufferUpdateKernelLaunchExp( ur_exp_command_buffer_handle_t hCommandBuffer, uint32_t numKernelUpdates, const ur_exp_command_buffer_update_kernel_launch_desc_t *pUpdateKernelLaunch) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t urCommandBufferUpdateSignalEventExp( ur_exp_command_buffer_command_handle_t hCommand, ur_event_handle_t *phEvent) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t urCommandBufferUpdateWaitEventsExp( ur_exp_command_buffer_command_handle_t hCommand, uint32_t NumEventsInWaitList, const ur_event_handle_t *phEventWaitList) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -196,28 +196,28 @@ ur_result_t UR_APICALL urUSMPoolCreateExp(ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_usm_pool_desc_t *PoolDesc, ur_usm_pool_handle_t *pPool) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t UR_APICALL urUSMPoolDestroyExp(ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_usm_pool_handle_t hPool) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t UR_APICALL urUSMPoolSetInfoExp(ur_usm_pool_handle_t hPool, ur_usm_pool_info_t propName, void *pPropValue, size_t propSize) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_usm_pool_handle_t *pPool) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -225,21 +225,21 @@ ur_result_t UR_APICALL urUSMPoolGetInfoExp(ur_usm_pool_handle_t hPool, ur_usm_pool_info_t propName, void *pPropValue, size_t *pPropSizeRet) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp(ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_usm_pool_handle_t *pPool) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp(ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_usm_pool_handle_t hPool) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -247,7 +247,7 @@ ur_result_t UR_APICALL urUSMPoolTrimToExp(ur_context_handle_t hContext, ur_device_handle_t hDevice, ur_usm_pool_handle_t hPool, size_t minBytesToKeep) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/level_zero/v2/command_buffer.cpp b/unified-runtime/source/adapters/level_zero/v2/command_buffer.cpp index 3ba8a2d726b9..88295a23cbb0 100644 --- a/unified-runtime/source/adapters/level_zero/v2/command_buffer.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/command_buffer.cpp @@ -20,9 +20,8 @@ namespace { // given context. void checkImmediateAppendSupport(ur_context_handle_t context) { if (!context->getPlatform()->ZeCommandListImmediateAppendExt.Supported) { - logger::error("Adapter v2 is used but " - "the current driver does not support the " - "zeCommandListImmediateAppendCommandListsExp entrypoint."); + UR_LOG(ERR, "Adapter v2 is used but the current driver does not support " + "the zeCommandListImmediateAppendCommandListsExp entrypoint."); throw UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } } diff --git a/unified-runtime/source/adapters/level_zero/v2/command_list_cache.cpp b/unified-runtime/source/adapters/level_zero/v2/command_list_cache.cpp index f9d4a1c0b069..dc57241a20ab 100644 --- a/unified-runtime/source/adapters/level_zero/v2/command_list_cache.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/command_list_cache.cpp @@ -62,13 +62,13 @@ command_list_cache_t::createCommandList(const command_list_descriptor_t &desc) { std::visit([](auto &&arg) { return arg.CopyOffloadEnabled; }, desc); if (ForceDisableCopyOffload && requestedCopyOffload) { - logger::info("Copy offload is disabled by the environment variable."); + UR_LOG(INFO, "Copy offload is disabled by the environment variable."); requestedCopyOffload = false; } if (!ZeCopyOffloadExtensionSupported && requestedCopyOffload) { - logger::info( - "Copy offload is requested but is not supported by the driver."); + UR_LOG(INFO, + "Copy offload is requested but is not supported by the driver."); requestedCopyOffload = false; } @@ -89,10 +89,10 @@ command_list_cache_t::createCommandList(const command_list_descriptor_t &desc) { } QueueDesc.pNext = &offloadDesc; - logger::debug("create command list ordinal: {}, type: immediate, device: " - "{}, inOrder: {}", - ImmCmdDesc->Ordinal, ImmCmdDesc->ZeDevice, - ImmCmdDesc->IsInOrder); + UR_LOG(DEBUG, + "create command list ordinal: {}, type: immediate, " + "device: {}, inOrder: {}", + ImmCmdDesc->Ordinal, ImmCmdDesc->ZeDevice, ImmCmdDesc->IsInOrder); ZE2UR_CALL_THROWS( zeCommandListCreateImmediate, @@ -106,10 +106,10 @@ command_list_cache_t::createCommandList(const command_list_descriptor_t &desc) { CmdListDesc.commandQueueGroupOrdinal = RegCmdDesc.Ordinal; CmdListDesc.pNext = &offloadDesc; - logger::debug("create command list ordinal: {}, type: immediate, device: " - "{}, inOrder: {}", - RegCmdDesc.Ordinal, RegCmdDesc.ZeDevice, - RegCmdDesc.IsInOrder); + UR_LOG(DEBUG, + "create command list ordinal: {}, type: immediate, " + "device: {}, inOrder: {}", + RegCmdDesc.Ordinal, RegCmdDesc.ZeDevice, RegCmdDesc.IsInOrder); ze_command_list_handle_t ZeCommandList; ZE2UR_CALL_THROWS(zeCommandListCreate, (ZeContext, RegCmdDesc.ZeDevice, diff --git a/unified-runtime/source/adapters/level_zero/v2/event.cpp b/unified-runtime/source/adapters/level_zero/v2/event.cpp index ad6c959c20a8..ec3bf20b467b 100644 --- a/unified-runtime/source/adapters/level_zero/v2/event.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/event.cpp @@ -268,9 +268,8 @@ ur_result_t urEventGetInfo(ur_event_handle_t hEvent, ur_event_info_t propName, return returnValue(hEvent->getCommandType()); } default: - logger::error( - "Unsupported ParamName in urEventGetInfo: ParamName=ParamName={}(0x{})", - propName, logger::toHex(propName)); + UR_LOG(ERR, "Unsupported ParamName in urEventGetInfo: ParamName={}(0x{})", + propName, logger::toHex(propName)); return UR_RESULT_ERROR_INVALID_VALUE; } @@ -315,7 +314,7 @@ ur_result_t urEventGetProfilingInfo( return returnValue(hEvent->getEventEndTimestamp()); } default: - logger::error("urEventGetProfilingInfo: not supported ParamName"); + UR_LOG(ERR, "urEventGetProfilingInfo: not supported ParamName"); return UR_RESULT_ERROR_INVALID_VALUE; } } @@ -360,7 +359,7 @@ ur_result_t urEventGetProfilingInfo( // return returnValue(uint64_t{0}); default: - logger::error("urEventGetProfilingInfo: not supported ParamName"); + UR_LOG(ERR, "urEventGetProfilingInfo: not supported ParamName"); return UR_RESULT_ERROR_INVALID_VALUE; } diff --git a/unified-runtime/source/adapters/level_zero/v2/event_provider_normal.cpp b/unified-runtime/source/adapters/level_zero/v2/event_provider_normal.cpp index 3f7116adf334..6239f3f5f741 100644 --- a/unified-runtime/source/adapters/level_zero/v2/event_provider_normal.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/event_provider_normal.cpp @@ -50,7 +50,7 @@ provider_pool::provider_pool(ur_context_handle_t context, queue_type queue, devices.push_back(d->ZeDevice); } - logger::debug("ze_event_pool_desc_t flags set to: {}", desc.flags); + UR_LOG(DEBUG, "ze_event_pool_desc_t flags set to: {}", desc.flags); ZE2UR_CALL_THROWS(zeEventPoolCreate, (context->getZeHandle(), &desc, devices.size(), diff --git a/unified-runtime/source/adapters/level_zero/v2/kernel.cpp b/unified-runtime/source/adapters/level_zero/v2/kernel.cpp index 80c43d301cc0..4fcdadf64ad8 100644 --- a/unified-runtime/source/adapters/level_zero/v2/kernel.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/kernel.cpp @@ -264,7 +264,7 @@ ur_result_t ur_kernel_handle_t_::setExecInfo(ur_kernel_exec_info_t propName, ZE2UR_CALL(zeKernelSetCacheConfig, (kernel->hKernel.get(), zeCacheConfig);); } else { - logger::error("urKernelSetExecInfo: unsupported ParamName"); + UR_LOG(ERR, "urKernelSetExecInfo: unsupported ParamName"); return UR_RESULT_ERROR_INVALID_VALUE; } } @@ -555,9 +555,8 @@ ur_result_t urKernelGetGroupInfo( // No corresponding enumeration in Level Zero return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; default: { - logger::error( - "Unknown ParamName in urKernelGetGroupInfo: ParamName={}(0x{})", - paramName, logger::toHex(paramName)); + UR_LOG(ERR, "Unknown ParamName in urKernelGetGroupInfo: ParamName={}(0x{})", + paramName, logger::toHex(paramName)); return UR_RESULT_ERROR_INVALID_VALUE; } } @@ -640,9 +639,8 @@ ur_result_t urKernelGetInfo(ur_kernel_handle_t hKernel, return ReturnValue(static_cast(attributes.data())); } default: - logger::error( - "Unsupported ParamName in urKernelGetInfo: ParamName={}(0x{})", - paramName, logger::toHex(paramName)); + UR_LOG(ERR, "Unsupported ParamName in urKernelGetInfo: ParamName={}(0x{})", + paramName, logger::toHex(paramName)); return UR_RESULT_ERROR_INVALID_VALUE; } diff --git a/unified-runtime/source/adapters/level_zero/v2/memory.cpp b/unified-runtime/source/adapters/level_zero/v2/memory.cpp index 5f8d9c135273..133ba9f6b93f 100644 --- a/unified-runtime/source/adapters/level_zero/v2/memory.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/memory.cpp @@ -88,7 +88,7 @@ ur_integrated_buffer_handle_t::ur_integrated_buffer_handle_t( this->ptr = usm_unique_ptr_t(rawPtr, [hContext](void *ptr) { auto ret = hContext->getDefaultUSMPool()->free(ptr); if (ret != UR_RESULT_SUCCESS) { - logger::error("Failed to free host memory: {}", ret); + UR_LOG(ERR, "Failed to free host memory: {}", ret); } }); @@ -168,7 +168,7 @@ void *ur_discrete_buffer_handle_t::allocateOnDevice(ur_device_handle_t hDevice, usm_unique_ptr_t(ptr, [hContext = this->hContext](void *ptr) { auto ret = hContext->getDefaultUSMPool()->free(ptr); if (ret != UR_RESULT_SUCCESS) { - logger::error("Failed to free device memory: {}", ret); + UR_LOG(ERR, "Failed to free device memory: {}", ret); } }); @@ -298,7 +298,7 @@ void *ur_discrete_buffer_handle_t::mapHostPtr( if (ownsAlloc) { auto ret = hContext->getDefaultUSMPool()->free(p); if (ret != UR_RESULT_SUCCESS) { - logger::error("Failed to mapped memory: {}", ret); + UR_LOG(ERR, "Failed to mapped memory: {}", ret); } } }); @@ -728,7 +728,7 @@ ur_result_t urMemImageGetInfo(ur_mem_handle_t /*hMemory*/, ur_image_info_t /*propName*/, size_t /*propSize*/, void * /*pPropValue*/, size_t * /*pPropSizeRet*/) { - logger::error("{} function not implemented!", __FUNCTION__); + UR_LOG(ERR, "{} function not implemented!", __FUNCTION__); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp b/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp index 62f815eecc4c..9b092e0200e7 100644 --- a/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/queue_immediate_in_order.cpp @@ -129,9 +129,10 @@ ur_queue_immediate_in_order_t::queueGetInfo(ur_queue_info_t propName, } } default: - logger::error("Unsupported ParamName in urQueueGetInfo: " - "ParamName=ParamName={}(0x{})", - propName, logger::toHex(propName)); + UR_LOG(ERR, + "Unsupported ParamName in urQueueGetInfo: " + "ParamName=ParamName={}(0x{})", + propName, logger::toHex(propName)); return UR_RESULT_ERROR_INVALID_VALUE; } @@ -178,7 +179,7 @@ ur_queue_immediate_in_order_t::~ur_queue_immediate_in_order_t() { try { UR_CALL_THROWS(queueFinish()); } catch (...) { - logger::error("Failed to finish queue on destruction"); + UR_LOG(ERR, "Failed to finish queue on destruction"); } } diff --git a/unified-runtime/source/adapters/level_zero/v2/usm.cpp b/unified-runtime/source/adapters/level_zero/v2/usm.cpp index 18da0c37776e..80bd2f6c7cb5 100644 --- a/unified-runtime/source/adapters/level_zero/v2/usm.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/usm.cpp @@ -163,7 +163,7 @@ ur_usm_pool_handle_t_::ur_usm_pool_handle_t_(ur_context_handle_t hContext, } } else { // If pooling is disabled, do nothing. - logger::info("USM pooling is disabled. Skiping pool limits adjustment."); + UR_LOG(INFO, "USM pooling is disabled. Skiping pool limits adjustment."); } auto devicesAndSubDevices = @@ -236,7 +236,7 @@ ur_result_t ur_usm_pool_handle_t_::free(void *ptr) { if (umfPool) { return umf::umf2urResult(umfPoolFree(umfPool, ptr)); } else { - logger::error("Failed to find pool for pointer: {}", ptr); + UR_LOG(ERR, "Failed to find pool for pointer: {}", ptr); return UR_RESULT_ERROR_INVALID_VALUE; } } @@ -439,7 +439,7 @@ ur_result_t urUSMGetMemAllocInfo( memAllocType = UR_USM_TYPE_SHARED; break; default: - logger::error("urUSMGetMemAllocInfo: unexpected usm memory type"); + UR_LOG(ERR, "urUSMGetMemAllocInfo: unexpected usm memory type"); return UR_RESULT_ERROR_INVALID_VALUE; } return ReturnValue(memAllocType); @@ -468,7 +468,7 @@ ur_result_t urUSMGetMemAllocInfo( // TODO return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; default: - logger::error("urUSMGetMemAllocInfo: unsupported ParamName"); + UR_LOG(ERR, "urUSMGetMemAllocInfo: unsupported ParamName"); return UR_RESULT_ERROR_INVALID_VALUE; } } diff --git a/unified-runtime/source/adapters/level_zero/virtual_mem.cpp b/unified-runtime/source/adapters/level_zero/virtual_mem.cpp index 092edc8ed1f9..f61c8fd43fe2 100644 --- a/unified-runtime/source/adapters/level_zero/virtual_mem.cpp +++ b/unified-runtime/source/adapters/level_zero/virtual_mem.cpp @@ -38,8 +38,8 @@ ur_result_t urVirtualMemGranularityGetInfo( return ReturnValue(PageSize); } default: - logger::error("Unsupported propName in urQueueGetInfo: propName={}({})", - propName, propName); + UR_LOG(ERR, "Unsupported propName in urQueueGetInfo: propName={}({})", + propName, propName); return UR_RESULT_ERROR_INVALID_VALUE; } return UR_RESULT_SUCCESS; @@ -120,8 +120,8 @@ ur_result_t urVirtualMemGetInfo(ur_context_handle_t hContext, return ReturnValue(RetFlags); } default: - logger::error("Unsupported propName in urQueueGetInfo: propName={}({})", - propName, propName); + UR_LOG(ERR, "Unsupported propName in urQueueGetInfo: propName={}({})", + propName, propName); return UR_RESULT_ERROR_INVALID_VALUE; } diff --git a/unified-runtime/source/adapters/native_cpu/common.hpp b/unified-runtime/source/adapters/native_cpu/common.hpp index ab70b0225748..cded1c606be9 100644 --- a/unified-runtime/source/adapters/native_cpu/common.hpp +++ b/unified-runtime/source/adapters/native_cpu/common.hpp @@ -21,23 +21,20 @@ extern thread_local char ErrorMessage[MaxMessageSize]; #define DIE_NO_IMPLEMENTATION \ do { \ - logger::error("Not Implemented : {} - File : {} / Line : {}", \ - __FUNCTION__, __FILE__, __LINE__); \ - \ + UR_LOG(ERR, "Not Implemented : {}", __FUNCTION__) \ return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; \ } while (false) #define CONTINUE_NO_IMPLEMENTATION \ do { \ - logger::warning("Not Implemented : {} - File : {} / Line : {}", \ - __FUNCTION__, __FILE__, __LINE__); \ + UR_LOG(WARN, "Not Implemented : {}", __FUNCTION__) \ return UR_RESULT_SUCCESS; \ } while (false) #define CASE_UR_UNSUPPORTED(not_supported) \ case not_supported: \ - logger::error("Unsupported UR case : {} in {}:{}({})", #not_supported, \ - __FUNCTION__, __LINE__, __FILE__); \ + UR_LOG(ERR, "Unsupported UR case : {} in {}", #not_supported, \ + __FUNCTION__) \ return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; // Todo: replace this with a common helper once it is available diff --git a/unified-runtime/source/adapters/native_cpu/device.cpp b/unified-runtime/source/adapters/native_cpu/device.cpp index 9214179b5c70..b220b227c6e3 100644 --- a/unified-runtime/source/adapters/native_cpu/device.cpp +++ b/unified-runtime/source/adapters/native_cpu/device.cpp @@ -99,7 +99,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet(ur_platform_handle_t hPlatform, if (NumEntries == 0) { /// Runtime queries number of devices if (phDevices != nullptr) { - logger::error("Invalid Arguments for urDevicesGet"); + UR_LOG(ERR, "Invalid Arguments for urDevicesGet"); return UR_RESULT_ERROR_INVALID_VALUE; } return UR_RESULT_SUCCESS; diff --git a/unified-runtime/source/adapters/native_cpu/platform.cpp b/unified-runtime/source/adapters/native_cpu/platform.cpp index 7c3ba7099210..b8073a16eef4 100644 --- a/unified-runtime/source/adapters/native_cpu/platform.cpp +++ b/unified-runtime/source/adapters/native_cpu/platform.cpp @@ -29,7 +29,7 @@ urPlatformGet(ur_adapter_handle_t, uint32_t NumEntries, if (NumEntries == 0) { if (phPlatforms != nullptr) { - logger::error("Invalid argument combination for urPlatformsGet"); + UR_LOG(ERR, "Invalid argument combination for urPlatformsGet"); return UR_RESULT_ERROR_INVALID_VALUE; } return UR_RESULT_SUCCESS; diff --git a/unified-runtime/source/adapters/opencl/context.cpp b/unified-runtime/source/adapters/opencl/context.cpp index 43374bb5485d..9f91fabba87c 100644 --- a/unified-runtime/source/adapters/opencl/context.cpp +++ b/unified-runtime/source/adapters/opencl/context.cpp @@ -158,9 +158,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextSetExtendedDeleter( ur_context_handle_t hContext, ur_context_extended_deleter_t pfnDeleter, void *pUserData) { if (!ur::cl::getAdapter()->clSetContextDestructorCallback) { - ur::cl::getAdapter()->log.warning( - "clSetContextDestructorCallback not found, consider upgrading the " - "OpenCL-ICD-Loader to the latest version."); + UR_LOG_L(ur::cl::getAdapter()->log, WARN, + "clSetContextDestructorCallback not found, consider upgrading the " + "OpenCL-ICD-Loader to the latest version."); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/unified-runtime/source/common/latency_tracker.hpp b/unified-runtime/source/common/latency_tracker.hpp index b8af6c6de527..539db936f61d 100644 --- a/unified-runtime/source/common/latency_tracker.hpp +++ b/unified-runtime/source/common/latency_tracker.hpp @@ -31,7 +31,7 @@ static inline bool trackLatency = []() { auto it = map->find("level"); return it != map->end() && - logger::str_to_level(it->second.front()) != logger::Level::QUIET; + logger::str_to_level(it->second.front()) != UR_LOGGER_LEVEL_QUIET; } catch (...) { return false; } @@ -64,7 +64,7 @@ static inline latencyValues getValues(const struct hdr_histogram *histogram) { auto ret = hdr_value_at_percentiles(histogram, percentiles, values.percentileValues, numPercentiles); if (ret != 0) { - logger::error("Failed to get percentiles from latency histogram"); + UR_LOG(ERR, "Failed to get percentiles from latency histogram"); } return values; @@ -94,7 +94,7 @@ class latency_printer { for (auto &[name, histogram] : values) { auto value = getValues(histogram.get()); auto f = groupDigits; - logger.log(logger::Level::INFO, + logger.log(UR_LOGGER_LEVEL_INFO, "{},{},{},{},{},{},{},{},{},{},{},{},{},{},ns", name, f(value.mean), f(value.percentileValues[0]), f(value.percentileValues[1]), f(value.percentileValues[2]), @@ -107,8 +107,8 @@ class latency_printer { private: inline void printHeader() { - logger.log(logger::Level::INFO, "Latency histogram:"); - logger.log(logger::Level::INFO, + logger.log(UR_LOGGER_LEVEL_INFO, "Latency histogram:"); + logger.log(UR_LOGGER_LEVEL_INFO, "name,mean,p{},p{},p{},p{},p{},p{}" ",p{},count,sum,min,max,stdev,unit", percentiles[0], percentiles[1], percentiles[2], percentiles[3], @@ -137,7 +137,7 @@ class latency_histogram { auto ret = hdr_init(lowestDiscernibleValue, highestTrackableValue, significantFigures, &cHistogram); if (ret != 0) { - logger::error("Failed to initialize latency histogram"); + UR_LOG(ERR, "Failed to initialize latency histogram"); } histogram = std::unique_ptr( cHistogram, &hdr_close); @@ -153,7 +153,7 @@ class latency_histogram { } if (hdr_min(histogram.get()) == std::numeric_limits::max()) { - logger::info("[{}] latency: no data", name); + UR_LOG(INFO, "[{}] latency: no data", name); return; } diff --git a/unified-runtime/source/common/linux/ur_lib_loader.cpp b/unified-runtime/source/common/linux/ur_lib_loader.cpp index 4f489e6746dd..621e45bb8133 100644 --- a/unified-runtime/source/common/linux/ur_lib_loader.cpp +++ b/unified-runtime/source/common/linux/ur_lib_loader.cpp @@ -25,10 +25,10 @@ void LibLoader::freeAdapterLibrary(HMODULE handle) { if (handle) { int res = dlclose(handle); if (res) { - logger::error( - "Failed to unload the library with the handle at address {}", handle); + UR_LOG(ERR, "Failed to unload the library with the handle at address {}", + handle); } else { - logger::info("unloaded adapter 0x{}", handle); + UR_LOG(INFO, "unloaded adapter 0x{}", handle); } } } @@ -40,10 +40,10 @@ LibLoader::loadAdapterLibrary(const char *name) { bool deepbind = getenv_tobool(DEEP_BIND_ENV); if (deepbind) { #if defined(SANITIZER_ANY) - logger::warning( - "Enabling RTLD_DEEPBIND while running under a sanitizer is likely " - "to cause issues. Consider disabling {} environment variable.", - DEEP_BIND_ENV); + UR_LOG(WARN + "Enabling RTLD_DEEPBIND while running under a sanitizer is likely " + "to cause issues. Consider disabling {} environment variable.", + DEEP_BIND_ENV); #endif mode |= RTLD_DEEPBIND; } @@ -58,21 +58,21 @@ LibLoader::loadAdapterLibrary(const char *name) { (strstr(err, name) == NULL || strstr(err, "required by") != NULL)) { // If the adapter cannot be loaded due to missing dependencies or any // other related error, it is considered as an error. - logger::info("failed to load adapter '{}' with error: {}", name, err); + UR_LOG(INFO, "failed to load adapter '{}' with error: {}", name, err); } else { // Simply having the adapter library missing isn't an error. - logger::info("failed to load adapter '{}' with error: {}", name, - err ? err : "unknown error"); + UR_LOG(INFO, "failed to load adapter '{}' with error: {}", name, + err ? err : "unknown error"); } } else { #if defined(ADD_FULL_PATH_LOG) struct link_map *dlinfo_map; if (dlinfo(handle, RTLD_DI_LINKMAP, &dlinfo_map) == 0) { - logger::info("loaded adapter 0x{} ({}) from {}", handle, name, - dlinfo_map->l_name); + UR_LOG(INFO, "loaded adapter 0x{} ({}) from {}", handle, name, + dlinfo_map->l_name); } else #endif - logger::info("loaded adapter 0x{} ({})", handle, name); + UR_LOG(INFO, "loaded adapter 0x{} ({})", handle, name); } return std::unique_ptr(handle); } diff --git a/unified-runtime/source/common/logger/ur_logger.hpp b/unified-runtime/source/common/logger/ur_logger.hpp index c6db9e4d9d79..fc41445aff6a 100644 --- a/unified-runtime/source/common/logger/ur_logger.hpp +++ b/unified-runtime/source/common/logger/ur_logger.hpp @@ -30,56 +30,15 @@ get_logger(std::string name = "common", inline void init(const std::string &name) { get_logger(name.c_str()); } -template -inline void debug(const char *format, Args &&...args) { - get_logger().log(UR_LOGGER_LEVEL_DEBUG, format, std::forward(args)...); -} - -template -inline void info(const char *format, Args &&...args) { - get_logger().log(UR_LOGGER_LEVEL_INFO, format, std::forward(args)...); -} +// use log level as a first parameter +// available levels: QUIET, ERR, WARN, INFO, DEBUG +#define UR_LOG(level, ...) URLOG_(::logger::get_logger(), level, __VA_ARGS__) -template -inline void warning(const char *format, Args &&...args) { - get_logger().log(UR_LOGGER_LEVEL_WARN, format, std::forward(args)...); -} - -template -inline void error(const char *format, Args &&...args) { - get_logger().log(UR_LOGGER_LEVEL_ERROR, format, std::forward(args)...); -} - -template -inline void always(const char *format, Args &&...args) { - get_logger().always(format, std::forward(args)...); -} - -template -inline void debug(const logger::LegacyMessage &p, const char *format, - Args &&...args) { - get_logger().log(p, UR_LOGGER_LEVEL_DEBUG, format, - std::forward(args)...); -} - -template -inline void info(logger::LegacyMessage p, const char *format, Args &&...args) { - get_logger().log(p, UR_LOGGER_LEVEL_INFO, format, - std::forward(args)...); -} - -template -inline void warning(logger::LegacyMessage p, const char *format, - Args &&...args) { - get_logger().log(p, UR_LOGGER_LEVEL_WARN, format, - std::forward(args)...); -} - -template -inline void error(logger::LegacyMessage p, const char *format, Args &&...args) { - get_logger().log(p, UR_LOGGER_LEVEL_ERROR, format, - std::forward(args)...); -} +// TODO: consider removing UR_LOG_L and maybe UR_LOG_LEGACY macros, using UR_LOG +// instead +#define UR_LOG_LEGACY(level, legacy_message, ...) \ + URLOG_L_(::logger::get_logger(), level, legacy_message, __VA_ARGS__) +#define UR_LOG_L(logger, level, ...) URLOG_(logger, level, __VA_ARGS__) inline void setLevel(ur_logger_level_t level) { get_logger().setLevel(level); } @@ -93,6 +52,20 @@ template inline std::string toHex(T t) { return s.str(); } +inline bool str_to_bool(const std::string &str) { + if (!str.empty()) { + std::string lower_value = str; + std::transform(lower_value.begin(), lower_value.end(), lower_value.begin(), + [](unsigned char c) { return std::tolower(c); }); + const std::initializer_list true_str = {"y", "yes", "t", + "true", "1"}; + return std::find(true_str.begin(), true_str.end(), lower_value) != + true_str.end(); + } + + return false; +} + /// @brief Create an instance of the logger with parameters obtained from the /// respective /// environment variable or with default configuration if the env var is @@ -126,9 +99,11 @@ inline Logger create_logger(std::string logger_name, bool skip_prefix, const std::string env_var_name = "UR_LOG_" + logger_name; const auto default_flush_level = UR_LOGGER_LEVEL_ERROR; const std::string default_output = "stderr"; + const bool default_fileline = false; auto flush_level = default_flush_level; ur_logger_level_t level = default_log_level; - std::unique_ptr sink; + bool fileline = default_fileline; + std::unique_ptr sink; try { auto map = getenv_to_map(env_var_name.c_str()); @@ -152,6 +127,13 @@ inline Logger create_logger(std::string logger_name, bool skip_prefix, map->erase(kv); } + kv = map->find("fileline"); + if (kv != map->end()) { + auto value = kv->second.front(); + fileline = str_to_bool(std::move(value)); + map->erase(kv); + } + std::vector values = {default_output}; kv = map->find("output"); if (kv != map->end()) { @@ -181,6 +163,7 @@ inline Logger create_logger(std::string logger_name, bool skip_prefix, } sink->setFlushLevel(flush_level); + sink->setFileLine(fileline); return Logger(level, std::move(sink)); } diff --git a/unified-runtime/source/common/logger/ur_logger_details.hpp b/unified-runtime/source/common/logger/ur_logger_details.hpp index e917c31622da..abee28977d93 100644 --- a/unified-runtime/source/common/logger/ur_logger_details.hpp +++ b/unified-runtime/source/common/logger/ur_logger_details.hpp @@ -43,84 +43,38 @@ class Logger { } } - template void debug(const char *format, Args &&...args) { - log(UR_LOGGER_LEVEL_DEBUG, format, std::forward(args)...); - } - - template void info(const char *format, Args &&...args) { - log(UR_LOGGER_LEVEL_INFO, format, std::forward(args)...); - } - - template void warning(const char *format, Args &&...args) { - log(UR_LOGGER_LEVEL_WARN, format, std::forward(args)...); - } - - template void warn(const char *format, Args &&...args) { - warning(format, std::forward(args)...); - } - - template void error(const char *format, Args &&...args) { - log(UR_LOGGER_LEVEL_ERROR, format, std::forward(args)...); - } - - template void always(const char *format, Args &&...args) { - if (standardSink) { - standardSink->log(UR_LOGGER_LEVEL_QUIET, format, - std::forward(args)...); - } - } - - template - void debug(const logger::LegacyMessage &p, const char *format, - Args &&...args) { - log(p, UR_LOGGER_LEVEL_DEBUG, format, std::forward(args)...); - } - - template - void info(const logger::LegacyMessage &p, const char *format, - Args &&...args) { - log(p, UR_LOGGER_LEVEL_INFO, format, std::forward(args)...); - } - - template - void warning(const logger::LegacyMessage &p, const char *format, - Args &&...args) { - log(p, UR_LOGGER_LEVEL_WARN, format, std::forward(args)...); - } - template - void error(const logger::LegacyMessage &p, const char *format, - Args &&...args) { - log(p, UR_LOGGER_LEVEL_ERROR, format, std::forward(args)...); - } - - template - void log(ur_logger_level_t level, const char *format, Args &&...args) { - log(logger::LegacyMessage(format), level, format, + void log(ur_logger_level_t level, const char *filename, const char *lineno, + const char *format, Args &&...args) { + log(logger::LegacyMessage(format), level, filename, lineno, format, std::forward(args)...); } template void log(const logger::LegacyMessage &p, ur_logger_level_t level, - const char *format, Args &&...args) { + const char *filename, const char *lineno, const char *format, + Args &&...args) { if (callbackSink && level >= this->callbackSinkLevel) { - callbackSink->log(level, format, std::forward(args)...); + callbackSink->log(level, filename, lineno, format, + std::forward(args)...); } if (standardSink) { if (isLegacySink) { - standardSink->log(level, p.message, std::forward(args)...); + standardSink->log(level, filename, lineno, p.message, + std::forward(args)...); return; } if (level < this->standardSinkLevel) { return; } - standardSink->log(level, format, std::forward(args)...); + standardSink->log(level, filename, lineno, format, + std::forward(args)...); } } - void setLegacySink(std::unique_ptr legacySink) { + void setLegacySink(std::unique_ptr legacySink) { this->isLegacySink = true; this->standardSink = std::move(legacySink); } @@ -152,4 +106,56 @@ class Logger { } // namespace logger +#ifdef SRC_PATH_SIZE +#define SHORT_FILE \ + ((SRC_PATH_SIZE < sizeof(__FILE__)) \ + ? ((const char *)__FILE__ + SRC_PATH_SIZE) \ + : __FILE__) +#else +#define SHORT_FILE __FILE__ +#endif + +#define UR_STRIMPL_(x) #x +#define UR_STR_(x) UR_STRIMPL_(x) + +#define URLOG2_(logger_instance, level, ...) \ + { \ + (logger_instance).log(level, SHORT_FILE, UR_STR_(__LINE__), __VA_ARGS__); \ + } +#define URLOG_L2_(logger_instance, level, legacy_message, ...) \ + { \ + (logger_instance) \ + .log(legacy_message, level, SHORT_FILE, UR_STR_(__LINE__), \ + __VA_ARGS__); \ + } + +// some symbols usefuls for log levels are predfined in some systems, +// eg. ERROR on Windows +#define URLOG_ERR(logger_instance, ...) \ + URLOG2_(logger_instance, UR_LOGGER_LEVEL_ERROR, __VA_ARGS__) +#define URLOG_WARN(logger_instance, ...) \ + URLOG2_(logger_instance, UR_LOGGER_LEVEL_WARN, __VA_ARGS__) +#define URLOG_DEBUG(logger_instance, ...) \ + URLOG2_(logger_instance, UR_LOGGER_LEVEL_DEBUG, __VA_ARGS__) +#define URLOG_INFO(logger_instance, ...) \ + URLOG2_(logger_instance, UR_LOGGER_LEVEL_INFO, __VA_ARGS__) +#define URLOG_QUIET(logger_instance, ...) \ + URLOG2_(logger_instance, UR_LOGGER_LEVEL_QUIET, __VA_ARGS__) + +#define URLOG_L_ERR(logger_instance, legacy_message, ...) \ + URLOG_L2_(logger_instance, UR_LOGGER_LEVEL_ERROR, legacy_message, __VA_ARGS__) +#define URLOG_L_WARN(logger_instance, legacy_message, ...) \ + URLOG_L2_(logger_instance, UR_LOGGER_LEVEL_WARN, legacy_message, __VA_ARGS__) +#define URLOG_L_DEBUG(logger_instance, legacy_message, ...) \ + URLOG_L2_(logger_instance, UR_LOGGER_LEVEL_DEBUG, legacy_message, __VA_ARGS__) +#define URLOG_L_INFO(logger_instance, legacy_message, ...) \ + URLOG_L2_(logger_instance, UR_LOGGER_LEVEL_INFO, legacy_message, __VA_ARGS__) +#define URLOG_L_QUIET(logger_instance, legacy_message, ...) \ + URLOG_L2_(logger_instance, UR_LOGGER_LEVEL_QUIET, legacy_message, __VA_ARGS__) + +#define URLOG_(logger_instance, level, ...) \ + URLOG_##level(logger_instance, __VA_ARGS__) +#define URLOG_L_(logger_instance, level, legacy_message, ...) \ + URLOG_L_##level(logger_instance, legacy_message, __VA_ARGS__) + #endif /* UR_LOGGER_DETAILS_HPP */ diff --git a/unified-runtime/source/common/logger/ur_sinks.hpp b/unified-runtime/source/common/logger/ur_sinks.hpp index 0fdb0e966309..1e49cddac5d9 100644 --- a/unified-runtime/source/common/logger/ur_sinks.hpp +++ b/unified-runtime/source/common/logger/ur_sinks.hpp @@ -27,14 +27,21 @@ inline bool isTearDowned = false; class Sink { public: template - void log(ur_logger_level_t level, const char *fmt, Args &&...args) { + void log(ur_logger_level_t level, const char *filename, const char *lineno, + const char *fmt, Args &&...args) { std::ostringstream buffer; if (!skip_prefix && level != UR_LOGGER_LEVEL_QUIET) { buffer << "<" << logger_name << ">" << "[" << level_to_str(level) << "]: "; } - format(buffer, fmt, std::forward(args)...); + format(buffer, filename, lineno, fmt, std::forward(args)...); + if (add_fileline) { + buffer << " <" << filename << ":" << lineno << ">"; + } + if (!skip_linebreak) { + buffer << "\n"; + } // This is a temporary workaround on windows, where UR adapter is teardowned // before the UR loader, which will result in access violation when we use print // function as the overrided print function was already released with the UR @@ -52,6 +59,7 @@ class Sink { #endif } + void setFileLine(bool fileline) { add_fileline = fileline; } void setFlushLevel(ur_logger_level_t level) { this->flush_level = level; } virtual ~Sink() = default; @@ -63,7 +71,7 @@ class Sink { Sink(std::string logger_name, bool skip_prefix = false, bool skip_linebreak = false) : logger_name(std::move(logger_name)), skip_prefix(skip_prefix), - skip_linebreak(skip_linebreak) { + skip_linebreak(skip_linebreak), add_fileline(false) { ostream = nullptr; flush_level = UR_LOGGER_LEVEL_ERROR; } @@ -78,12 +86,14 @@ class Sink { private: std::string logger_name; - bool skip_prefix; - bool skip_linebreak; + const bool skip_prefix; + const bool skip_linebreak; + bool add_fileline; std::mutex output_mutex; const char *error_prefix = "Log message syntax error: "; - void format(std::ostringstream &buffer, const char *fmt) { + void format(std::ostringstream &buffer, const char *filename, + const char *lineno, const char *fmt) { while (*fmt != '\0') { while (*fmt != '{' && *fmt != '}' && *fmt != '\0') { buffer << *fmt++; @@ -95,25 +105,22 @@ class Sink { } else { std::cerr << error_prefix << "No arguments provided and braces not escaped!" - << std::endl; + << filename << ":" << lineno << std::endl; } } else if (*fmt == '}') { if (*(++fmt) == '}') { buffer << *fmt++; } else { std::cerr << error_prefix << "Closing curly brace not escaped!" - << std::endl; + << filename << ":" << lineno << std::endl; } } } - if (!skip_linebreak) { - buffer << "\n"; - } } template - void format(std::ostringstream &buffer, const char *fmt, Arg &&arg, - Args &&...args) { + void format(std::ostringstream &buffer, const char *filename, + const char *lineno, const char *fmt, Arg &&arg, Args &&...args) { bool arg_printed = false; while (!arg_printed) { while (*fmt != '{' && *fmt != '}' && *fmt != '\0') { @@ -125,7 +132,7 @@ class Sink { buffer << *fmt++; } else if (*fmt != '}') { std::cerr << error_prefix << "Only empty braces are allowed!" - << std::endl; + << filename << ":" << lineno << std::endl; } else { buffer << arg; arg_printed = true; @@ -135,19 +142,20 @@ class Sink { buffer << *fmt++; } else { std::cerr << error_prefix << "Closing curly brace not escaped!" - << std::endl; + << filename << ":" << lineno << std::endl; } } if (*fmt == '\0') { - std::cerr << error_prefix << "Too many arguments!" << std::endl; + std::cerr << error_prefix << filename << ":" << lineno + << "Too many arguments! first excessive:" << arg << std::endl; // ignore all left arguments and finalize message - format(buffer, fmt); + format(buffer, filename, lineno, fmt); return; } } - format(buffer, ++fmt, std::forward(args)...); + format(buffer, filename, lineno, ++fmt, std::forward(args)...); } }; @@ -250,14 +258,14 @@ inline std::unique_ptr sink_from_str(std::string logger_name, bool skip_prefix = false, bool skip_linebreak = false) { if (name == "stdout" && file_path.empty()) { - return std::make_unique(logger_name, skip_prefix, - skip_linebreak); + return std::make_unique(logger_name, skip_prefix, + skip_linebreak); } else if (name == "stderr" && file_path.empty()) { - return std::make_unique(logger_name, skip_prefix, - skip_linebreak); + return std::make_unique(logger_name, skip_prefix, + skip_linebreak); } else if (name == "file" && !file_path.empty()) { - return std::make_unique(logger_name, file_path, - skip_prefix, skip_linebreak); + return std::make_unique(logger_name, file_path, skip_prefix, + skip_linebreak); } throw std::invalid_argument( diff --git a/unified-runtime/source/common/umf_helpers.hpp b/unified-runtime/source/common/umf_helpers.hpp index 12432bd933bc..1a9d2e56a5ba 100644 --- a/unified-runtime/source/common/umf_helpers.hpp +++ b/unified-runtime/source/common/umf_helpers.hpp @@ -296,7 +296,7 @@ inline ur_result_t umf2urResult(umf_result_t umfResult) { umfMemoryProviderGetLastNativeError(hProvider, &Msg, &Err); if (Msg) { - logger::error("UMF failed with: {}", Msg); + UR_LOG(ERR, "UMF failed with: {}", Msg); } return getProviderNativeError(umfMemoryProviderGetName(hProvider), Err); diff --git a/unified-runtime/source/common/ur_pool_manager.hpp b/unified-runtime/source/common/ur_pool_manager.hpp index 6ea0d28db865..90751f478891 100644 --- a/unified-runtime/source/common/ur_pool_manager.hpp +++ b/unified-runtime/source/common/ur_pool_manager.hpp @@ -176,7 +176,7 @@ template struct pool_manager { ur_result_t addPool(const D &desc, unique_pool_handle_t &&hPool) { if (!descToPoolMap.try_emplace(desc, std::move(hPool)).second) { - logger::error("Pool for pool descriptor: {}, already exists", desc); + UR_LOG(ERR, "Pool for pool descriptor: {}, already exists", desc); return UR_RESULT_ERROR_INVALID_ARGUMENT; } @@ -186,8 +186,7 @@ template struct pool_manager { std::optional getPool(const D &desc) { auto it = descToPoolMap.find(desc); if (it == descToPoolMap.end()) { - logger::error("Pool descriptor doesn't match any existing pool: {}", - desc); + UR_LOG(ERR, "Pool descriptor doesn't match any existing pool: {}", desc); return std::nullopt; } diff --git a/unified-runtime/source/common/ur_util.cpp b/unified-runtime/source/common/ur_util.cpp index 268a8dc0a223..6978a3958264 100644 --- a/unified-runtime/source/common/ur_util.cpp +++ b/unified-runtime/source/common/ur_util.cpp @@ -45,14 +45,14 @@ int ur_duplicate_fd(int pid, int fd_in) { errno = 0; int pid_fd = syscall(__NR_pidfd_open, pid, 0); if (pid_fd == -1) { - logger::error("__NR_pidfd_open"); + UR_LOG(ERR, "__NR_pidfd_open"); return -1; } int fd_dup = syscall(__NR_pidfd_getfd, pid_fd, fd_in, 0); close(pid_fd); if (fd_dup == -1) { - logger::error("__NR_pidfd_getfd"); + UR_LOG(ERR, "__NR_pidfd_getfd"); return -1; } @@ -63,7 +63,7 @@ int ur_duplicate_fd(int pid, int fd_in) { (void)pid; // unused (void)fd_in; // unused errno = ENOTSUP; // unsupported - logger::error("__NR_pidfd_open or __NR_pidfd_getfd not available"); + UR_LOG(ERR, "__NR_pidfd_open or __NR_pidfd_getfd not available"); return -1; #endif /* defined(__NR_pidfd_open) && defined(__NR_pidfd_getfd) */ } diff --git a/unified-runtime/source/common/windows/ur_lib_loader.cpp b/unified-runtime/source/common/windows/ur_lib_loader.cpp index a3a86c2e7c6e..1ceab4389aef 100644 --- a/unified-runtime/source/common/windows/ur_lib_loader.cpp +++ b/unified-runtime/source/common/windows/ur_lib_loader.cpp @@ -17,11 +17,11 @@ void LibLoader::freeAdapterLibrary(HMODULE handle) { if (handle) { BOOL res = FreeLibrary(handle); if (!res) { - logger::error( - "Failed to unload the library with the handle at address 0x{}", - handle); + UR_LOG(ERR, + "Failed to unload the library with the handle at address 0x{}", + handle); } else { - logger::info("unloaded adapter 0x{}", handle); + UR_LOG(INFO, "unloaded adapter 0x{}", handle); } } } @@ -29,11 +29,11 @@ void LibLoader::freeAdapterLibrary(HMODULE handle) { std::unique_ptr LibLoader::loadAdapterLibrary(const char *name) { if (HMODULE handle = LoadLibraryExA(name, nullptr, 0)) { - logger::info("loaded adapter 0x{}: {}", handle, name); + UR_LOG(INFO, "loaded adapter 0x{}: {}", handle, name); return std::unique_ptr{handle}; } else { - logger::debug("loading adapter failed with error {}: {}", GetLastError(), - name); + UR_LOG(DEBUG, "loading adapter failed with error {}: {}", GetLastError(), + name); } return nullptr; } diff --git a/unified-runtime/source/loader/layers/sanitizer/asan/asan_allocator.cpp b/unified-runtime/source/loader/layers/sanitizer/asan/asan_allocator.cpp index 248af595e33b..9a100cd4bc5a 100644 --- a/unified-runtime/source/loader/layers/sanitizer/asan/asan_allocator.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/asan/asan_allocator.cpp @@ -18,10 +18,10 @@ namespace ur_sanitizer_layer { namespace asan { void AllocInfo::print() { - getContext()->logger.info( - "AllocInfo(Alloc=[{}-{}), User=[{}-{}), AllocSize={}, Type={})", - (void *)AllocBegin, (void *)(AllocBegin + AllocSize), (void *)UserBegin, - (void *)(UserEnd), AllocSize, ToString(Type)); + UR_LOG_L(getContext()->logger, INFO, + "AllocInfo(Alloc=[{}-{}), User=[{}-{}), AllocSize={}, Type={})", + (void *)AllocBegin, (void *)(AllocBegin + AllocSize), + (void *)UserBegin, (void *)(UserEnd), AllocSize, ToString(Type)); } } // namespace asan diff --git a/unified-runtime/source/loader/layers/sanitizer/asan/asan_buffer.cpp b/unified-runtime/source/loader/layers/sanitizer/asan/asan_buffer.cpp index 2bc055caa0ff..fae4e024d272 100644 --- a/unified-runtime/source/loader/layers/sanitizer/asan/asan_buffer.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/asan/asan_buffer.cpp @@ -97,8 +97,8 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { Size, AllocType::MEM_BUFFER, ur_cast(&Allocation)); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error( - "Failed to allocate {} bytes memory for buffer {}", Size, this); + UR_LOG_L(getContext()->logger, ERR, + "Failed to allocate {} bytes memory for buffer {}", Size, this); return URes; } @@ -107,9 +107,10 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { URes = getContext()->urDdiTable.Enqueue.pfnUSMMemcpy( Queue, true, Allocation, HostPtr, Size, 0, nullptr, nullptr); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to copy {} bytes data from host " - "pointer {} to buffer {}", - Size, HostPtr, this); + UR_LOG_L( + getContext()->logger, ERR, + "Failed to copy {} bytes data from host pointer {} to buffer {}", + Size, HostPtr, this); return URes; } } @@ -134,9 +135,9 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { Context, nullptr, &USMDesc, Pool, Size, AllocType::HOST_USM, ur_cast(&HostAllocation)); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to allocate {} bytes host " - "USM for buffer {} migration", - Size, this); + UR_LOG_L(getContext()->logger, ERR, + "Failed to allocate {} bytes host USM for buffer {} migration", + Size, this); return URes; } } @@ -148,7 +149,8 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { Queue, true, HostAllocation, LastSyncedDevice.MemHandle, Size, 0, nullptr, nullptr); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to migrate memory buffer data"); + UR_LOG_L(getContext()->logger, ERR, + "Failed to migrate memory buffer data"); return URes; } } @@ -159,7 +161,8 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { URes = getContext()->urDdiTable.Enqueue.pfnUSMMemcpy( Queue, true, Allocation, HostAllocation, Size, 0, nullptr, nullptr); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to migrate memory buffer data"); + UR_LOG_L(getContext()->logger, ERR, + "Failed to migrate memory buffer data"); return URes; } } @@ -174,7 +177,8 @@ ur_result_t MemBuffer::free() { for (const auto &[_, Ptr] : Allocations) { ur_result_t URes = getAsanInterceptor()->releaseMemory(Context, Ptr); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to free buffer handle {}", Ptr); + UR_LOG_L(getContext()->logger, ERR, "Failed to free buffer handle {}", + Ptr); return URes; } } diff --git a/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp b/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp index a860373f6be5..6b11c0b6eead 100644 --- a/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp @@ -40,18 +40,20 @@ ur_result_t setupContext(ur_context_handle_t Context, uint32_t numDevices, UR_CALL(getAsanInterceptor()->insertDevice(hDevice, DI)); DI->Type = GetDeviceType(Context, hDevice); if (DI->Type == DeviceType::UNKNOWN) { - getContext()->logger.error("Unsupport device"); + UR_LOG_L(getContext()->logger, ERR, "Unsupport device"); return UR_RESULT_ERROR_INVALID_DEVICE; } if (DI->Type != DeviceType) { - getContext()->logger.error("Different device type in the same context"); + UR_LOG_L(getContext()->logger, ERR, + "Different device type in the same context"); return UR_RESULT_ERROR_INVALID_DEVICE; } - getContext()->logger.info( - "DeviceInfo {} (Type={}, IsSupportSharedSystemUSM={})", - (void *)DI->Handle, ToString(DI->Type), DI->IsSupportSharedSystemUSM); - getContext()->logger.info("Add {} into context {}", (void *)DI->Handle, - (void *)Context); + UR_LOG_L(getContext()->logger, INFO, + "DeviceInfo {} (Type={}, IsSupportSharedSystemUSM={})", + (void *)DI->Handle, ToString(DI->Type), + DI->IsSupportSharedSystemUSM); + UR_LOG_L(getContext()->logger, INFO, "Add {} into context {}", + (void *)DI->Handle, (void *)Context); DI->Shadow = ShadowMemory; CI->DeviceList.emplace_back(hDevice); CI->AllocInfosMap[hDevice]; @@ -111,7 +113,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMHostAlloc( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urUSMHostAlloc"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urUSMHostAlloc"); return getAsanInterceptor()->allocateMemory(hContext, nullptr, pUSMDesc, pool, size, AllocType::HOST_USM, ppMem); @@ -138,7 +140,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMDeviceAlloc( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urUSMDeviceAlloc"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urUSMDeviceAlloc"); return getAsanInterceptor()->allocateMemory( hContext, hDevice, pUSMDesc, pool, size, AllocType::DEVICE_USM, ppMem); @@ -165,7 +167,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMSharedAlloc( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urUSMSharedAlloc"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urUSMSharedAlloc"); return getAsanInterceptor()->allocateMemory( hContext, hDevice, pUSMDesc, pool, size, AllocType::SHARED_USM, ppMem); @@ -184,7 +186,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMFree( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urUSMFree"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urUSMFree"); return getAsanInterceptor()->releaseMemory(hContext, pMem); } @@ -209,7 +211,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urProgramCreateWithIL"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramCreateWithIL"); UR_CALL( pfnProgramCreateWithIL(hContext, pIL, length, pProperties, phProgram)); @@ -245,7 +247,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urProgramCreateWithBinary"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramCreateWithBinary"); UR_CALL(pfnProgramCreateWithBinary(hContext, numDevices, phDevices, pLengths, ppBinaries, pProperties, phProgram)); @@ -272,7 +274,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithNativeHandle( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urProgramCreateWithNativeHandle"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramCreateWithNativeHandle"); UR_CALL(pfnProgramCreateWithNativeHandle(hNativeProgram, hContext, pProperties, phProgram)); @@ -293,7 +295,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramRetain( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urProgramRetain"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramRetain"); UR_CALL(pfnRetain(hProgram)); @@ -320,7 +322,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuild( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urProgramBuild"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramBuild"); auto UrRes = pfnProgramBuild(hContext, hProgram, pOptions); if (UrRes != UR_RESULT_SUCCESS) { @@ -351,7 +353,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuildExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urProgramBuildExp"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramBuildExp"); auto UrRes = pfnBuildExp(hProgram, numDevices, phDevices, pOptions); if (UrRes != UR_RESULT_SUCCESS) { @@ -383,7 +385,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramLink( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urProgramLink"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramLink"); auto UrRes = pfnProgramLink(hContext, count, phPrograms, pOptions, phProgram); if (UrRes != UR_RESULT_SUCCESS) { @@ -421,7 +423,7 @@ ur_result_t UR_APICALL urProgramLinkExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urProgramLinkExp"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramLinkExp"); auto UrRes = pfnProgramLinkExp(hContext, numDevices, phDevices, count, phPrograms, pOptions, phProgram); @@ -447,7 +449,7 @@ ur_result_t UR_APICALL urProgramRelease( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urProgramRelease"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramRelease"); UR_CALL(pfnProgramRelease(hProgram)); @@ -505,7 +507,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urEnqueueKernelLaunch"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueKernelLaunch"); LaunchInfo LaunchInfo(GetContext(hQueue), GetDevice(hQueue), pGlobalWorkSize, pLocalWorkSize, pGlobalWorkOffset, workDim); @@ -548,7 +550,7 @@ __urdlllocal ur_result_t UR_APICALL urContextCreate( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urContextCreate"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urContextCreate"); ur_result_t result = pfnCreate(numDevices, phDevices, pProperties, phContext); @@ -580,7 +582,7 @@ __urdlllocal ur_result_t UR_APICALL urContextCreateWithNativeHandle( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urContextCreateWithNativeHandle"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urContextCreateWithNativeHandle"); ur_result_t result = pfnCreateWithNativeHandle( hNativeContext, hAdapter, numDevices, phDevices, pProperties, phContext); @@ -603,7 +605,7 @@ __urdlllocal ur_result_t UR_APICALL urContextRetain( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urContextRetain"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urContextRetain"); UR_CALL(pfnRetain(hContext)); @@ -625,7 +627,7 @@ __urdlllocal ur_result_t UR_APICALL urContextRelease( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urContextRelease"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urContextRelease"); UR_CALL(pfnRelease(hContext)); @@ -661,7 +663,7 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreate( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } - getContext()->logger.debug("==== urMemBufferCreate"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemBufferCreate"); void *Host = nullptr; if (pProperties) { @@ -715,7 +717,7 @@ __urdlllocal ur_result_t UR_APICALL urMemGetInfo( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urMemGetInfo"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemGetInfo"); if (auto MemBuffer = getAsanInterceptor()->getMemBuffer(hMemory)) { UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet); @@ -748,7 +750,7 @@ __urdlllocal ur_result_t UR_APICALL urMemRetain( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urMemRetain"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemRetain"); if (auto MemBuffer = getAsanInterceptor()->getMemBuffer(hMem)) { MemBuffer->RefCount++; @@ -770,7 +772,7 @@ __urdlllocal ur_result_t UR_APICALL urMemRelease( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urMemRelease"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemRelease"); if (auto MemBuffer = getAsanInterceptor()->getMemBuffer(hMem)) { if (--MemBuffer->RefCount != 0) { @@ -805,7 +807,7 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferPartition( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urMemBufferPartition"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemBufferPartition"); if (auto ParentBuffer = getAsanInterceptor()->getMemBuffer(hBuffer)) { if (ParentBuffer->Size < (pRegion->origin + pRegion->size)) { @@ -836,7 +838,7 @@ __urdlllocal ur_result_t UR_APICALL urMemGetNativeHandle( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urMemGetNativeHandle"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemGetNativeHandle"); if (auto MemBuffer = getAsanInterceptor()->getMemBuffer(hMem)) { char *Handle = nullptr; @@ -880,7 +882,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urEnqueueMemBufferRead"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferRead"); if (auto MemBuffer = getAsanInterceptor()->getMemBuffer(hBuffer)) { ur_device_handle_t Device = GetDevice(hQueue); @@ -928,7 +930,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urEnqueueMemBufferWrite"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferWrite"); if (auto MemBuffer = getAsanInterceptor()->getMemBuffer(hBuffer)) { ur_device_handle_t Device = GetDevice(hQueue); @@ -990,7 +992,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urEnqueueMemBufferReadRect"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferReadRect"); if (auto MemBuffer = getAsanInterceptor()->getMemBuffer(hBuffer)) { char *SrcHandle = nullptr; @@ -1055,7 +1057,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urEnqueueMemBufferWriteRect"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferWriteRect"); if (auto MemBuffer = getAsanInterceptor()->getMemBuffer(hBuffer)) { char *DstHandle = nullptr; @@ -1107,7 +1109,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urEnqueueMemBufferCopy"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferCopy"); auto SrcBuffer = getAsanInterceptor()->getMemBuffer(hBufferSrc); auto DstBuffer = getAsanInterceptor()->getMemBuffer(hBufferDst); @@ -1175,7 +1177,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urEnqueueMemBufferCopyRect"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferCopyRect"); auto SrcBuffer = getAsanInterceptor()->getMemBuffer(hBufferSrc); auto DstBuffer = getAsanInterceptor()->getMemBuffer(hBufferDst); @@ -1237,7 +1239,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urEnqueueMemBufferFill"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferFill"); if (auto MemBuffer = getAsanInterceptor()->getMemBuffer(hBuffer)) { char *Handle = nullptr; @@ -1289,7 +1291,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferMap( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urEnqueueMemBufferMap"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferMap"); if (auto MemBuffer = getAsanInterceptor()->getMemBuffer(hBuffer)) { @@ -1376,7 +1378,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemUnmap( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urEnqueueMemUnmap"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemUnmap"); if (auto MemBuffer = getAsanInterceptor()->getMemBuffer(hMem)) { MemBuffer::Mapping Mapping{}; @@ -1421,7 +1423,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelRetain( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urKernelRetain"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urKernelRetain"); UR_CALL(pfnRetain(hKernel)); @@ -1442,7 +1444,7 @@ __urdlllocal ur_result_t urKernelRelease( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urKernelRelease"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urKernelRelease"); auto &KernelInfo = getAsanInterceptor()->getOrCreateKernelInfo(hKernel); if (--KernelInfo.RefCount == 0) { @@ -1472,7 +1474,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgValue( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urKernelSetArgValue"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urKernelSetArgValue"); std::shared_ptr MemBuffer; if (argSize == sizeof(ur_mem_handle_t) && @@ -1505,7 +1507,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgMemObj( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug("==== urKernelSetArgMemObj"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urKernelSetArgMemObj"); std::shared_ptr MemBuffer; if ((MemBuffer = getAsanInterceptor()->getMemBuffer(hArgValue))) { @@ -1536,8 +1538,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgLocal( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug( - "==== urKernelSetArgLocal (argIndex={}, argSize={})", argIndex, argSize); + UR_LOG_L(getContext()->logger, DEBUG, + "==== urKernelSetArgLocal (argIndex={}, argSize={})", argIndex, + argSize); { auto &KI = getAsanInterceptor()->getOrCreateKernelInfo(hKernel); @@ -1572,9 +1575,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgPointer( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - getContext()->logger.debug( - "==== urKernelSetArgPointer (argIndex={}, pArgValue={})", argIndex, - pArgValue); + UR_LOG_L(getContext()->logger, DEBUG, + "==== urKernelSetArgPointer (argIndex={}, pArgValue={})", argIndex, + pArgValue); std::shared_ptr KI; if (getContext()->Options.DetectKernelArguments) { @@ -1957,7 +1960,7 @@ template struct NotSupportedApi; template struct NotSupportedApi { R static ReportError(A...) { - getContext()->logger.error(MsgType::value); + UR_LOG_L(getContext()->logger, ERR, MsgType::value); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } }; @@ -2085,7 +2088,7 @@ __urdlllocal ur_result_t UR_APICALL urGetVirtualMemProcAddrTable( ur_result_t initAsanDDITable(ur_dditable_t *dditable) { ur_result_t result = UR_RESULT_SUCCESS; - getContext()->logger.always("==== DeviceSanitizer: ASAN"); + UR_LOG_L(getContext()->logger, QUIET, "==== DeviceSanitizer: ASAN"); if (UR_RESULT_SUCCESS == result) { result = ur_sanitizer_layer::asan::urGetGlobalProcAddrTable( @@ -2148,7 +2151,8 @@ ur_result_t initAsanDDITable(ur_dditable_t *dditable) { } if (result != UR_RESULT_SUCCESS) { - getContext()->logger.error("Initialize ASAN DDI table failed: {}", result); + UR_LOG_L(getContext()->logger, ERR, "Initialize ASAN DDI table failed: {}", + result); } return result; diff --git a/unified-runtime/source/loader/layers/sanitizer/asan/asan_interceptor.cpp b/unified-runtime/source/loader/layers/sanitizer/asan/asan_interceptor.cpp index f10581c03fe1..4690b78e0c4d 100644 --- a/unified-runtime/source/loader/layers/sanitizer/asan/asan_interceptor.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/asan/asan_interceptor.cpp @@ -116,7 +116,7 @@ ur_result_t AsanInterceptor::allocateMemory(ur_context_handle_t Context, UR_CALL(getContext()->urDdiTable.USM.pfnDeviceAlloc( Context, Device, Properties, Pool, NeededSize, &Allocated)); } else { - getContext()->logger.error("Unsupport memory type"); + UR_LOG_L(getContext()->logger, ERR, "Unsupport memory type"); return UR_RESULT_ERROR_INVALID_ARGUMENT; } @@ -224,7 +224,8 @@ ur_result_t AsanInterceptor::releaseMemory(ur_context_handle_t Context, // If quarantine is disabled, USM is freed immediately if (!m_Quarantine) { - getContext()->logger.debug("Free: {}", (void *)AllocInfo->AllocBegin); + UR_LOG_L(getContext()->logger, DEBUG, "Free: {}", + (void *)AllocInfo->AllocBegin); ContextInfo->Stats.UpdateUSMRealFreed(AllocInfo->AllocSize, AllocInfo->getRedzoneSize()); @@ -242,8 +243,8 @@ ur_result_t AsanInterceptor::releaseMemory(ur_context_handle_t Context, std::scoped_lock Guard(m_AllocationMapMutex); for (auto &It : ReleaseList) { auto ToFreeAllocInfo = It->second; - getContext()->logger.info("Quarantine Free: {}", - (void *)ToFreeAllocInfo->AllocBegin); + UR_LOG_L(getContext()->logger, INFO, "Quarantine Free: {}", + (void *)ToFreeAllocInfo->AllocBegin); ContextInfo->Stats.UpdateUSMRealFreed(ToFreeAllocInfo->AllocSize, ToFreeAllocInfo->getRedzoneSize()); @@ -270,7 +271,7 @@ ur_result_t AsanInterceptor::preLaunchKernel(ur_kernel_handle_t Kernel, ManagedQueue InternalQueue(Context, Device); if (!InternalQueue) { - getContext()->logger.error("Failed to create internal queue"); + UR_LOG_L(getContext()->logger, ERR, "Failed to create internal queue"); return UR_RESULT_ERROR_INVALID_QUEUE; } @@ -430,13 +431,13 @@ AsanInterceptor::updateShadowMemory(std::shared_ptr &ContextInfo, ur_result_t AsanInterceptor::registerProgram(ur_program_handle_t Program) { ur_result_t Result = UR_RESULT_SUCCESS; - getContext()->logger.info("registerSpirKernels"); + UR_LOG_L(getContext()->logger, INFO, "registerSpirKernels"); Result = registerSpirKernels(Program); if (Result != UR_RESULT_SUCCESS) { return Result; } - getContext()->logger.info("registerDeviceGlobals"); + UR_LOG_L(getContext()->logger, INFO, "registerDeviceGlobals"); Result = registerDeviceGlobals(Program); if (Result != UR_RESULT_SUCCESS) { return Result; @@ -486,8 +487,8 @@ ur_result_t AsanInterceptor::registerSpirKernels(ur_program_handle_t Program) { Queue, true, &SKInfo[0], MetadataPtr, sizeof(SpirKernelInfo) * NumOfSpirKernel, 0, nullptr, nullptr); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error("Can't read the value of <{}>: {}", - kSPIR_AsanSpirKernelMetadata, Result); + UR_LOG_L(getContext()->logger, ERR, "Can't read the value of <{}>: {}", + kSPIR_AsanSpirKernelMetadata, Result); return Result; } @@ -502,20 +503,21 @@ ur_result_t AsanInterceptor::registerSpirKernels(ur_program_handle_t Program) { Queue, true, KernelNameV.data(), (void *)SKI.KernelName, sizeof(char) * SKI.Size, 0, nullptr, nullptr); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error("Can't read kernel name: {}", Result); + UR_LOG_L(getContext()->logger, ERR, "Can't read kernel name: {}", + Result); return Result; } std::string KernelName = std::string(KernelNameV.begin(), KernelNameV.end()); - getContext()->logger.info("SpirKernel(name='{}', isInstrumented={})", - KernelName, true); + UR_LOG_L(getContext()->logger, INFO, + "SpirKernel(name='{}', isInstrumented={})", KernelName, true); PI->InstrumentedKernels.insert(std::move(KernelName)); } - getContext()->logger.info("Number of sanitized kernel: {}", - PI->InstrumentedKernels.size()); + UR_LOG_L(getContext()->logger, INFO, "Number of sanitized kernel: {}", + PI->InstrumentedKernels.size()); } return UR_RESULT_SUCCESS; @@ -539,7 +541,7 @@ AsanInterceptor::registerDeviceGlobals(ur_program_handle_t Program) { Device, Program, kSPIR_AsanDeviceGlobalMetadata, &MetadataSize, &MetadataPtr); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.info("No device globals"); + UR_LOG_L(getContext()->logger, INFO, "No device globals"); continue; } @@ -551,8 +553,8 @@ AsanInterceptor::registerDeviceGlobals(ur_program_handle_t Program) { Queue, true, &GVInfos[0], MetadataPtr, sizeof(DeviceGlobalInfo) * NumOfDeviceGlobal, 0, nullptr, nullptr); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error("Device Global[{}] Read Failed: {}", - kSPIR_AsanDeviceGlobalMetadata, Result); + UR_LOG_L(getContext()->logger, ERR, "Device Global[{}] Read Failed: {}", + kSPIR_AsanDeviceGlobalMetadata, Result); return Result; } @@ -718,11 +720,11 @@ ur_result_t AsanInterceptor::prepareLaunch( auto PrivateMemoryUsage = GetKernelPrivateMemorySize(Kernel, DeviceInfo->Handle); - getContext()->logger.info( - "KernelInfo {} (Name={}, ArgNums={}, IsInstrumented={}, " - "LocalMemory={}, PrivateMemory={})", - (void *)Kernel, GetKernelName(Kernel), ArgNums, KernelInfo.IsInstrumented, - LocalMemoryUsage, PrivateMemoryUsage); + UR_LOG_L(getContext()->logger, INFO, + "KernelInfo {} (Name={}, ArgNums={}, IsInstrumented={}, " + "LocalMemory={}, PrivateMemory={})", + (void *)Kernel, GetKernelName(Kernel), ArgNums, + KernelInfo.IsInstrumented, LocalMemoryUsage, PrivateMemoryUsage); // Validate pointer arguments if (getContext()->Options.DetectKernelArguments) { @@ -749,9 +751,10 @@ ur_result_t AsanInterceptor::prepareLaunch( ur_result_t URes = getContext()->urDdiTable.Kernel.pfnSetArgPointer( Kernel, ArgIndex, nullptr, ArgPointer); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error( - "Failed to set buffer {} as the {} arg to kernel {}: {}", - ur_cast(MemBuffer.get()), ArgIndex, Kernel, URes); + UR_LOG_L(getContext()->logger, ERR, + "Failed to set buffer {} as the {} arg to kernel {}: {}", + ur_cast(MemBuffer.get()), ArgIndex, Kernel, + URes); } } @@ -769,7 +772,8 @@ ur_result_t AsanInterceptor::prepareLaunch( ur_result_t URes = getContext()->urDdiTable.Kernel.pfnSetArgPointer( Kernel, ArgNums - 1, nullptr, LaunchInfo.Data.getDevicePtr()); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to set launch info: {}", URes); + UR_LOG_L(getContext()->logger, ERR, "Failed to set launch info: {}", + URes); return URes; } } @@ -809,18 +813,18 @@ ur_result_t AsanInterceptor::prepareLaunch( if (DeviceInfo->Shadow->AllocLocalShadow( Queue, NumWG, LaunchInfo.Data.Host.LocalShadowOffset, LaunchInfo.Data.Host.LocalShadowOffsetEnd) != UR_RESULT_SUCCESS) { - getContext()->logger.warning( - "Failed to allocate shadow memory for local " - "memory, maybe the number of workgroup ({}) is too " - "large", - NumWG); - getContext()->logger.warning("Skip checking local memory of kernel <{}>", - GetKernelName(Kernel)); + UR_LOG_L(getContext()->logger, WARN, + "Failed to allocate shadow memory for local memory, " + "maybe the number of workgroup ({}) is too large", + NumWG); + UR_LOG_L(getContext()->logger, WARN, + "Skip checking local memory of kernel <{}>", + GetKernelName(Kernel)); } else { - getContext()->logger.info( - "ShadowMemory(Local, WorkGroup{}, {} - {})", NumWG, - (void *)LaunchInfo.Data.Host.LocalShadowOffset, - (void *)LaunchInfo.Data.Host.LocalShadowOffsetEnd); + UR_LOG_L(getContext()->logger, INFO, + "ShadowMemory(Local, WorkGroup{}, {} - {})", NumWG, + (void *)LaunchInfo.Data.Host.LocalShadowOffset, + (void *)LaunchInfo.Data.Host.LocalShadowOffsetEnd); } } @@ -829,18 +833,18 @@ ur_result_t AsanInterceptor::prepareLaunch( if (DeviceInfo->Shadow->AllocPrivateShadow( Queue, NumWG, LaunchInfo.Data.Host.PrivateShadowOffset, LaunchInfo.Data.Host.PrivateShadowOffsetEnd) != UR_RESULT_SUCCESS) { - getContext()->logger.warning( - "Failed to allocate shadow memory for private " - "memory, maybe the number of workgroup ({}) is too " - "large", - NumWG); - getContext()->logger.warning( - "Skip checking private memory of kernel <{}>", GetKernelName(Kernel)); + UR_LOG_L(getContext()->logger, WARN, + "Failed to allocate shadow memory for private memory, " + "maybe the number of workgroup ({}) is too large", + NumWG); + UR_LOG_L(getContext()->logger, WARN, + "Skip checking private memory of kernel <{}>", + GetKernelName(Kernel)); } else { - getContext()->logger.info( - "ShadowMemory(Private, WorkGroup{}, {} - {})", NumWG, - (void *)LaunchInfo.Data.Host.PrivateShadowOffset, - (void *)LaunchInfo.Data.Host.PrivateShadowOffsetEnd); + UR_LOG_L(getContext()->logger, INFO, + "ShadowMemory(Private, WorkGroup{}, {} - {})", NumWG, + (void *)LaunchInfo.Data.Host.PrivateShadowOffset, + (void *)LaunchInfo.Data.Host.PrivateShadowOffsetEnd); } } @@ -849,9 +853,9 @@ ur_result_t AsanInterceptor::prepareLaunch( std::vector LocalArgsInfo; for (auto [ArgIndex, ArgInfo] : KernelInfo.LocalArgs) { LocalArgsInfo.push_back(ArgInfo); - getContext()->logger.debug( - "local_args (argIndex={}, size={}, sizeWithRZ={})", ArgIndex, - ArgInfo.Size, ArgInfo.SizeWithRedZone); + UR_LOG_L(getContext()->logger, DEBUG, + "local_args (argIndex={}, size={}, sizeWithRZ={})", ArgIndex, + ArgInfo.Size, ArgInfo.SizeWithRedZone); } UR_CALL(LaunchInfo.Data.importLocalArgsInfo(Queue, LocalArgsInfo)); } @@ -859,12 +863,12 @@ ur_result_t AsanInterceptor::prepareLaunch( // sync asan runtime data to device side UR_CALL(LaunchInfo.Data.syncToDevice(Queue)); - getContext()->logger.info( - "LaunchInfo {} (device={}, debug={}, numLocalArgs={}, localArgs={})", - (void *)LaunchInfo.Data.getDevicePtr(), - ToString(LaunchInfo.Data.Host.DeviceTy), LaunchInfo.Data.Host.Debug, - LaunchInfo.Data.Host.NumLocalArgs, - (void *)LaunchInfo.Data.Host.LocalArgs); + UR_LOG_L(getContext()->logger, INFO, + "LaunchInfo {} (device={}, debug={}, numLocalArgs={}, localArgs={})", + (void *)LaunchInfo.Data.getDevicePtr(), + ToString(LaunchInfo.Data.Host.DeviceTy), LaunchInfo.Data.Host.Debug, + LaunchInfo.Data.Host.NumLocalArgs, + (void *)LaunchInfo.Data.Host.LocalArgs); return UR_RESULT_SUCCESS; } @@ -937,10 +941,10 @@ ur_usm_pool_handle_t ContextInfo::getUSMPool() { getContext()->urDdiTable.USM.pfnPoolCreate(Handle, &Desc, &USMPool); if (URes != UR_RESULT_SUCCESS && URes != UR_RESULT_ERROR_UNSUPPORTED_FEATURE) { - getContext()->logger.warning( - "Failed to create USM pool, the memory overhead " - "may increase: {}", - URes); + UR_LOG_L(getContext()->logger, WARN, + "Failed to create USM pool, the memory overhead " + "may increase: {}", + URes); } }); return USMPool; diff --git a/unified-runtime/source/loader/layers/sanitizer/asan/asan_interceptor.hpp b/unified-runtime/source/loader/layers/sanitizer/asan/asan_interceptor.hpp index 53aac416f256..b394be7ca9eb 100644 --- a/unified-runtime/source/loader/layers/sanitizer/asan/asan_interceptor.hpp +++ b/unified-runtime/source/loader/layers/sanitizer/asan/asan_interceptor.hpp @@ -185,8 +185,9 @@ struct AsanRuntimeDataWrapper { Context, Device, nullptr, nullptr, sizeof(AsanRuntimeData), (void **)&DevicePtr); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error( - "Failed to alloc device usm for asan runtime data: {}", Result); + UR_LOG_L(getContext()->logger, ERR, + "Failed to alloc device usm for asan runtime data: {}", + Result); } } return DevicePtr; diff --git a/unified-runtime/source/loader/layers/sanitizer/asan/asan_report.cpp b/unified-runtime/source/loader/layers/sanitizer/asan/asan_report.cpp index 2f294f77faf2..e808e21863fd 100644 --- a/unified-runtime/source/loader/layers/sanitizer/asan/asan_report.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/asan/asan_report.cpp @@ -26,13 +26,13 @@ namespace asan { namespace { void PrintAllocateInfo(uptr Addr, const AllocInfo *AI) { - getContext()->logger.always("{} is located inside of {} region [{}, {})", - (void *)Addr, ToString(AI->Type), - (void *)AI->UserBegin, (void *)AI->UserEnd); - getContext()->logger.always("allocated here:"); + UR_LOG_L(getContext()->logger, QUIET, + "{} is located inside of {} region [{}, {})", (void *)Addr, + ToString(AI->Type), (void *)AI->UserBegin, (void *)AI->UserEnd); + UR_LOG_L(getContext()->logger, QUIET, "allocated here:"); AI->AllocStack.print(); if (AI->IsReleased) { - getContext()->logger.always("freed here:"); + UR_LOG_L(getContext()->logger, QUIET, "freed here:"); AI->ReleaseStack.print(); } } @@ -41,13 +41,14 @@ void PrintAllocateInfo(uptr Addr, const AllocInfo *AI) { void ReportBadFree(uptr Addr, const StackTrace &stack, const std::shared_ptr &AI) { - getContext()->logger.always( - "\n====ERROR: DeviceSanitizer: bad-free on address {}", (void *)Addr); + UR_LOG_L(getContext()->logger, QUIET, + "\n====ERROR: DeviceSanitizer: bad-free on address {}", + (void *)Addr); stack.print(); if (!AI) { - getContext()->logger.always("{} may be allocated on Host Memory", - (void *)Addr); + UR_LOG_L(getContext()->logger, QUIET, "{} may be allocated on Host Memory", + (void *)Addr); } else { assert(!AI->IsReleased && "Chunk must be not released"); PrintAllocateInfo(Addr, AI.get()); @@ -56,8 +57,9 @@ void ReportBadFree(uptr Addr, const StackTrace &stack, void ReportBadContext(uptr Addr, const StackTrace &stack, const std::shared_ptr &AI) { - getContext()->logger.always( - "\n====ERROR: DeviceSanitizer: bad-context on address {}", (void *)Addr); + UR_LOG_L(getContext()->logger, QUIET, + "\n====ERROR: DeviceSanitizer: bad-context on address {}", + (void *)Addr); stack.print(); PrintAllocateInfo(Addr, AI.get()); @@ -65,32 +67,33 @@ void ReportBadContext(uptr Addr, const StackTrace &stack, void ReportDoubleFree(uptr Addr, const StackTrace &Stack, const std::shared_ptr &AI) { - getContext()->logger.always( - "\n====ERROR: DeviceSanitizer: double-free on address {}", (void *)Addr); + UR_LOG_L(getContext()->logger, QUIET, + "\n====ERROR: DeviceSanitizer: double-free on address {}", + (void *)Addr); Stack.print(); - getContext()->logger.always("{} is located inside of {} region [{}, {})", - (void *)Addr, ToString(AI->Type), - (void *)AI->UserBegin, (void *)AI->UserEnd); - getContext()->logger.always("freed here:"); + UR_LOG_L(getContext()->logger, QUIET, + "{} is located inside of {} region [{}, {})", (void *)Addr, + ToString(AI->Type), (void *)AI->UserBegin, (void *)AI->UserEnd); + UR_LOG_L(getContext()->logger, QUIET, "freed here:"); AI->ReleaseStack.print(); - getContext()->logger.always("previously allocated here:"); + UR_LOG_L(getContext()->logger, QUIET, "previously allocated here:"); AI->AllocStack.print(); } void ReportMemoryLeak(const std::shared_ptr &AI) { - getContext()->logger.always( - "\n====ERROR: DeviceSanitizer: detected memory leaks of {}", - ToString(AI->Type)); - getContext()->logger.always("Direct leak of {} byte(s) at {} allocated from:", - AI->UserEnd - AI->UserBegin, - (void *)AI->UserBegin); + UR_LOG_L(getContext()->logger, QUIET, + "\n====ERROR: DeviceSanitizer: detected memory leaks of {}", + ToString(AI->Type)); + UR_LOG_L(getContext()->logger, QUIET, + "Direct leak of {} byte(s) at {} allocated from:", + AI->UserEnd - AI->UserBegin, (void *)AI->UserBegin); AI->AllocStack.print(); } void ReportFatalError(const AsanErrorReport &Report) { - getContext()->logger.always("\n====ERROR: DeviceSanitizer: {}", - ToString(Report.ErrorTy)); + UR_LOG_L(getContext()->logger, QUIET, "\n====ERROR: DeviceSanitizer: {}", + ToString(Report.ErrorTy)); } void ReportGenericError(const AsanErrorReport &Report, @@ -102,16 +105,17 @@ void ReportGenericError(const AsanErrorReport &Report, // Try to demangle the kernel name KernelName = DemangleName(KernelName); - getContext()->logger.always( - "\n====ERROR: DeviceSanitizer: {} on {} ({})", ToString(Report.ErrorTy), - ToString(Report.MemoryTy), (void *)Report.Address); - getContext()->logger.always( - "{} of size {} at kernel <{}> LID({}, {}, {}) GID({}, " - "{}, {})", - Report.IsWrite ? "WRITE" : "READ", Report.AccessSize, KernelName.c_str(), - Report.LID0, Report.LID1, Report.LID2, Report.GID0, Report.GID1, - Report.GID2); - getContext()->logger.always(" #0 {} {}:{}", Func, File, Report.Line); + UR_LOG_L(getContext()->logger, QUIET, + "\n====ERROR: DeviceSanitizer: {} on {} ({})", + ToString(Report.ErrorTy), ToString(Report.MemoryTy), + (void *)Report.Address); + UR_LOG_L(getContext()->logger, QUIET, + "{} of size {} at kernel <{}> LID({}, {}, {}) GID({}, {}, {})", + Report.IsWrite ? "WRITE" : "READ", Report.AccessSize, + KernelName.c_str(), Report.LID0, Report.LID1, Report.LID2, + Report.GID0, Report.GID1, Report.GID2); + UR_LOG_L(getContext()->logger, QUIET, " #0 {} {}:{}", Func, File, + Report.Line); } void ReportUseAfterFree(const AsanErrorReport &Report, @@ -124,30 +128,32 @@ void ReportUseAfterFree(const AsanErrorReport &Report, // Try to demangle the kernel name KernelName = DemangleName(KernelName); - getContext()->logger.always("\n====ERROR: DeviceSanitizer: {} on address {}", - ToString(Report.ErrorTy), (void *)Report.Address); - getContext()->logger.always( - "{} of size {} at kernel <{}> LID({}, {}, {}) GID({}, " - "{}, {})", - Report.IsWrite ? "WRITE" : "READ", Report.AccessSize, KernelName.c_str(), - Report.LID0, Report.LID1, Report.LID2, Report.GID0, Report.GID1, - Report.GID2); - getContext()->logger.always(" #0 {} {}:{}", Func, File, Report.Line); - getContext()->logger.always(""); + UR_LOG_L(getContext()->logger, QUIET, + "\n====ERROR: DeviceSanitizer: {} on address {}", + ToString(Report.ErrorTy), (void *)Report.Address); + UR_LOG_L(getContext()->logger, QUIET, + "{} of size {} at kernel <{}> LID({}, {}, {}) GID({}, {}, {})", + Report.IsWrite ? "WRITE" : "READ", Report.AccessSize, + KernelName.c_str(), Report.LID0, Report.LID1, Report.LID2, + Report.GID0, Report.GID1, Report.GID2); + UR_LOG_L(getContext()->logger, QUIET, " #0 {} {}:{}", Func, File, + Report.Line); + UR_LOG_L(getContext()->logger, QUIET, ""); if (getContext()->Options.MaxQuarantineSizeMB > 0) { auto AllocInfoItOp = getAsanInterceptor()->findAllocInfoByAddress(Report.Address); if (!AllocInfoItOp) { - getContext()->logger.always("Failed to find which chunck {} is allocated", - (void *)Report.Address); + UR_LOG_L(getContext()->logger, QUIET, + "Failed to find which chunck {} is allocated", + (void *)Report.Address); } else { auto &AllocInfo = (*AllocInfoItOp)->second; if (AllocInfo->Context != Context) { - getContext()->logger.always( - "Failed to find which chunck {} is allocated", - (void *)Report.Address); + UR_LOG_L(getContext()->logger, QUIET, + "Failed to find which chunck {} is allocated", + (void *)Report.Address); } assert(AllocInfo->IsReleased && "It must be released since it's use-after-free"); @@ -155,49 +161,52 @@ void ReportUseAfterFree(const AsanErrorReport &Report, PrintAllocateInfo(Report.Address, AllocInfo.get()); } } else { - getContext()->logger.always( - "Please enable quarantine to get more information like memory " - "chunck's kind and where the chunck was allocated and released."); + UR_LOG_L(getContext()->logger, QUIET, + "Please enable quarantine to get more information like memory " + "chunck's kind and where the chunck was allocated and released."); } } void ReportInvalidKernelArgument(ur_kernel_handle_t Kernel, uint32_t ArgIndex, uptr Addr, const ValidateUSMResult &VR, StackTrace Stack) { - getContext()->logger.always("\n====ERROR: DeviceSanitizer: " - "invalid-argument on kernel <{}>", - DemangleName(GetKernelName(Kernel))); + UR_LOG_L(getContext()->logger, QUIET, + "\n====ERROR: DeviceSanitizer: " + "invalid-argument on kernel <{}>", + DemangleName(GetKernelName(Kernel))); Stack.print(); auto &AI = VR.AI; ArgIndex = ArgIndex + 1; switch (VR.Type) { case ValidateUSMResult::MAYBE_HOST_POINTER: - getContext()->logger.always("The {}th argument {} is not a USM pointer", - ArgIndex, (void *)Addr); + UR_LOG_L(getContext()->logger, QUIET, + "The {}th argument {} is not a USM pointer", ArgIndex, + (void *)Addr); break; case ValidateUSMResult::RELEASED_POINTER: - getContext()->logger.always( - "The {}th argument {} is a released USM pointer", ArgIndex + 1, - (void *)Addr); + UR_LOG_L(getContext()->logger, QUIET, + "The {}th argument {} is a released USM pointer", ArgIndex + 1, + (void *)Addr); PrintAllocateInfo(Addr, AI.get()); break; case ValidateUSMResult::BAD_CONTEXT: - getContext()->logger.always( - "The {}th argument {} is allocated in other context", ArgIndex + 1, - (void *)Addr); + UR_LOG_L(getContext()->logger, QUIET, + "The {}th argument {} is allocated in other context", ArgIndex + 1, + (void *)Addr); PrintAllocateInfo(Addr, AI.get()); break; case ValidateUSMResult::BAD_DEVICE: - getContext()->logger.always( - "The {}th argument {} is allocated in other device", ArgIndex + 1, - (void *)Addr); + UR_LOG_L(getContext()->logger, QUIET, + "The {}th argument {} is allocated in other device", ArgIndex + 1, + (void *)Addr); PrintAllocateInfo(Addr, AI.get()); break; case ValidateUSMResult::OUT_OF_BOUNDS: - getContext()->logger.always( - "The {}th argument {} is located outside of its region [{}, {})", - ArgIndex + 1, (void *)Addr, (void *)AI->UserBegin, (void *)AI->UserEnd); - getContext()->logger.always("allocated here:"); + UR_LOG_L(getContext()->logger, QUIET, + "The {}th argument {} is located outside of its region [{}, {})", + ArgIndex + 1, (void *)Addr, (void *)AI->UserBegin, + (void *)AI->UserEnd); + UR_LOG_L(getContext()->logger, QUIET, "allocated here:"); AI->AllocStack.print(); break; default: diff --git a/unified-runtime/source/loader/layers/sanitizer/asan/asan_shadow.cpp b/unified-runtime/source/loader/layers/sanitizer/asan/asan_shadow.cpp index 54f1a9c9bd8b..3cf0f6a262fe 100644 --- a/unified-runtime/source/loader/layers/sanitizer/asan/asan_shadow.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/asan/asan_shadow.cpp @@ -49,7 +49,8 @@ ur_result_t ShadowMemoryCPU::Setup() { auto URes = EnqueuePoisonShadow({}, 0, NullptrRedzoneSize, kNullPointerRedzoneMagic); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("EnqueuePoisonShadow(NullPointerRZ): {}", URes); + UR_LOG_L(getContext()->logger, ERR, + "EnqueuePoisonShadow(NullPointerRZ): {}", URes); return URes; } return URes; @@ -81,9 +82,10 @@ ur_result_t ShadowMemoryCPU::EnqueuePoisonShadow(ur_queue_handle_t, uptr Ptr, uptr ShadowBegin = MemToShadow(Ptr); uptr ShadowEnd = MemToShadow(Ptr + Size - 1); assert(ShadowBegin <= ShadowEnd); - getContext()->logger.debug("EnqueuePoisonShadow(addr={}, count={}, value={})", - (void *)ShadowBegin, ShadowEnd - ShadowBegin + 1, - (void *)(size_t)Value); + UR_LOG_L(getContext()->logger, DEBUG, + "EnqueuePoisonShadow(addr={}, count={}, value={})", + (void *)ShadowBegin, ShadowEnd - ShadowBegin + 1, + (void *)(size_t)Value); memset((void *)ShadowBegin, Value, ShadowEnd - ShadowBegin + 1); return UR_RESULT_SUCCESS; @@ -103,8 +105,9 @@ ur_result_t ShadowMemoryGPU::Setup() { auto Result = getContext()->urDdiTable.VirtualMem.pfnReserve( Context, StartAddress, ShadowSize, (void **)&ShadowBegin); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error("Shadow memory reserved failed with size {}: {}", - (void *)ShadowSize, Result); + UR_LOG_L(getContext()->logger, ERR, + "Shadow memory reserved failed with size {}: {}", + (void *)ShadowSize, Result); return Result; } ShadowEnd = ShadowBegin + ShadowSize; @@ -117,8 +120,8 @@ ur_result_t ShadowMemoryGPU::Setup() { Result = EnqueuePoisonShadow(Queue, 0, NullptrRedzoneSize, kNullPointerRedzoneMagic); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error("EnqueuePoisonShadow(NullPointerRZ): {}", - Result); + UR_LOG_L(getContext()->logger, ERR, + "EnqueuePoisonShadow(NullPointerRZ): {}", Result); return Result; } return Result; @@ -182,7 +185,8 @@ ur_result_t ShadowMemoryGPU::EnqueuePoisonShadow(ur_queue_handle_t Queue, auto URes = getContext()->urDdiTable.PhysicalMem.pfnCreate( Context, Device, PageSize, &Desc, &PhysicalMem); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("urPhysicalMemCreate(): {}", URes); + UR_LOG_L(getContext()->logger, ERR, "urPhysicalMemCreate(): {}", + URes); return URes; } @@ -190,19 +194,19 @@ ur_result_t ShadowMemoryGPU::EnqueuePoisonShadow(ur_queue_handle_t Queue, Context, (void *)MappedPtr, PageSize, PhysicalMem, 0, UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("urVirtualMemMap({}, {}): {}", - (void *)MappedPtr, PageSize, URes); + UR_LOG_L(getContext()->logger, ERR, "urVirtualMemMap({}, {}): {}", + (void *)MappedPtr, PageSize, URes); return URes; } - getContext()->logger.debug("urVirtualMemMap: {} ~ {}", - (void *)MappedPtr, - (void *)(MappedPtr + PageSize - 1)); + UR_LOG_L(getContext()->logger, DEBUG, "urVirtualMemMap: {} ~ {}", + (void *)MappedPtr, (void *)(MappedPtr + PageSize - 1)); // Initialize to zero URes = EnqueueUSMBlockingSet(Queue, (void *)MappedPtr, 0, PageSize); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("EnqueueUSMBlockingSet(): {}", URes); + UR_LOG_L(getContext()->logger, ERR, "EnqueueUSMBlockingSet(): {}", + URes); return URes; } @@ -213,12 +217,12 @@ ur_result_t ShadowMemoryGPU::EnqueuePoisonShadow(ur_queue_handle_t Queue, auto URes = EnqueueUSMBlockingSet(Queue, (void *)ShadowBegin, Value, ShadowEnd - ShadowBegin + 1); - getContext()->logger.debug( - "EnqueuePoisonShadow (addr={}, count={}, value={}): {}", - (void *)ShadowBegin, ShadowEnd - ShadowBegin + 1, (void *)(size_t)Value, - URes); + UR_LOG_L(getContext()->logger, DEBUG, + "EnqueuePoisonShadow (addr={}, count={}, value={}): {}", + (void *)ShadowBegin, ShadowEnd - ShadowBegin + 1, + (void *)(size_t)Value, URes); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("EnqueueUSMBlockingSet(): {}", URes); + UR_LOG_L(getContext()->logger, ERR, "EnqueueUSMBlockingSet(): {}", URes); return URes; } diff --git a/unified-runtime/source/loader/layers/sanitizer/asan/asan_statistics.cpp b/unified-runtime/source/loader/layers/sanitizer/asan/asan_statistics.cpp index 6ec7c7390c9e..d11195f7d338 100644 --- a/unified-runtime/source/loader/layers/sanitizer/asan/asan_statistics.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/asan/asan_statistics.cpp @@ -46,23 +46,24 @@ struct AsanStats { }; void AsanStats::Print(ur_context_handle_t Context) { - getContext()->logger.always("Stats: Context {}", (void *)Context); - getContext()->logger.always("Stats: peak memory overhead: {}%", - Overhead * 100); + UR_LOG_L(getContext()->logger, QUIET, "Stats: Context {}", (void *)Context); + UR_LOG_L(getContext()->logger, QUIET, "Stats: peak memory overhead: {}%", + Overhead * 100); } void AsanStats::UpdateUSMMalloced(uptr MallocedSize, uptr RedzoneSize) { UsmMalloced += MallocedSize; UsmMallocedRedzones += RedzoneSize; - getContext()->logger.debug( - "Stats: UpdateUSMMalloced(UsmMalloced={}, UsmMallocedRedzones={})", - UsmMalloced, UsmMallocedRedzones); + UR_LOG_L(getContext()->logger, DEBUG, + "Stats: UpdateUSMMalloced(UsmMalloced={}, UsmMallocedRedzones={})", + UsmMalloced, UsmMallocedRedzones); UpdateOverhead(); } void AsanStats::UpdateUSMFreed(uptr FreedSize) { UsmFreed += FreedSize; - getContext()->logger.debug("Stats: UpdateUSMFreed(UsmFreed={})", UsmFreed); + UR_LOG_L(getContext()->logger, DEBUG, "Stats: UpdateUSMFreed(UsmFreed={})", + UsmFreed); } void AsanStats::UpdateUSMRealFreed(uptr FreedSize, uptr RedzoneSize) { @@ -71,23 +72,23 @@ void AsanStats::UpdateUSMRealFreed(uptr FreedSize, uptr RedzoneSize) { if (getContext()->Options.MaxQuarantineSizeMB) { UsmFreed -= FreedSize; } - getContext()->logger.debug( - "Stats: UpdateUSMRealFreed(UsmMalloced={}, UsmMallocedRedzones={})", - UsmMalloced, UsmMallocedRedzones); + UR_LOG_L(getContext()->logger, DEBUG, + "Stats: UpdateUSMRealFreed(UsmMalloced={}, UsmMallocedRedzones={})", + UsmMalloced, UsmMallocedRedzones); UpdateOverhead(); } void AsanStats::UpdateShadowMalloced(uptr ShadowSize) { ShadowMalloced += ShadowSize; - getContext()->logger.debug("Stats: UpdateShadowMalloced(ShadowMalloced={})", - ShadowMalloced); + UR_LOG_L(getContext()->logger, DEBUG, + "Stats: UpdateShadowMalloced(ShadowMalloced={})", ShadowMalloced); UpdateOverhead(); } void AsanStats::UpdateShadowFreed(uptr ShadowSize) { ShadowMalloced -= ShadowSize; - getContext()->logger.debug("Stats: UpdateShadowFreed(ShadowMalloced={})", - ShadowMalloced); + UR_LOG_L(getContext()->logger, DEBUG, + "Stats: UpdateShadowFreed(ShadowMalloced={})", ShadowMalloced); UpdateOverhead(); } diff --git a/unified-runtime/source/loader/layers/sanitizer/msan/msan_allocator.cpp b/unified-runtime/source/loader/layers/sanitizer/msan/msan_allocator.cpp index 56f81fdb967a..42175132c0b9 100644 --- a/unified-runtime/source/loader/layers/sanitizer/msan/msan_allocator.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/msan/msan_allocator.cpp @@ -18,9 +18,8 @@ namespace ur_sanitizer_layer { namespace msan { void MsanAllocInfo::print() { - getContext()->logger.info("AllocInfo(Alloc=[{}-{}), AllocSize={})", - (void *)AllocBegin, - (void *)(AllocBegin + AllocSize), AllocSize); + UR_LOG_L(getContext()->logger, INFO, "AllocInfo(Alloc=[{}-{}), AllocSize={})", + (void *)AllocBegin, (void *)(AllocBegin + AllocSize), AllocSize); } } // namespace msan diff --git a/unified-runtime/source/loader/layers/sanitizer/msan/msan_buffer.cpp b/unified-runtime/source/loader/layers/sanitizer/msan/msan_buffer.cpp index 8cd7b7308bab..f80e6777febd 100644 --- a/unified-runtime/source/loader/layers/sanitizer/msan/msan_buffer.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/msan/msan_buffer.cpp @@ -137,8 +137,8 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { Size, AllocType::DEVICE_USM, ur_cast(&Allocation)); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error( - "Failed to allocate {} bytes memory for buffer {}", Size, this); + UR_LOG_L(getContext()->logger, ERR, + "Failed to allocate {} bytes memory for buffer {}", Size, this); return URes; } @@ -147,9 +147,10 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { URes = getContext()->urDdiTable.Enqueue.pfnUSMMemcpy( Queue, true, Allocation, HostPtr, Size, 0, nullptr, nullptr); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to copy {} bytes data from host " - "pointer {} to buffer {}", - Size, HostPtr, this); + UR_LOG_L( + getContext()->logger, ERR, + "Failed to copy {} bytes data from host pointer {} to buffer {}", + Size, HostPtr, this); return URes; } @@ -179,9 +180,10 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { URes = getContext()->urDdiTable.USM.pfnHostAlloc( Context, &USMDesc, Pool, Size, ur_cast(&HostAllocation)); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to allocate {} bytes host " - "USM for buffer {} migration", - Size, this); + UR_LOG_L(getContext()->logger, ERR, + "Failed to allocate {} bytes host " + "USM for buffer {} migration", + Size, this); return URes; } } @@ -193,7 +195,8 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { Queue, true, HostAllocation, LastSyncedDevice.MemHandle, Size, 0, nullptr, nullptr); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to migrate memory buffer data"); + UR_LOG_L(getContext()->logger, ERR, + "Failed to migrate memory buffer data"); return URes; } } @@ -204,7 +207,8 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { URes = getContext()->urDdiTable.Enqueue.pfnUSMMemcpy( Queue, true, Allocation, HostAllocation, Size, 0, nullptr, nullptr); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to migrate memory buffer data"); + UR_LOG_L(getContext()->logger, ERR, + "Failed to migrate memory buffer data"); return URes; } } @@ -219,7 +223,8 @@ ur_result_t MemBuffer::free() { for (const auto &[_, Ptr] : Allocations) { ur_result_t URes = getContext()->urDdiTable.USM.pfnFree(Context, Ptr); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to free buffer handle {}", Ptr); + UR_LOG_L(getContext()->logger, ERR, "Failed to free buffer handle {}", + Ptr); return URes; } } diff --git a/unified-runtime/source/loader/layers/sanitizer/msan/msan_ddi.cpp b/unified-runtime/source/loader/layers/sanitizer/msan/msan_ddi.cpp index 955725746979..b8523c0a0983 100644 --- a/unified-runtime/source/loader/layers/sanitizer/msan/msan_ddi.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/msan/msan_ddi.cpp @@ -33,14 +33,15 @@ ur_result_t setupContext(ur_context_handle_t Context, uint32_t numDevices, UR_CALL(getMsanInterceptor()->insertDevice(hDevice, DI)); DI->Type = GetDeviceType(Context, hDevice); if (DI->Type == DeviceType::UNKNOWN) { - getContext()->logger.error("Unsupport device"); + UR_LOG_L(getContext()->logger, ERR, "Unsupport device"); return UR_RESULT_ERROR_INVALID_DEVICE; } - getContext()->logger.info( - "DeviceInfo {} (Type={}, IsSupportSharedSystemUSM={})", - (void *)DI->Handle, ToString(DI->Type), DI->IsSupportSharedSystemUSM); - getContext()->logger.info("Add {} into context {}", (void *)DI->Handle, - (void *)Context); + UR_LOG_L(getContext()->logger, INFO, + "DeviceInfo {} (Type={}, IsSupportSharedSystemUSM={})", + (void *)DI->Handle, ToString(DI->Type), + DI->IsSupportSharedSystemUSM); + UR_LOG_L(getContext()->logger, INFO, "Add {} into context {}", + (void *)DI->Handle, (void *)Context); if (!DI->Shadow) { UR_CALL(DI->allocShadowMemory(Context)); } @@ -98,7 +99,7 @@ ur_result_t urUSMDeviceAlloc( size_t size, /// [out] pointer to USM device memory object void **ppMem) { - getContext()->logger.debug("==== urUSMDeviceAlloc"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urUSMDeviceAlloc"); return getMsanInterceptor()->allocateMemory( hContext, hDevice, pUSMDesc, pool, size, AllocType::DEVICE_USM, ppMem); @@ -116,7 +117,7 @@ ur_result_t UR_APICALL urUSMHostAlloc( size, ///< [in] size in bytes of the USM memory object to be allocated void **ppMem ///< [out] pointer to USM host memory object ) { - getContext()->logger.debug("==== urUSMHostAlloc"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urUSMHostAlloc"); return getMsanInterceptor()->allocateMemory(hContext, nullptr, pUSMDesc, pool, size, AllocType::HOST_USM, ppMem); @@ -135,7 +136,7 @@ ur_result_t UR_APICALL urUSMSharedAlloc( size, ///< [in] size in bytes of the USM memory object to be allocated void **ppMem ///< [out] pointer to USM shared memory object ) { - getContext()->logger.debug("==== urUSMSharedAlloc"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urUSMSharedAlloc"); return getMsanInterceptor()->allocateMemory( hContext, hDevice, pUSMDesc, pool, size, AllocType::SHARED_USM, ppMem); @@ -148,7 +149,7 @@ ur_result_t UR_APICALL urUSMFree( ur_context_handle_t hContext, /// [in] pointer to USM memory object void *pMem) { - getContext()->logger.debug("==== urUSMFree"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urUSMFree"); return getMsanInterceptor()->releaseMemory(hContext, pMem); } @@ -169,7 +170,7 @@ ur_result_t urProgramCreateWithIL( auto pfnProgramCreateWithIL = getContext()->urDdiTable.Program.pfnCreateWithIL; - getContext()->logger.debug("==== urProgramCreateWithIL"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramCreateWithIL"); UR_CALL( pfnProgramCreateWithIL(hContext, pIL, length, pProperties, phProgram)); @@ -201,7 +202,7 @@ ur_result_t urProgramCreateWithBinary( auto pfnProgramCreateWithBinary = getContext()->urDdiTable.Program.pfnCreateWithBinary; - getContext()->logger.debug("==== urProgramCreateWithBinary"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramCreateWithBinary"); UR_CALL(pfnProgramCreateWithBinary(hContext, numDevices, phDevices, pLengths, ppBinaries, pProperties, phProgram)); @@ -224,7 +225,7 @@ ur_result_t urProgramCreateWithNativeHandle( auto pfnProgramCreateWithNativeHandle = getContext()->urDdiTable.Program.pfnCreateWithNativeHandle; - getContext()->logger.debug("==== urProgramCreateWithNativeHandle"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramCreateWithNativeHandle"); UR_CALL(pfnProgramCreateWithNativeHandle(hNativeProgram, hContext, pProperties, phProgram)); @@ -241,7 +242,7 @@ urProgramRetain(ur_program_handle_t hProgram) { auto pfnRetain = getContext()->urDdiTable.Program.pfnRetain; - getContext()->logger.debug("==== urProgramRetain"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramRetain"); UR_CALL(pfnRetain(hProgram)); @@ -263,7 +264,7 @@ ur_result_t urProgramBuild( const char *pOptions) { auto pfnProgramBuild = getContext()->urDdiTable.Program.pfnBuild; - getContext()->logger.debug("==== urProgramBuild"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramBuild"); auto UrRes = pfnProgramBuild(hContext, hProgram, pOptions); if (UrRes != UR_RESULT_SUCCESS) { @@ -290,7 +291,7 @@ ur_result_t urProgramBuildExp( const char *pOptions) { auto pfnBuildExp = getContext()->urDdiTable.ProgramExp.pfnBuildExp; - getContext()->logger.debug("==== urProgramBuildExp"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramBuildExp"); auto UrRes = pfnBuildExp(hProgram, numDevices, phDevices, pOptions); if (UrRes != UR_RESULT_SUCCESS) { @@ -318,7 +319,7 @@ ur_result_t urProgramLink( ur_program_handle_t *phProgram) { auto pfnProgramLink = getContext()->urDdiTable.Program.pfnLink; - getContext()->logger.debug("==== urProgramLink"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramLink"); auto UrRes = pfnProgramLink(hContext, count, phPrograms, pOptions, phProgram); if (UrRes != UR_RESULT_SUCCESS) { @@ -352,7 +353,7 @@ ur_result_t urProgramLinkExp( ur_program_handle_t *phProgram) { auto pfnProgramLinkExp = getContext()->urDdiTable.ProgramExp.pfnLinkExp; - getContext()->logger.debug("==== urProgramLinkExp"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramLinkExp"); auto UrRes = pfnProgramLinkExp(hContext, numDevices, phDevices, count, phPrograms, pOptions, phProgram); @@ -374,7 +375,7 @@ ur_result_t urProgramRelease( ur_program_handle_t hProgram) { auto pfnProgramRelease = getContext()->urDdiTable.Program.pfnRelease; - getContext()->logger.debug("==== urProgramRelease"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramRelease"); UR_CALL(pfnProgramRelease(hProgram)); @@ -422,7 +423,7 @@ ur_result_t urEnqueueKernelLaunch( ur_event_handle_t *phEvent) { auto pfnKernelLaunch = getContext()->urDdiTable.Enqueue.pfnKernelLaunch; - getContext()->logger.debug("==== urEnqueueKernelLaunch"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueKernelLaunch"); USMLaunchInfo LaunchInfo(GetContext(hQueue), GetDevice(hQueue), pGlobalWorkSize, pLocalWorkSize, pGlobalWorkOffset, @@ -462,7 +463,7 @@ ur_result_t urContextCreate( ur_context_handle_t *phContext) { auto pfnCreate = getContext()->urDdiTable.Context.pfnCreate; - getContext()->logger.debug("==== urContextCreate"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urContextCreate"); ur_result_t result = pfnCreate(numDevices, phDevices, pProperties, phContext); @@ -490,7 +491,7 @@ ur_result_t urContextCreateWithNativeHandle( auto pfnCreateWithNativeHandle = getContext()->urDdiTable.Context.pfnCreateWithNativeHandle; - getContext()->logger.debug("==== urContextCreateWithNativeHandle"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urContextCreateWithNativeHandle"); ur_result_t result = pfnCreateWithNativeHandle( hNativeContext, hAdapter, numDevices, phDevices, pProperties, phContext); @@ -510,7 +511,7 @@ ur_result_t urContextRetain( ur_context_handle_t hContext) { auto pfnRetain = getContext()->urDdiTable.Context.pfnRetain; - getContext()->logger.debug("==== urContextRetain"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urContextRetain"); UR_CALL(pfnRetain(hContext)); @@ -528,7 +529,7 @@ ur_result_t urContextRelease( ur_context_handle_t hContext) { auto pfnRelease = getContext()->urDdiTable.Context.pfnRelease; - getContext()->logger.debug("==== urContextRelease"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urContextRelease"); UR_CALL(pfnRelease(hContext)); @@ -558,7 +559,7 @@ ur_result_t urMemBufferCreate( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } - getContext()->logger.debug("==== urMemBufferCreate"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemBufferCreate"); void *Host = nullptr; if (pProperties) { @@ -614,7 +615,7 @@ ur_result_t urMemGetInfo( size_t *pPropSizeRet) { auto pfnGetInfo = getContext()->urDdiTable.Mem.pfnGetInfo; - getContext()->logger.debug("==== urMemGetInfo"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemGetInfo"); if (auto MemBuffer = getMsanInterceptor()->getMemBuffer(hMemory)) { UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet); @@ -643,7 +644,7 @@ ur_result_t urMemRetain( ur_mem_handle_t hMem) { auto pfnRetain = getContext()->urDdiTable.Mem.pfnRetain; - getContext()->logger.debug("==== urMemRetain"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemRetain"); if (auto MemBuffer = getMsanInterceptor()->getMemBuffer(hMem)) { MemBuffer->RefCount++; @@ -661,7 +662,7 @@ ur_result_t urMemRelease( ur_mem_handle_t hMem) { auto pfnRelease = getContext()->urDdiTable.Mem.pfnRelease; - getContext()->logger.debug("==== urMemRelease"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemRelease"); if (auto MemBuffer = getMsanInterceptor()->getMemBuffer(hMem)) { if (--MemBuffer->RefCount != 0) { @@ -692,7 +693,7 @@ ur_result_t urMemBufferPartition( ur_mem_handle_t *phMem) { auto pfnBufferPartition = getContext()->urDdiTable.Mem.pfnBufferPartition; - getContext()->logger.debug("==== urMemBufferPartition"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemBufferPartition"); if (auto ParentBuffer = getMsanInterceptor()->getMemBuffer(hBuffer)) { if (ParentBuffer->Size < (pRegion->origin + pRegion->size)) { @@ -719,7 +720,7 @@ ur_result_t urMemGetNativeHandle( ur_native_handle_t *phNativeMem) { auto pfnGetNativeHandle = getContext()->urDdiTable.Mem.pfnGetNativeHandle; - getContext()->logger.debug("==== urMemGetNativeHandle"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemGetNativeHandle"); if (auto MemBuffer = getMsanInterceptor()->getMemBuffer(hMem)) { char *Handle = nullptr; @@ -759,7 +760,7 @@ ur_result_t urEnqueueMemBufferRead( ur_event_handle_t *phEvent) { auto pfnMemBufferRead = getContext()->urDdiTable.Enqueue.pfnMemBufferRead; - getContext()->logger.debug("==== urEnqueueMemBufferRead"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferRead"); if (auto MemBuffer = getMsanInterceptor()->getMemBuffer(hBuffer)) { ur_device_handle_t Device = GetDevice(hQueue); @@ -803,7 +804,7 @@ ur_result_t urEnqueueMemBufferWrite( ur_event_handle_t *phEvent) { auto pfnMemBufferWrite = getContext()->urDdiTable.Enqueue.pfnMemBufferWrite; - getContext()->logger.debug("==== urEnqueueMemBufferWrite"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferWrite"); if (auto MemBuffer = getMsanInterceptor()->getMemBuffer(hBuffer)) { ur_device_handle_t Device = GetDevice(hQueue); @@ -880,7 +881,7 @@ ur_result_t urEnqueueMemBufferReadRect( auto pfnMemBufferReadRect = getContext()->urDdiTable.Enqueue.pfnMemBufferReadRect; - getContext()->logger.debug("==== urEnqueueMemBufferReadRect"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferReadRect"); if (auto MemBuffer = getMsanInterceptor()->getMemBuffer(hBuffer)) { char *SrcHandle = nullptr; @@ -941,7 +942,7 @@ ur_result_t urEnqueueMemBufferWriteRect( auto pfnMemBufferWriteRect = getContext()->urDdiTable.Enqueue.pfnMemBufferWriteRect; - getContext()->logger.debug("==== urEnqueueMemBufferWriteRect"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferWriteRect"); if (auto MemBuffer = getMsanInterceptor()->getMemBuffer(hBuffer)) { char *DstHandle = nullptr; @@ -989,7 +990,7 @@ ur_result_t urEnqueueMemBufferCopy( ur_event_handle_t *phEvent) { auto pfnMemBufferCopy = getContext()->urDdiTable.Enqueue.pfnMemBufferCopy; - getContext()->logger.debug("==== urEnqueueMemBufferCopy"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferCopy"); auto SrcBuffer = getMsanInterceptor()->getMemBuffer(hBufferSrc); auto DstBuffer = getMsanInterceptor()->getMemBuffer(hBufferDst); @@ -1074,7 +1075,7 @@ ur_result_t urEnqueueMemBufferCopyRect( auto pfnMemBufferCopyRect = getContext()->urDdiTable.Enqueue.pfnMemBufferCopyRect; - getContext()->logger.debug("==== urEnqueueMemBufferCopyRect"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferCopyRect"); auto SrcBuffer = getMsanInterceptor()->getMemBuffer(hBufferSrc); auto DstBuffer = getMsanInterceptor()->getMemBuffer(hBufferDst); @@ -1131,7 +1132,7 @@ ur_result_t urEnqueueMemBufferFill( ur_event_handle_t *phEvent) { auto pfnMemBufferFill = getContext()->urDdiTable.Enqueue.pfnMemBufferFill; - getContext()->logger.debug("==== urEnqueueMemBufferFill"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferFill"); if (auto MemBuffer = getMsanInterceptor()->getMemBuffer(hBuffer)) { char *Handle = nullptr; @@ -1198,7 +1199,7 @@ ur_result_t urEnqueueMemBufferMap( void **ppRetMap) { auto pfnMemBufferMap = getContext()->urDdiTable.Enqueue.pfnMemBufferMap; - getContext()->logger.debug("==== urEnqueueMemBufferMap"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferMap"); if (auto MemBuffer = getMsanInterceptor()->getMemBuffer(hBuffer)) { @@ -1280,7 +1281,7 @@ ur_result_t urEnqueueMemUnmap( ur_event_handle_t *phEvent) { auto pfnMemUnmap = getContext()->urDdiTable.Enqueue.pfnMemUnmap; - getContext()->logger.debug("==== urEnqueueMemUnmap"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemUnmap"); if (auto MemBuffer = getMsanInterceptor()->getMemBuffer(hMem)) { MemBuffer::Mapping Mapping{}; @@ -1321,7 +1322,7 @@ ur_result_t urKernelRetain( ur_kernel_handle_t hKernel) { auto pfnRetain = getContext()->urDdiTable.Kernel.pfnRetain; - getContext()->logger.debug("==== urKernelRetain"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urKernelRetain"); UR_CALL(pfnRetain(hKernel)); @@ -1338,7 +1339,7 @@ ur_result_t urKernelRelease( ur_kernel_handle_t hKernel) { auto pfnRelease = getContext()->urDdiTable.Kernel.pfnRelease; - getContext()->logger.debug("==== urKernelRelease"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urKernelRelease"); auto &KernelInfo = getMsanInterceptor()->getOrCreateKernelInfo(hKernel); if (--KernelInfo.RefCount == 0) { @@ -1364,7 +1365,7 @@ ur_result_t urKernelSetArgValue( const void *pArgValue) { auto pfnSetArgValue = getContext()->urDdiTable.Kernel.pfnSetArgValue; - getContext()->logger.debug("==== urKernelSetArgValue"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urKernelSetArgValue"); std::shared_ptr MemBuffer; if (argSize == sizeof(ur_mem_handle_t) && @@ -1393,7 +1394,7 @@ ur_result_t urKernelSetArgMemObj( ur_mem_handle_t hArgValue) { auto pfnSetArgMemObj = getContext()->urDdiTable.Kernel.pfnSetArgMemObj; - getContext()->logger.debug("==== urKernelSetArgMemObj"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urKernelSetArgMemObj"); std::shared_ptr MemBuffer; std::shared_ptr KernelInfo; @@ -1421,8 +1422,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgLocal( const ur_kernel_arg_local_properties_t *pProperties) { auto pfnSetArgLocal = getContext()->urDdiTable.Kernel.pfnSetArgLocal; - getContext()->logger.debug( - "==== urKernelSetArgLocal (argIndex={}, argSize={})", argIndex, argSize); + UR_LOG_L(getContext()->logger, DEBUG, + "==== urKernelSetArgLocal (argIndex={}, argSize={})", argIndex, + argSize); { auto &KI = getMsanInterceptor()->getOrCreateKernelInfo(hKernel); @@ -1459,7 +1461,7 @@ ur_result_t UR_APICALL urEnqueueUSMFill( /// must not refer to an element of the phEventWaitList array. ur_event_handle_t *phEvent) { auto pfnUSMFill = getContext()->urDdiTable.Enqueue.pfnUSMFill; - getContext()->logger.debug("==== urEnqueueUSMFill"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueUSMFill"); std::vector Events; ur_event_handle_t Event{}; @@ -1515,7 +1517,7 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy( /// must not refer to an element of the phEventWaitList array. ur_event_handle_t *phEvent) { auto pfnUSMMemcpy = getContext()->urDdiTable.Enqueue.pfnUSMMemcpy; - getContext()->logger.debug("==== urEnqueueUSMMemcpy"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueUSMMemcpy"); std::vector Events; ur_event_handle_t Event{}; @@ -1592,7 +1594,7 @@ ur_result_t UR_APICALL urEnqueueUSMFill2D( /// phEvent must not refer to an element of the phEventWaitList array. ur_event_handle_t *phEvent) { auto pfnUSMFill2D = getContext()->urDdiTable.Enqueue.pfnUSMFill2D; - getContext()->logger.debug("==== urEnqueueUSMFill2D"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueUSMFill2D"); std::vector Events; ur_event_handle_t Event{}; @@ -1656,7 +1658,7 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( /// phEvent must not refer to an element of the phEventWaitList array. ur_event_handle_t *phEvent) { auto pfnUSMMemcpy2D = getContext()->urDdiTable.Enqueue.pfnUSMMemcpy2D; - getContext()->logger.debug("==== urEnqueueUSMMemcpy2D"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueUSMMemcpy2D"); std::vector Events; ur_event_handle_t Event{}; @@ -1896,7 +1898,7 @@ ur_result_t urCheckVersion(ur_api_version_t version) { ur_result_t initMsanDDITable(ur_dditable_t *dditable) { ur_result_t result = UR_RESULT_SUCCESS; - getContext()->logger.always("==== DeviceSanitizer: MSAN"); + UR_LOG_L(getContext()->logger, QUIET, "==== DeviceSanitizer: MSAN"); if (UR_RESULT_SUCCESS == result) { result = ur_sanitizer_layer::msan::urCheckVersion(UR_API_VERSION_CURRENT); @@ -1946,7 +1948,8 @@ ur_result_t initMsanDDITable(ur_dditable_t *dditable) { } if (result != UR_RESULT_SUCCESS) { - getContext()->logger.error("Initialize MSAN DDI table failed: {}", result); + UR_LOG_L(getContext()->logger, ERR, "Initialize MSAN DDI table failed: {}", + result); } return result; diff --git a/unified-runtime/source/loader/layers/sanitizer/msan/msan_interceptor.cpp b/unified-runtime/source/loader/layers/sanitizer/msan/msan_interceptor.cpp index 160537365f9e..33eaf0820e54 100644 --- a/unified-runtime/source/loader/layers/sanitizer/msan/msan_interceptor.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/msan/msan_interceptor.cpp @@ -125,7 +125,7 @@ ur_result_t MsanInterceptor::preLaunchKernel(ur_kernel_handle_t Kernel, ManagedQueue InternalQueue(Context, Device); if (!InternalQueue) { - getContext()->logger.error("Failed to create internal queue"); + UR_LOG_L(getContext()->logger, ERR, "Failed to create internal queue"); return UR_RESULT_ERROR_INVALID_QUEUE; } @@ -160,13 +160,13 @@ ur_result_t MsanInterceptor::postLaunchKernel(ur_kernel_handle_t Kernel, ur_result_t MsanInterceptor::registerProgram(ur_program_handle_t Program) { ur_result_t Result = UR_RESULT_SUCCESS; - getContext()->logger.info("registerSpirKernels"); + UR_LOG_L(getContext()->logger, INFO, "registerSpirKernels"); Result = registerSpirKernels(Program); if (Result != UR_RESULT_SUCCESS) { return Result; } - getContext()->logger.info("registerDeviceGlobals"); + UR_LOG_L(getContext()->logger, INFO, "registerDeviceGlobals"); Result = registerDeviceGlobals(Program); if (Result != UR_RESULT_SUCCESS) { return Result; @@ -205,8 +205,8 @@ ur_result_t MsanInterceptor::registerSpirKernels(ur_program_handle_t Program) { Queue, true, &SKInfo[0], MetadataPtr, sizeof(SpirKernelInfo) * NumOfSpirKernel, 0, nullptr, nullptr); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error("Can't read the value of <{}>: {}", - kSPIR_MsanSpirKernelMetadata, Result); + UR_LOG_L(getContext()->logger, ERR, "Can't read the value of <{}>: {}", + kSPIR_MsanSpirKernelMetadata, Result); return Result; } @@ -220,23 +220,25 @@ ur_result_t MsanInterceptor::registerSpirKernels(ur_program_handle_t Program) { Queue, true, KernelNameV.data(), (void *)SKI.KernelName, sizeof(char) * SKI.Size, 0, nullptr, nullptr); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error("Can't read kernel name: {}", Result); + UR_LOG_L(getContext()->logger, ERR, "Can't read kernel name: {}", + Result); return Result; } std::string KernelName = std::string(KernelNameV.begin(), KernelNameV.end()); - getContext()->logger.info("SpirKernel(name='{}', isInstrumented={}, " - "checkLocals={}, checkPrivates={})", - KernelName, true, (bool)SKI.CheckLocals, - (bool)SKI.CheckPrivates); + UR_LOG_L(getContext()->logger, INFO, + "SpirKernel(name='{}', isInstrumented={}, " + "checkLocals={}, checkPrivates={})", + KernelName, true, (bool)SKI.CheckLocals, + (bool)SKI.CheckPrivates); PI->KernelMetadataMap[KernelName] = ProgramInfo::KernelMetada{ (bool)SKI.CheckLocals, (bool)SKI.CheckPrivates}; } - getContext()->logger.info("Number of sanitized kernel: {}", - PI->KernelMetadataMap.size()); + UR_LOG_L(getContext()->logger, INFO, "Number of sanitized kernel: {}", + PI->KernelMetadataMap.size()); } return UR_RESULT_SUCCESS; @@ -260,7 +262,7 @@ MsanInterceptor::registerDeviceGlobals(ur_program_handle_t Program) { Device, Program, kSPIR_MsanDeviceGlobalMetadata, &MetadataSize, &MetadataPtr); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.info("No device globals"); + UR_LOG_L(getContext()->logger, INFO, "No device globals"); continue; } @@ -272,8 +274,8 @@ MsanInterceptor::registerDeviceGlobals(ur_program_handle_t Program) { Queue, true, &GVInfos[0], MetadataPtr, sizeof(DeviceGlobalInfo) * NumOfDeviceGlobal, 0, nullptr, nullptr); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error("Device Global[{}] Read Failed: {}", - kSPIR_MsanDeviceGlobalMetadata, Result); + UR_LOG_L(getContext()->logger, ERR, "Device Global[{}] Read Failed: {}", + kSPIR_MsanDeviceGlobalMetadata, Result); return Result; } @@ -436,11 +438,11 @@ ur_result_t MsanInterceptor::prepareLaunch( // Set membuffer arguments auto &KernelInfo = getOrCreateKernelInfo(Kernel); - getContext()->logger.info("KernelInfo {} (Name=<{}>, IsInstrumented={}, " - "IsCheckLocals={}, IsCheckPrivates={})", - (void *)Kernel, GetKernelName(Kernel), - KernelInfo.IsInstrumented, KernelInfo.IsCheckLocals, - KernelInfo.IsCheckPrivates); + UR_LOG_L(getContext()->logger, INFO, + "KernelInfo {} (Name=<{}>, IsInstrumented={}, " + "IsCheckLocals={}, IsCheckPrivates={})", + (void *)Kernel, GetKernelName(Kernel), KernelInfo.IsInstrumented, + KernelInfo.IsCheckLocals, KernelInfo.IsCheckPrivates); std::shared_lock Guard(KernelInfo.Mutex); @@ -450,9 +452,10 @@ ur_result_t MsanInterceptor::prepareLaunch( ur_result_t URes = getContext()->urDdiTable.Kernel.pfnSetArgPointer( Kernel, ArgIndex, nullptr, ArgPointer); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error( - "Failed to set buffer {} as the {} arg to kernel {}: {}", - ur_cast(MemBuffer.get()), ArgIndex, Kernel, URes); + UR_LOG_L(getContext()->logger, ERR, + "Failed to set buffer {} as the {} arg to kernel {}: {}", + ur_cast(MemBuffer.get()), ArgIndex, Kernel, + URes); } } @@ -508,18 +511,18 @@ ur_result_t MsanInterceptor::prepareLaunch( if (DeviceInfo->Shadow->AllocLocalShadow( Queue, NumWG, LaunchInfo.Data.Host.LocalShadowOffset, LaunchInfo.Data.Host.LocalShadowOffsetEnd) != UR_RESULT_SUCCESS) { - getContext()->logger.warning( - "Failed to allocate shadow memory for local " - "memory, maybe the number of workgroup ({}) is too " - "large", - NumWG); - getContext()->logger.warning("Skip checking local memory of kernel <{}> ", - GetKernelName(Kernel)); + UR_LOG_L(getContext()->logger, WARN, + "Failed to allocate shadow memory for local memory, " + "maybe the number of workgroup ({}) is too large", + NumWG); + UR_LOG_L(getContext()->logger, WARN, + "Skip checking local memory of kernel <{}> ", + GetKernelName(Kernel)); } else { - getContext()->logger.debug( - "ShadowMemory(Local, WorkGroup={}, {} - {})", NumWG, - (void *)LaunchInfo.Data.Host.LocalShadowOffset, - (void *)LaunchInfo.Data.Host.LocalShadowOffsetEnd); + UR_LOG_L(getContext()->logger, DEBUG, + "ShadowMemory(Local, WorkGroup={}, {} - {})", NumWG, + (void *)LaunchInfo.Data.Host.LocalShadowOffset, + (void *)LaunchInfo.Data.Host.LocalShadowOffsetEnd); } } @@ -528,26 +531,26 @@ ur_result_t MsanInterceptor::prepareLaunch( if (DeviceInfo->Shadow->AllocPrivateShadow( Queue, NumWG, LaunchInfo.Data.Host.PrivateShadowOffset, LaunchInfo.Data.Host.PrivateShadowOffsetEnd) != UR_RESULT_SUCCESS) { - getContext()->logger.warning( - "Failed to allocate shadow memory for private " - "memory, maybe the number of workgroup ({}) is too " - "large", - NumWG); - getContext()->logger.warning( - "Skip checking private memory of kernel <{}>", GetKernelName(Kernel)); + UR_LOG_L(getContext()->logger, WARN, + "Failed to allocate shadow memory for private memory, " + "maybe the number of workgroup ({}) is too large", + NumWG); + UR_LOG_L(getContext()->logger, WARN, + "Skip checking private memory of kernel <{}>", + GetKernelName(Kernel)); } else { - getContext()->logger.debug( - "ShadowMemory(Private, WorkGroup={}, {} - {})", NumWG, - (void *)LaunchInfo.Data.Host.PrivateShadowOffset, - (void *)LaunchInfo.Data.Host.PrivateShadowOffsetEnd); + UR_LOG_L(getContext()->logger, DEBUG, + "ShadowMemory(Private, WorkGroup={}, {} - {})", NumWG, + (void *)LaunchInfo.Data.Host.PrivateShadowOffset, + (void *)LaunchInfo.Data.Host.PrivateShadowOffsetEnd); } // Write local arguments info if (!KernelInfo.LocalArgs.empty()) { std::vector LocalArgsInfo; for (auto [ArgIndex, ArgInfo] : KernelInfo.LocalArgs) { LocalArgsInfo.push_back(ArgInfo); - getContext()->logger.debug("LocalArgs (argIndex={}, size={})", ArgIndex, - ArgInfo.Size); + UR_LOG_L(getContext()->logger, DEBUG, + "LocalArgs (argIndex={}, size={})", ArgIndex, ArgInfo.Size); } UR_CALL(LaunchInfo.Data.importLocalArgsInfo(Queue, LocalArgsInfo)); } @@ -556,7 +559,8 @@ ur_result_t MsanInterceptor::prepareLaunch( // sync msan runtime data to device side UR_CALL(LaunchInfo.Data.syncToDevice(Queue)); - getContext()->logger.info( + UR_LOG_L( + getContext()->logger, INFO, "LaunchInfo {} (GlobalShadow={}, LocalShadow={}, PrivateShadow={}, " "CleanShadow={}, LocalArgs={}, NumLocalArgs={}, Device={}, Debug={})", (void *)LaunchInfo.Data.getDevicePtr(), @@ -573,9 +577,10 @@ ur_result_t MsanInterceptor::prepareLaunch( sizeof(LaunchInfo.Data.DevicePtr), 0, &LaunchInfo.Data.DevicePtr, 0, nullptr, nullptr); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.info("EnqueueWriteGlobal(__MsanLaunchInfo) " - "failed, maybe empty kernel: {}", - URes); + UR_LOG_L(getContext()->logger, INFO, + "EnqueueWriteGlobal(__MsanLaunchInfo) " + "failed, maybe empty kernel: {}", + URes); } return UR_RESULT_SUCCESS; @@ -617,9 +622,8 @@ ur_result_t DeviceInfo::allocShadowMemory(ur_context_handle_t Context) { Shadow = GetMsanShadowMemory(Context, Handle, Type); assert(Shadow && "Failed to get shadow memory"); UR_CALL(Shadow->Setup()); - getContext()->logger.info("ShadowMemory(Global): {} - {}", - (void *)Shadow->ShadowBegin, - (void *)Shadow->ShadowEnd); + UR_LOG_L(getContext()->logger, INFO, "ShadowMemory(Global): {} - {}", + (void *)Shadow->ShadowBegin, (void *)Shadow->ShadowEnd); return UR_RESULT_SUCCESS; } diff --git a/unified-runtime/source/loader/layers/sanitizer/msan/msan_interceptor.hpp b/unified-runtime/source/loader/layers/sanitizer/msan/msan_interceptor.hpp index fb50e36f5a51..4c141b462268 100644 --- a/unified-runtime/source/loader/layers/sanitizer/msan/msan_interceptor.hpp +++ b/unified-runtime/source/loader/layers/sanitizer/msan/msan_interceptor.hpp @@ -168,8 +168,9 @@ struct MsanRuntimeDataWrapper { Context, Device, nullptr, nullptr, sizeof(MsanRuntimeData), (void **)&DevicePtr); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error( - "Failed to alloc device usm for msan runtime data: {}", Result); + UR_LOG_L(getContext()->logger, ERR, + "Failed to alloc device usm for msan runtime data: {}", + Result); } } return DevicePtr; diff --git a/unified-runtime/source/loader/layers/sanitizer/msan/msan_report.cpp b/unified-runtime/source/loader/layers/sanitizer/msan/msan_report.cpp index f2176c7178e4..19ceca7856a5 100644 --- a/unified-runtime/source/loader/layers/sanitizer/msan/msan_report.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/msan/msan_report.cpp @@ -31,20 +31,22 @@ void ReportUsesUninitializedValue(const MsanErrorReport &Report, KernelName = DemangleName(KernelName); if (Report.Origin) { - getContext()->logger.always( + UR_LOG_L( + getContext()->logger, QUIET, "====WARNING: DeviceSanitizer: use-of-uninitialized-value (shadow: {})", (void *)Report.Origin); } else { - getContext()->logger.always( - "====WARNING: DeviceSanitizer: use-of-uninitialized-value"); + UR_LOG_L(getContext()->logger, QUIET, + "====WARNING: DeviceSanitizer: use-of-uninitialized-value"); } - getContext()->logger.always( - "use of size {} at kernel <{}> LID({}, {}, {}) GID({}, " - "{}, {})", - Report.AccessSize, KernelName.c_str(), Report.LID0, Report.LID1, - Report.LID2, Report.GID0, Report.GID1, Report.GID2); - getContext()->logger.always(" #0 {} {}:{}", Func, File, Report.Line); + UR_LOG_L(getContext()->logger, QUIET, + "use of size {} at kernel <{}> LID({}, {}, {}) GID({}, " + "{}, {})", + Report.AccessSize, KernelName.c_str(), Report.LID0, Report.LID1, + Report.LID2, Report.GID0, Report.GID1, Report.GID2); + UR_LOG_L(getContext()->logger, QUIET, " #0 {} {}:{}", Func, File, + Report.Line); } } // namespace msan diff --git a/unified-runtime/source/loader/layers/sanitizer/msan/msan_shadow.cpp b/unified-runtime/source/loader/layers/sanitizer/msan/msan_shadow.cpp index ef54faeba18d..b1dfff4505fe 100644 --- a/unified-runtime/source/loader/layers/sanitizer/msan/msan_shadow.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/msan/msan_shadow.cpp @@ -45,7 +45,7 @@ GetMsanShadowMemory(ur_context_handle_t Context, ur_device_handle_t Device, std::make_shared(Context, Device); return ShadowDG2; } else { - getContext()->logger.error("Unsupport device type"); + UR_LOG_L(getContext()->logger, ERR, "Unsupport device type"); return nullptr; } } @@ -118,9 +118,10 @@ ur_result_t MsanShadowMemoryCPU::EnqueuePoisonShadow( const uptr ShadowBegin = MemToShadow(Ptr); const uptr ShadowEnd = MemToShadow(Ptr + Size - 1); assert(ShadowBegin <= ShadowEnd); - getContext()->logger.debug( - "EnqueuePoisonShadow(addr={}, count={}, value={})", (void *)ShadowBegin, - ShadowEnd - ShadowBegin + 1, (void *)(size_t)Value); + UR_LOG_L(getContext()->logger, DEBUG, + "EnqueuePoisonShadow(addr={}, count={}, value={})", + (void *)ShadowBegin, ShadowEnd - ShadowBegin + 1, + (void *)(size_t)Value); memset((void *)ShadowBegin, Value, ShadowEnd - ShadowBegin + 1); } @@ -146,9 +147,9 @@ ur_result_t MsanShadowMemoryGPU::Setup() { auto Result = getContext()->urDdiTable.VirtualMem.pfnReserve( Context, StartAddress, ShadowSize, (void **)&ShadowBegin); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error( - "Shadow memory reserved failed with size {}: {}", (void *)ShadowSize, - Result); + UR_LOG_L(getContext()->logger, ERR, + "Shadow memory reserved failed with size {}: {}", + (void *)ShadowSize, Result); return Result; } ShadowEnd = ShadowBegin + ShadowSize; @@ -192,7 +193,7 @@ ur_result_t MsanShadowMemoryGPU::EnqueueMapShadow( auto URes = getContext()->urDdiTable.PhysicalMem.pfnCreate( Context, Device, PageSize, nullptr, &PhysicalMem); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("urPhysicalMemCreate(): {}", URes); + UR_LOG_L(getContext()->logger, ERR, "urPhysicalMemCreate(): {}", URes); return URes; } @@ -200,20 +201,20 @@ ur_result_t MsanShadowMemoryGPU::EnqueueMapShadow( Context, (void *)MappedPtr, PageSize, PhysicalMem, 0, UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("urVirtualMemMap({}, {}): {}", - (void *)MappedPtr, PageSize, URes); + UR_LOG_L(getContext()->logger, ERR, "urVirtualMemMap({}, {}): {}", + (void *)MappedPtr, PageSize, URes); return URes; } - getContext()->logger.debug("urVirtualMemMap: {} ~ {}", (void *)MappedPtr, - (void *)(MappedPtr + PageSize - 1)); + UR_LOG_L(getContext()->logger, DEBUG, "urVirtualMemMap: {} ~ {}", + (void *)MappedPtr, (void *)(MappedPtr + PageSize - 1)); // Initialize to zero URes = EnqueueUSMBlockingSet(Queue, (void *)MappedPtr, 0, PageSize, EventWaitList.size(), EventWaitList.data(), OutEvent); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("EnqueueUSMSet(): {}", URes); + UR_LOG_L(getContext()->logger, ERR, "EnqueueUSMSet(): {}", URes); return URes; } @@ -257,10 +258,10 @@ ur_result_t MsanShadowMemoryGPU::EnqueuePoisonShadow( ShadowEnd - ShadowBegin + 1, Events.size(), Events.data(), OutEvent); - getContext()->logger.debug( - "EnqueuePoisonShadow(addr={}, count={}, value={}): {}", - (void *)ShadowBegin, ShadowEnd - ShadowBegin + 1, (void *)(size_t)Value, - Result); + UR_LOG_L(getContext()->logger, DEBUG, + "EnqueuePoisonShadow(addr={}, count={}, value={}): {}", + (void *)ShadowBegin, ShadowEnd - ShadowBegin + 1, + (void *)(size_t)Value, Result); return Result; } @@ -285,9 +286,8 @@ MsanShadowMemoryGPU::ReleaseShadow(std::shared_ptr AI) { Context, (void *)MappedPtr, PageSize)); UR_CALL(getContext()->urDdiTable.PhysicalMem.pfnRelease( VirtualMemMaps[MappedPtr].first)); - getContext()->logger.debug("urVirtualMemUnmap: {} ~ {}", - (void *)MappedPtr, - (void *)(MappedPtr + PageSize - 1)); + UR_LOG_L(getContext()->logger, DEBUG, "urVirtualMemUnmap: {} ~ {}", + (void *)MappedPtr, (void *)(MappedPtr + PageSize - 1)); } } diff --git a/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/linux/sanitizer_utils.cpp b/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/linux/sanitizer_utils.cpp index e7e1b77da010..a349f39a19a6 100644 --- a/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/linux/sanitizer_utils.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/linux/sanitizer_utils.cpp @@ -67,12 +67,13 @@ bool DontCoredumpRange(uptr Addr, uptr Size) { void *GetMemFunctionPointer(const char *FuncName) { void *handle = dlopen(LIBC_SO, RTLD_LAZY | RTLD_NOLOAD); if (!handle) { - getContext()->logger.error("Failed to dlopen {}", LIBC_SO); + UR_LOG_L(getContext()->logger, ERR, "Failed to dlopen {}", LIBC_SO); return nullptr; } auto ptr = dlsym(handle, FuncName); if (!ptr) { - getContext()->logger.error("Failed to get '{}' from {}", FuncName, LIBC_SO); + UR_LOG_L(getContext()->logger, ERR, "Failed to get '{}' from {}", FuncName, + LIBC_SO); } return ptr; } diff --git a/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_options.cpp b/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_options.cpp index 3ac106534147..96daf0f1aeb9 100644 --- a/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_options.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_options.cpp @@ -29,7 +29,7 @@ void SanitizerOptions::Init(const std::string &EnvName, std::stringstream SS; SS << "[ERROR]: "; SS << e.what(); - Logger.always(SS.str().c_str()); + UR_LOG_L(Logger, QUIET, SS.str().c_str()); die("Sanitizer failed to parse options.\n"); } @@ -53,8 +53,8 @@ void SanitizerOptions::Init(const std::string &EnvName, MinRZSize = IsPowerOfTwo(MinRZSize) ? MinRZSize : RoundUpToPowerOfTwo(MinRZSize); if (MinRZSize > 16) { - Logger.warning( - "Increasing the redzone size may cause excessive memory overhead"); + UR_LOG_L(Logger, WARN, + "Increasing the redzone size may cause excessive memory overhead"); } } diff --git a/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_options_impl.hpp b/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_options_impl.hpp index 6087c540be83..c144c8f71077 100644 --- a/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_options_impl.hpp +++ b/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_options_impl.hpp @@ -72,7 +72,7 @@ struct OptionParser { SS << " \"" << S << "\""; } SS << "."; - Logger.error(SS.str().c_str()); + UR_LOG_L(Logger, ERR, SS.str().c_str()); die("Sanitizer failed to parse options.\n"); } } @@ -93,22 +93,25 @@ struct OptionParser { uint64_t Value = std::stoul(ValueStr.c_str()); if (Value < Min) { - Logger.warning("The valid range of \"{}\" is [{}, {}]. " - "Setting to the minimum value {}.", - Name, Min, Max, Min); + UR_LOG_L(Logger, WARN, + "The valid range of \"{}\" is [{}, {}]. " + "Setting to the minimum value {}.", + Name, Min, Max, Min); Result = Min; } else if (Value > Max) { - Logger.warning("The valid range of \"{}\" is [{}, {}]. " - "Setting to the maximum value {}.", - Name, Min, Max, Max); + UR_LOG_L(Logger, WARN, + "The valid range of \"{}\" is [{}, {}]. " + "Setting to the maximum value {}.", + Name, Min, Max, Max); Result = Max; } else { Result = Value; } } catch (...) { - Logger.error("The valid range of \"{}\" is [{}, {}]. Failed " - "to parse the value \"{}\".", - Name, Min, Max, ValueStr); + UR_LOG_L(Logger, ERR, + "The valid range of \"{}\" is [{}, {}]. Failed " + "to parse the value \"{}\".", + Name, Min, Max, ValueStr); die("Sanitizer failed to parse options.\n"); } } diff --git a/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_stacktrace.cpp b/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_stacktrace.cpp index ab4e5e5a3233..676e753a02d4 100644 --- a/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_stacktrace.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_stacktrace.cpp @@ -82,7 +82,7 @@ SourceInfo ParseSymbolizerOutput(const std::string &Output) { void StackTrace::print() const { if (!stack.size()) { - getContext()->logger.always(" failed to acquire backtrace"); + UR_LOG_L(getContext()->logger, QUIET, " failed to acquire backtrace"); } unsigned index = 0; @@ -113,21 +113,20 @@ void StackTrace::print() const { std::string Result((char *)ResultVector.data()); SourceInfo SrcInfo = ParseSymbolizerOutput(Result); if (SrcInfo.file != "??") { - getContext()->logger.always(" #{} in {} {}:{}:{}", index, - SrcInfo.function, SrcInfo.file, - SrcInfo.line, SrcInfo.column); + UR_LOG_L(getContext()->logger, QUIET, " #{} in {} {}:{}:{}", index, + SrcInfo.function, SrcInfo.file, SrcInfo.line, + SrcInfo.column); } else { - getContext()->logger.always(" #{} in {} ({}+{})", index, - SrcInfo.function, ModuleName, - (void *)Offset); + UR_LOG_L(getContext()->logger, QUIET, " #{} in {} ({}+{})", index, + SrcInfo.function, ModuleName, (void *)Offset); } } } else { - getContext()->logger.always(" #{} {}", index, BI); + UR_LOG_L(getContext()->logger, QUIET, " #{} {}", index, BI); } ++index; } - getContext()->logger.always(""); + UR_LOG_L(getContext()->logger, QUIET, ""); free(BacktraceSymbols); } diff --git a/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_utils.cpp b/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_utils.cpp index 77f277548e18..b7e7fe41e48b 100644 --- a/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_utils.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_utils.cpp @@ -22,16 +22,17 @@ ManagedQueue::ManagedQueue(ur_context_handle_t Context, [[maybe_unused]] auto Result = getContext()->urDdiTable.Queue.pfnCreate( Context, Device, nullptr, &Handle); assert(Result == UR_RESULT_SUCCESS && "Failed to create ManagedQueue"); - getContext()->logger.debug(">>> ManagedQueue {}", (void *)Handle); + UR_LOG_L(getContext()->logger, DEBUG, ">>> ManagedQueue {}", (void *)Handle); } ManagedQueue::~ManagedQueue() { - getContext()->logger.debug("<<< ~ManagedQueue {}", (void *)Handle); + UR_LOG_L(getContext()->logger, DEBUG, "<<< ~ManagedQueue {}", (void *)Handle); [[maybe_unused]] ur_result_t Result; Result = getContext()->urDdiTable.Queue.pfnFinish(Handle); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to finish ManagedQueue: {}", Result); + UR_LOG_L(getContext()->logger, ERR, "Failed to finish ManagedQueue: {}", + Result); } assert(Result == UR_RESULT_SUCCESS && "Failed to finish ManagedQueue"); Result = getContext()->urDdiTable.Queue.pfnRelease(Handle); @@ -149,7 +150,7 @@ DeviceType GetDeviceType(ur_context_handle_t Context, [[maybe_unused]] ur_result_t Result = getContext()->urDdiTable.USM.pfnDeviceAlloc(Context, Device, nullptr, nullptr, 4, (void **)&Ptr); - getContext()->logger.debug("GetDeviceType: {}", (void *)Ptr); + UR_LOG_L(getContext()->logger, DEBUG, "GetDeviceType: {}", (void *)Ptr); assert(Result == UR_RESULT_SUCCESS && "getDeviceType() failed at allocating device USM"); // FIXME: There's no API querying the address bits of device, so we guess it @@ -262,8 +263,8 @@ void PrintUrBuildLogIfError(ur_result_t Result, ur_program_handle_t Program, Result == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) return; - getContext()->logger.error("Printing build log for program {}", - (void *)Program); + UR_LOG_L(getContext()->logger, ERR, "Printing build log for program {}", + (void *)Program); for (size_t I = 0; I < NumDevices; I++) { std::vector LogBuf; size_t LogSize = 0; @@ -272,8 +273,8 @@ void PrintUrBuildLogIfError(ur_result_t Result, ur_program_handle_t Program, auto UrRes = getContext()->urDdiTable.Program.pfnGetBuildInfo( Program, Device, UR_PROGRAM_BUILD_INFO_LOG, 0, nullptr, &LogSize); if (UrRes != UR_RESULT_SUCCESS) { - getContext()->logger.error("For device {}: failed to get build log size.", - (void *)Device); + UR_LOG_L(getContext()->logger, ERR, + "For device {}: failed to get build log size.", (void *)Device); continue; } @@ -282,13 +283,13 @@ void PrintUrBuildLogIfError(ur_result_t Result, ur_program_handle_t Program, Program, Device, UR_PROGRAM_BUILD_INFO_LOG, LogSize, LogBuf.data(), nullptr); if (UrRes != UR_RESULT_SUCCESS) { - getContext()->logger.error("For device {}: failed to get build log.", - (void *)Device); + UR_LOG_L(getContext()->logger, ERR, + "For device {}: failed to get build log.", (void *)Device); continue; } - getContext()->logger.error("For device {}:\n{}", (void *)Device, - LogBuf.data()); + UR_LOG_L(getContext()->logger, ERR, "For device {}:\n{}", (void *)Device, + LogBuf.data()); } } diff --git a/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_buffer.cpp b/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_buffer.cpp index aca20567fd2f..c043b1da7fc6 100644 --- a/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_buffer.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_buffer.cpp @@ -105,8 +105,8 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { Size, AllocType::DEVICE_USM, ur_cast(&Allocation)); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error( - "Failed to allocate {} bytes memory for buffer {}", Size, this); + UR_LOG_L(getContext()->logger, ERR, + "Failed to allocate {} bytes memory for buffer {}", Size, this); return URes; } @@ -115,9 +115,10 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { URes = getContext()->urDdiTable.Enqueue.pfnUSMMemcpy( Queue, true, Allocation, HostPtr, Size, 0, nullptr, nullptr); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to copy {} bytes data from host " - "pointer {} to buffer {}", - Size, HostPtr, this); + UR_LOG_L(getContext()->logger, ERR, + "Failed to copy {} bytes data from host " + "pointer {} to buffer {}", + Size, HostPtr, this); return URes; } } @@ -141,9 +142,10 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { URes = getContext()->urDdiTable.USM.pfnHostAlloc( Context, &USMDesc, Pool, Size, ur_cast(&HostAllocation)); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to allocate {} bytes host " - "USM for buffer {} migration", - Size, this); + UR_LOG_L(getContext()->logger, ERR, + "Failed to allocate {} bytes host " + "USM for buffer {} migration", + Size, this); return URes; } } @@ -155,7 +157,8 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { Queue, true, HostAllocation, LastSyncedDevice.MemHandle, Size, 0, nullptr, nullptr); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to migrate memory buffer data"); + UR_LOG_L(getContext()->logger, ERR, + "Failed to migrate memory buffer data"); return URes; } } @@ -166,7 +169,8 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) { URes = getContext()->urDdiTable.Enqueue.pfnUSMMemcpy( Queue, true, Allocation, HostAllocation, Size, 0, nullptr, nullptr); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to migrate memory buffer data"); + UR_LOG_L(getContext()->logger, ERR, + "Failed to migrate memory buffer data"); return URes; } } @@ -181,7 +185,8 @@ ur_result_t MemBuffer::free() { for (const auto &[_, Ptr] : Allocations) { ur_result_t URes = getContext()->urDdiTable.USM.pfnFree(Context, Ptr); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("Failed to free buffer handle {}", Ptr); + UR_LOG_L(getContext()->logger, ERR, "Failed to free buffer handle {}", + Ptr); return URes; } } diff --git a/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_ddi.cpp b/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_ddi.cpp index e6039c607791..a3d3b6d89cea 100644 --- a/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_ddi.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_ddi.cpp @@ -31,7 +31,7 @@ ur_result_t setupContext(ur_context_handle_t Context, uint32_t numDevices, UR_CALL(getTsanInterceptor()->insertDevice(phDevices[i], DI)); DI->Type = GetDeviceType(Context, DI->Handle); if (DI->Type == DeviceType::UNKNOWN) { - getContext()->logger.error("Unsupport device"); + UR_LOG_L(getContext()->logger, ERR, "Unsupport device"); return UR_RESULT_ERROR_INVALID_DEVICE; } if (!DI->Shadow) @@ -54,7 +54,7 @@ __urdlllocal ur_result_t UR_APICALL urContextCreate( const ur_context_properties_t *pProperties, /// [out] pointer to handle of context object created ur_context_handle_t *phContext) { - getContext()->logger.debug("==== urContextCreate"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urContextCreate"); UR_CALL(getContext()->urDdiTable.Context.pfnCreate(numDevices, phDevices, pProperties, phContext)); @@ -78,7 +78,7 @@ __urdlllocal ur_result_t UR_APICALL urContextCreateWithNativeHandle( const ur_context_native_properties_t *pProperties, /// [out] pointer to the handle of the context object created. ur_context_handle_t *phContext) { - getContext()->logger.debug("==== urContextCreateWithNativeHandle"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urContextCreateWithNativeHandle"); UR_CALL(getContext()->urDdiTable.Context.pfnCreateWithNativeHandle( hNativeContext, hAdapter, numDevices, phDevices, pProperties, phContext)); @@ -94,13 +94,13 @@ ur_result_t urContextRetain( /// [in] handle of the context to get a reference of. ur_context_handle_t hContext) { - getContext()->logger.debug("==== urContextRetain"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urContextRetain"); UR_CALL(getContext()->urDdiTable.Context.pfnRetain(hContext)); auto ContextInfo = getTsanInterceptor()->getContextInfo(hContext); if (!ContextInfo) { - getContext()->logger.error("Invalid context"); + UR_LOG_L(getContext()->logger, ERR, "Invalid context"); return UR_RESULT_ERROR_INVALID_CONTEXT; } ContextInfo->RefCount++; @@ -113,13 +113,13 @@ ur_result_t urContextRetain( ur_result_t urContextRelease( /// [in] handle of the context to release. ur_context_handle_t hContext) { - getContext()->logger.debug("==== urContextRelease"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urContextRelease"); UR_CALL(getContext()->urDdiTable.Context.pfnRelease(hContext)); auto ContextInfo = getTsanInterceptor()->getContextInfo(hContext); if (!ContextInfo) { - getContext()->logger.error("Invalid context"); + UR_LOG_L(getContext()->logger, ERR, "Invalid context"); return UR_RESULT_ERROR_INVALID_CONTEXT; } @@ -138,7 +138,7 @@ ur_result_t urProgramBuild( ur_program_handle_t hProgram, /// [in] string of build options const char *pOptions) { - getContext()->logger.debug("==== urProgramBuild"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramBuild"); auto UrRes = getContext()->urDdiTable.Program.pfnBuild(hContext, hProgram, pOptions); @@ -166,7 +166,7 @@ ur_result_t urProgramLink( const char *pOptions, /// [out] pointer to handle of program object created. ur_program_handle_t *phProgram) { - getContext()->logger.debug("==== urProgramLink"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramLink"); auto UrRes = getContext()->urDdiTable.Program.pfnLink( hContext, count, phPrograms, pOptions, phProgram); @@ -191,7 +191,7 @@ ur_result_t urProgramBuildExp( ur_device_handle_t *phDevices, /// [in][optional] pointer to build options null-terminated string. const char *pOptions) { - getContext()->logger.debug("==== urProgramBuildExp"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramBuildExp"); auto UrRes = getContext()->urDdiTable.ProgramExp.pfnBuildExp( hProgram, numDevices, phDevices, pOptions); @@ -220,7 +220,7 @@ ur_result_t urProgramLinkExp( const char *pOptions, /// [out] pointer to handle of program object created. ur_program_handle_t *phProgram) { - getContext()->logger.debug("==== urProgramLinkExp"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urProgramLinkExp"); auto UrRes = getContext()->urDdiTable.ProgramExp.pfnLinkExp( hContext, numDevices, phDevices, count, phPrograms, pOptions, phProgram); @@ -251,7 +251,7 @@ ur_result_t urMemBufferCreate( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } - getContext()->logger.debug("==== urMemBufferCreate"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemBufferCreate"); void *Host = nullptr; if (pProperties) { @@ -287,7 +287,7 @@ ur_result_t urMemBufferCreate( ur_result_t urMemRetain( /// [in] handle of the memory object to get access ur_mem_handle_t hMem) { - getContext()->logger.debug("==== urMemRetain"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemRetain"); if (auto MemBuffer = getTsanInterceptor()->getMemBuffer(hMem)) { MemBuffer->RefCount++; @@ -303,7 +303,7 @@ ur_result_t urMemRetain( ur_result_t urMemRelease( /// [in] handle of the memory object to release ur_mem_handle_t hMem) { - getContext()->logger.debug("==== urMemRelease"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemRelease"); if (auto MemBuffer = getTsanInterceptor()->getMemBuffer(hMem)) { if (--MemBuffer->RefCount != 0) { @@ -332,7 +332,7 @@ ur_result_t urMemBufferPartition( const ur_buffer_region_t *pRegion, /// [out] pointer to the handle of sub buffer created ur_mem_handle_t *phMem) { - getContext()->logger.debug("==== urMemBufferPartition"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemBufferPartition"); if (auto ParentBuffer = getTsanInterceptor()->getMemBuffer(hBuffer)) { if (ParentBuffer->Size < (pRegion->origin + pRegion->size)) { @@ -357,7 +357,7 @@ ur_result_t urMemGetNativeHandle( ur_mem_handle_t hMem, ur_device_handle_t hDevice, /// [out] a pointer to the native handle of the mem. ur_native_handle_t *phNativeMem) { - getContext()->logger.debug("==== urMemGetNativeHandle"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemGetNativeHandle"); if (auto MemBuffer = getTsanInterceptor()->getMemBuffer(hMem)) { char *Handle = nullptr; @@ -388,7 +388,7 @@ ur_result_t urMemGetInfo( /// [out][optional] pointer to the actual size in bytes of the queried /// propName. size_t *pPropSizeRet) { - getContext()->logger.debug("==== urMemGetInfo"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urMemGetInfo"); if (auto MemBuffer = getTsanInterceptor()->getMemBuffer(hMemory)) { UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet); @@ -436,7 +436,7 @@ ur_result_t urEnqueueMemBufferRead( /// [out][optional] return an event object that identifies this particular /// command instance. ur_event_handle_t *phEvent) { - getContext()->logger.debug("==== urEnqueueMemBufferRead"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferRead"); if (auto MemBuffer = getTsanInterceptor()->getMemBuffer(hBuffer)) { ur_device_handle_t Device = GetDevice(hQueue); @@ -479,7 +479,7 @@ ur_result_t urEnqueueMemBufferWrite( /// [out][optional] return an event object that identifies this particular /// command instance. ur_event_handle_t *phEvent) { - getContext()->logger.debug("==== urEnqueueMemBufferWrite"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferWrite"); if (auto MemBuffer = getTsanInterceptor()->getMemBuffer(hBuffer)) { ur_device_handle_t Device = GetDevice(hQueue); @@ -542,7 +542,7 @@ ur_result_t urEnqueueMemBufferReadRect( /// [out][optional] return an event object that identifies this particular /// command instance. ur_event_handle_t *phEvent) { - getContext()->logger.debug("==== urEnqueueMemBufferReadRect"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferReadRect"); if (auto MemBuffer = getTsanInterceptor()->getMemBuffer(hBuffer)) { char *SrcHandle = nullptr; @@ -600,7 +600,7 @@ ur_result_t urEnqueueMemBufferWriteRect( /// [out][optional] return an event object that identifies this particular /// command instance. ur_event_handle_t *phEvent) { - getContext()->logger.debug("==== urEnqueueMemBufferWriteRect"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferWriteRect"); if (auto MemBuffer = getTsanInterceptor()->getMemBuffer(hBuffer)) { char *DstHandle = nullptr; @@ -646,7 +646,7 @@ ur_result_t urEnqueueMemBufferCopy( /// [out][optional] return an event object that identifies this particular /// command instance. ur_event_handle_t *phEvent) { - getContext()->logger.debug("==== urEnqueueMemBufferCopy"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferCopy"); auto SrcBuffer = getTsanInterceptor()->getMemBuffer(hBufferSrc); auto DstBuffer = getTsanInterceptor()->getMemBuffer(hBufferDst); @@ -717,7 +717,7 @@ ur_result_t urEnqueueMemBufferCopyRect( /// [out][optional] return an event object that identifies this particular /// command instance. ur_event_handle_t *phEvent) { - getContext()->logger.debug("==== urEnqueueMemBufferCopyRect"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferCopyRect"); auto SrcBuffer = getTsanInterceptor()->getMemBuffer(hBufferSrc); auto DstBuffer = getTsanInterceptor()->getMemBuffer(hBufferDst); @@ -772,7 +772,7 @@ ur_result_t urEnqueueMemBufferFill( /// [out][optional] return an event object that identifies this particular /// command instance. ur_event_handle_t *phEvent) { - getContext()->logger.debug("==== urEnqueueMemBufferFill"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferFill"); if (auto MemBuffer = getTsanInterceptor()->getMemBuffer(hBuffer)) { char *Handle = nullptr; @@ -826,7 +826,7 @@ ur_result_t urEnqueueMemBufferMap( ur_event_handle_t *phEvent, /// [out] return mapped pointer. TODO: move it before numEventsInWaitList? void **ppRetMap) { - getContext()->logger.debug("==== urEnqueueMemBufferMap"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemBufferMap"); if (auto MemBuffer = getTsanInterceptor()->getMemBuffer(hBuffer)) { // Translate the host access mode info. @@ -905,7 +905,7 @@ ur_result_t urEnqueueMemUnmap( /// [out][optional] return an event object that identifies this particular /// command instance. ur_event_handle_t *phEvent) { - getContext()->logger.debug("==== urEnqueueMemUnmap"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueMemUnmap"); if (auto MemBuffer = getTsanInterceptor()->getMemBuffer(hMem)) { MemBuffer::Mapping Mapping{}; @@ -949,7 +949,7 @@ ur_result_t UR_APICALL urKernelCreate( const char *pKernelName, /// [out][alloc] pointer to handle of kernel object created. ur_kernel_handle_t *phKernel) { - getContext()->logger.debug("==== urKernelCreate"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urKernelCreate"); UR_CALL(getContext()->urDdiTable.Kernel.pfnCreate(hProgram, pKernelName, phKernel)); @@ -969,7 +969,7 @@ ur_result_t UR_APICALL urKernelCreateWithNativeHandle( const ur_kernel_native_properties_t *pProperties, /// [out][alloc] pointer to the handle of the kernel object created. ur_kernel_handle_t *phKernel) { - getContext()->logger.debug("==== urKernelCreate"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urKernelCreate"); UR_CALL(getContext()->urDdiTable.Kernel.pfnCreateWithNativeHandle( hNativeKernel, hContext, hProgram, pProperties, phKernel)); @@ -984,7 +984,7 @@ ur_result_t UR_APICALL urKernelCreateWithNativeHandle( ur_result_t urKernelRetain( /// [in] handle for the Kernel to retain ur_kernel_handle_t hKernel) { - getContext()->logger.debug("==== urKernelRetain"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urKernelRetain"); UR_CALL(getContext()->urDdiTable.Kernel.pfnRetain(hKernel)); @@ -1001,7 +1001,7 @@ ur_result_t urKernelRelease( ur_kernel_handle_t hKernel) { auto pfnRelease = getContext()->urDdiTable.Kernel.pfnRelease; - getContext()->logger.debug("==== urKernelRelease"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urKernelRelease"); auto &KernelInfo = getTsanInterceptor()->getKernelInfo(hKernel); if (--KernelInfo.RefCount == 0) { @@ -1025,7 +1025,7 @@ ur_result_t urKernelSetArgValue( const ur_kernel_arg_value_properties_t *pProperties, /// [in] argument value represented as matching arg type. const void *pArgValue) { - getContext()->logger.debug("==== urKernelSetArgValue"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urKernelSetArgValue"); std::shared_ptr MemBuffer; if (argSize == sizeof(ur_mem_handle_t) && @@ -1053,7 +1053,7 @@ ur_result_t urKernelSetArgMemObj( const ur_kernel_arg_mem_obj_properties_t *pProperties, /// [in][optional] handle of Memory object. ur_mem_handle_t hArgValue) { - getContext()->logger.debug("==== urKernelSetArgMemObj"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urKernelSetArgMemObj"); if (std::shared_ptr MemBuffer = getTsanInterceptor()->getMemBuffer(hArgValue)) { @@ -1083,7 +1083,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMDeviceAlloc( size_t size, /// [out] pointer to USM device memory object void **ppMem) { - getContext()->logger.debug("==== urUSMDeviceAlloc"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urUSMDeviceAlloc"); return getTsanInterceptor()->allocateMemory( hContext, hDevice, pUSMDesc, pool, size, AllocType::DEVICE_USM, ppMem); @@ -1102,7 +1102,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMHostAlloc( size_t size, /// [out] pointer to USM host memory object void **ppMem) { - getContext()->logger.debug("==== urUSMHostAlloc"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urUSMHostAlloc"); return getTsanInterceptor()->allocateMemory(hContext, nullptr, pUSMDesc, pool, size, AllocType::HOST_USM, ppMem); @@ -1123,7 +1123,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMSharedAlloc( size_t size, /// [out] pointer to USM shared memory object void **ppMem) { - getContext()->logger.debug("==== urUSMSharedAlloc"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urUSMSharedAlloc"); return getTsanInterceptor()->allocateMemory( hContext, hDevice, pUSMDesc, pool, size, AllocType::SHARED_USM, ppMem); @@ -1161,7 +1161,7 @@ ur_result_t urEnqueueKernelLaunch( /// [out][optional] return an event object that identifies this /// particular kernel execution instance. ur_event_handle_t *phEvent) { - getContext()->logger.debug("==== urEnqueueKernelLaunch"); + UR_LOG_L(getContext()->logger, DEBUG, "==== urEnqueueKernelLaunch"); LaunchInfo LaunchInfo(GetContext(hQueue), GetDevice(hQueue)); @@ -1208,7 +1208,8 @@ ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( /// are not NULL, phEvent must not refer to an element of the /// phEventWaitList array. ur_event_handle_t *phEvent) { - getContext()->logger.debug("==== urEnqueueCooperativeKernelLaunchExp"); + UR_LOG_L(getContext()->logger, DEBUG, + "==== urEnqueueCooperativeKernelLaunchExp"); LaunchInfo LaunchInfo(GetContext(hQueue), GetDevice(hQueue)); @@ -1425,7 +1426,7 @@ __urdlllocal ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( ur_result_t initTsanDDITable(ur_dditable_t *dditable) { ur_result_t result = UR_RESULT_SUCCESS; - getContext()->logger.always("==== DeviceSanitizer: TSAN"); + UR_LOG_L(getContext()->logger, QUIET, "==== DeviceSanitizer: TSAN"); if (UR_RESULT_SUCCESS == result) { result = ur_sanitizer_layer::tsan::urCheckVersion(UR_API_VERSION_CURRENT); @@ -1470,7 +1471,8 @@ ur_result_t initTsanDDITable(ur_dditable_t *dditable) { } if (result != UR_RESULT_SUCCESS) { - getContext()->logger.error("Initialize TSAN DDI table failed: {}", result); + UR_LOG_L(getContext()->logger, ERR, "Initialize TSAN DDI table failed: {}", + result); } return result; diff --git a/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_interceptor.cpp b/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_interceptor.cpp index 3e9b9fbdcdbd..e40df91a9076 100644 --- a/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_interceptor.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_interceptor.cpp @@ -33,8 +33,8 @@ TsanRuntimeData *TsanRuntimeDataWrapper::getDevicePtr() { Context, Device, nullptr, nullptr, sizeof(TsanRuntimeData), (void **)&DevicePtr); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error( - "Failed to alloc device usm for asan runtime data: {}", Result); + UR_LOG(ERR, "Failed to alloc device usm for asan runtime data: {}", + Result); } } return DevicePtr; @@ -63,9 +63,8 @@ ur_result_t DeviceInfo::allocShadowMemory() { Shadow = GetShadowMemory(ShadowContext, Handle, Type); assert(Shadow && "Failed to get shadow memory"); UR_CALL(Shadow->Setup()); - getContext()->logger.info("ShadowMemory(Global): {} - {}", - (void *)Shadow->ShadowBegin, - (void *)Shadow->ShadowEnd); + UR_LOG_L(getContext()->logger, INFO, "ShadowMemory(Global): {} - {}", + (void *)Shadow->ShadowBegin, (void *)Shadow->ShadowEnd); return UR_RESULT_SUCCESS; } @@ -111,7 +110,7 @@ ur_result_t TsanInterceptor::allocateMemory(ur_context_handle_t Context, } ur_result_t TsanInterceptor::registerProgram(ur_program_handle_t Program) { - getContext()->logger.info("registerDeviceGlobals"); + UR_LOG_L(getContext()->logger, INFO, "registerDeviceGlobals"); UR_CALL(registerDeviceGlobals(Program)); return UR_RESULT_SUCCESS; } @@ -132,7 +131,7 @@ TsanInterceptor::registerDeviceGlobals(ur_program_handle_t Program) { Device, Program, kSPIR_TsanDeviceGlobalMetadata, &MetadataSize, &MetadataPtr); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.info("No device globals"); + UR_LOG_L(getContext()->logger, INFO, "No device globals"); continue; } @@ -144,8 +143,8 @@ TsanInterceptor::registerDeviceGlobals(ur_program_handle_t Program) { Queue, true, &GVInfos[0], MetadataPtr, sizeof(DeviceGlobalInfo) * NumOfDeviceGlobal, 0, nullptr, nullptr); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error("Device Global[{}] Read Failed: {}", - kSPIR_TsanDeviceGlobalMetadata, Result); + UR_LOG_L(getContext()->logger, ERR, "Device Global[{}] Read Failed: {}", + kSPIR_TsanDeviceGlobalMetadata, Result); return Result; } @@ -253,7 +252,7 @@ ur_result_t TsanInterceptor::preLaunchKernel(ur_kernel_handle_t Kernel, ManagedQueue InternalQueue(CI->Handle, DI->Handle); if (!InternalQueue) { - getContext()->logger.error("Failed to create internal queue"); + UR_LOG_L(getContext()->logger, ERR, "Failed to create internal queue"); return UR_RESULT_ERROR_INVALID_QUEUE; } @@ -296,9 +295,10 @@ ur_result_t TsanInterceptor::prepareLaunch(std::shared_ptr &, ur_result_t URes = getContext()->urDdiTable.Kernel.pfnSetArgPointer( Kernel, ArgIndex, nullptr, ArgPointer); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error( - "Failed to set buffer {} as the {} arg to kernel {}: {}", - ur_cast(MemBuffer.get()), ArgIndex, Kernel, URes); + UR_LOG_L(getContext()->logger, ERR, + "Failed to set buffer {} as the {} arg to kernel {}: {}", + ur_cast(MemBuffer.get()), ArgIndex, Kernel, + URes); } } } @@ -318,9 +318,10 @@ ur_result_t TsanInterceptor::prepareLaunch(std::shared_ptr &, Queue, GetProgram(Kernel), "__TsanLaunchInfo", true, sizeof(LaunchInfoPtr), 0, &LaunchInfoPtr, 0, nullptr, nullptr); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.info("EnqueueWriteGlobal(__TsanLaunchInfo) " - "failed, maybe empty kernel: {}", - URes); + UR_LOG_L(getContext()->logger, INFO, + "EnqueueWriteGlobal(__TsanLaunchInfo) " + "failed, maybe empty kernel: {}", + URes); } return UR_RESULT_SUCCESS; diff --git a/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_report.cpp b/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_report.cpp index 759ae5451b27..8aefda1cd502 100644 --- a/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_report.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_report.cpp @@ -26,14 +26,16 @@ void ReportDataRace(const TsanErrorReport &Report, ur_kernel_handle_t Kernel) { // Try to demangle the kernel name KernelName = DemangleName(KernelName); - getContext()->logger.always("====WARNING: DeviceSanitizer: data race"); - getContext()->logger.always( - "When {} of size {} at {} in kernel <{}> LID({}, {}, {}) GID({}, " - "{}, {})", - Report.Type & kAccessRead ? "read" : "write", Report.AccessSize, - (void *)Report.Address, KernelName.c_str(), Report.LID0, Report.LID1, - Report.LID2, Report.GID0, Report.GID1, Report.GID2); - getContext()->logger.always(" #0 {} {}:{}", Func, File, Report.Line); + UR_LOG_L(getContext()->logger, QUIET, + "====WARNING: DeviceSanitizer: data race"); + UR_LOG_L(getContext()->logger, QUIET, + "When {} of size {} at {} in kernel <{}> LID({}, {}, {}) GID({}, " + "{}, {})", + Report.Type & kAccessRead ? "read" : "write", Report.AccessSize, + (void *)Report.Address, KernelName.c_str(), Report.LID0, Report.LID1, + Report.LID2, Report.GID0, Report.GID1, Report.GID2); + UR_LOG_L(getContext()->logger, QUIET, " #0 {} {}:{}", Func, File, + Report.Line); } } // namespace tsan diff --git a/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_shadow.cpp b/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_shadow.cpp index fde2aa711dce..495de6bf48e6 100644 --- a/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_shadow.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/tsan/tsan_shadow.cpp @@ -29,7 +29,7 @@ std::shared_ptr GetShadowMemory(ur_context_handle_t Context, } else if (Type == DeviceType::GPU_PVC) { return std::make_shared(Context, Device); } else { - getContext()->logger.error("Unsupport device type"); + UR_LOG_L(getContext()->logger, ERR, "Unsupport device type"); return nullptr; } } @@ -71,8 +71,8 @@ ur_result_t ShadowMemoryCPU::CleanShadow(ur_queue_handle_t, uptr Ptr, Size = RoundUpTo(Size, kShadowCell); RawShadow *Begin = MemToShadow(Ptr); - getContext()->logger.debug("CleanShadow(addr={}, count={})", (void *)Begin, - Size / kShadowCell); + UR_LOG_L(getContext()->logger, DEBUG, "CleanShadow(addr={}, count={})", + (void *)Begin, Size / kShadowCell); memset((void *)Begin, 0, Size / kShadowCell * kShadowCnt * kShadowSize); } return UR_RESULT_SUCCESS; @@ -91,8 +91,9 @@ ur_result_t ShadowMemoryGPU::Setup() { auto Result = getContext()->urDdiTable.VirtualMem.pfnReserve( Context, StartAddress, ShadowSize, (void **)&ShadowBegin); if (Result != UR_RESULT_SUCCESS) { - getContext()->logger.error("Shadow memory reserved failed with size {}: {}", - (void *)ShadowSize, Result); + UR_LOG_L(getContext()->logger, ERR, + "Shadow memory reserved failed with size {}: {}", + (void *)ShadowSize, Result); return Result; } ShadowEnd = ShadowBegin + ShadowSize; @@ -146,7 +147,8 @@ ur_result_t ShadowMemoryGPU::CleanShadow(ur_queue_handle_t Queue, uptr Ptr, auto URes = getContext()->urDdiTable.PhysicalMem.pfnCreate( Context, Device, PageSize, &Desc, &PhysicalMem); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("urPhysicalMemCreate(): {}", URes); + UR_LOG_L(getContext()->logger, ERR, "urPhysicalMemCreate(): {}", + URes); return URes; } @@ -154,19 +156,19 @@ ur_result_t ShadowMemoryGPU::CleanShadow(ur_queue_handle_t Queue, uptr Ptr, Context, (void *)MappedPtr, PageSize, PhysicalMem, 0, UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("urVirtualMemMap({}, {}): {}", - (void *)MappedPtr, PageSize, URes); + UR_LOG_L(getContext()->logger, ERR, "urVirtualMemMap({}, {}): {}", + (void *)MappedPtr, PageSize, URes); return URes; } - getContext()->logger.debug("urVirtualMemMap: {} ~ {}", - (void *)MappedPtr, - (void *)(MappedPtr + PageSize - 1)); + UR_LOG_L(getContext()->logger, DEBUG, "urVirtualMemMap: {} ~ {}", + (void *)MappedPtr, (void *)(MappedPtr + PageSize - 1)); // Initialize to zero URes = EnqueueUSMBlockingSet(Queue, (void *)MappedPtr, 0, PageSize); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("EnqueueUSMBlockingSet(): {}", URes); + UR_LOG_L(getContext()->logger, ERR, "EnqueueUSMBlockingSet(): {}", + URes); return URes; } @@ -178,12 +180,12 @@ ur_result_t ShadowMemoryGPU::CleanShadow(ur_queue_handle_t Queue, uptr Ptr, auto URes = EnqueueUSMBlockingSet( Queue, (void *)Begin, 0, Size / kShadowCell * kShadowCnt * kShadowSize); if (URes != UR_RESULT_SUCCESS) { - getContext()->logger.error("EnqueueUSMBlockingSet(): {}", URes); + UR_LOG_L(getContext()->logger, ERR, "EnqueueUSMBlockingSet(): {}", URes); return URes; } - getContext()->logger.debug("CleanShadow(addr={}, count={})", (void *)Begin, - Size / kShadowCell); + UR_LOG_L(getContext()->logger, DEBUG, "CleanShadow(addr={}, count={})", + (void *)Begin, Size / kShadowCell); return UR_RESULT_SUCCESS; } diff --git a/unified-runtime/source/loader/layers/sanitizer/ur_sanddi.cpp b/unified-runtime/source/loader/layers/sanitizer/ur_sanddi.cpp index 2a92d367e145..132a8db17ec0 100644 --- a/unified-runtime/source/loader/layers/sanitizer/ur_sanddi.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/ur_sanddi.cpp @@ -26,9 +26,8 @@ ur_result_t context_t::init(ur_dditable_t *dditable, bool tsanEnabled = enabledLayerNames.count("UR_LAYER_TSAN"); if ((asanEnabled + msanEnabled + tsanEnabled) >= 2) { - getContext()->logger.warning( - "Enabling ASAN or MSAN or TSAN at the same time is not " - "supported."); + UR_LOG(WARN, + "Enabling ASAN or MSAN or TSAN at the same time is not supported."); return UR_RESULT_SUCCESS; } else if (asanEnabled) { enabledType = SanitizerType::AddressSanitizer; diff --git a/unified-runtime/source/loader/layers/tracing/ur_trcddi.cpp b/unified-runtime/source/loader/layers/tracing/ur_trcddi.cpp index eb44285c1838..0c245d6db51b 100644 --- a/unified-runtime/source/loader/layers/tracing/ur_trcddi.cpp +++ b/unified-runtime/source/loader/layers/tracing/ur_trcddi.cpp @@ -42,7 +42,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGet( "urAdapterGet", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urAdapterGet\n"); + UR_LOG_L(logger, INFO, " ---> urAdapterGet\n"); ur_result_t result = pfnAdapterGet(NumEntries, phAdapters, pNumAdapters); @@ -52,7 +52,8 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGet( if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_GET, ¶ms); - logger.info(" <--- urAdapterGet({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urAdapterGet({}) -> {};\n", args_str.str(), + result); } return result; @@ -73,7 +74,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRelease( "urAdapterRelease", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urAdapterRelease\n"); + UR_LOG_L(logger, INFO, " ---> urAdapterRelease\n"); ur_result_t result = pfnAdapterRelease(hAdapter); @@ -84,8 +85,8 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRelease( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_RELEASE, ¶ms); - logger.info(" <--- urAdapterRelease({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urAdapterRelease({}) -> {};\n", + args_str.str(), result); } return result; @@ -106,7 +107,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRetain( "urAdapterRetain", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urAdapterRetain\n"); + UR_LOG_L(logger, INFO, " ---> urAdapterRetain\n"); ur_result_t result = pfnAdapterRetain(hAdapter); @@ -117,7 +118,8 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRetain( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_RETAIN, ¶ms); - logger.info(" <--- urAdapterRetain({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urAdapterRetain({}) -> {};\n", + args_str.str(), result); } return result; @@ -145,7 +147,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetLastError( UR_FUNCTION_ADAPTER_GET_LAST_ERROR, "urAdapterGetLastError", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urAdapterGetLastError\n"); + UR_LOG_L(logger, INFO, " ---> urAdapterGetLastError\n"); ur_result_t result = pfnAdapterGetLastError(hAdapter, ppMessage, pError); @@ -156,8 +158,8 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetLastError( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ADAPTER_GET_LAST_ERROR, ¶ms); - logger.info(" <--- urAdapterGetLastError({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urAdapterGetLastError({}) -> {};\n", + args_str.str(), result); } return result; @@ -192,7 +194,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetInfo( "urAdapterGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urAdapterGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urAdapterGetInfo\n"); ur_result_t result = pfnAdapterGetInfo(hAdapter, propName, propSize, pPropValue, pPropSizeRet); @@ -204,8 +206,8 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ADAPTER_GET_INFO, ¶ms); - logger.info(" <--- urAdapterGetInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urAdapterGetInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -235,7 +237,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallback( "urAdapterSetLoggerCallback", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urAdapterSetLoggerCallback\n"); + UR_LOG_L(logger, INFO, " ---> urAdapterSetLoggerCallback\n"); ur_result_t result = pfnSetLoggerCallback(hAdapter, pfnLoggerCallback, pUserData, level); @@ -248,8 +250,8 @@ __urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallback( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK, ¶ms); - logger.info(" <--- urAdapterSetLoggerCallback({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urAdapterSetLoggerCallback({}) -> {};\n", + args_str.str(), result); } return result; @@ -274,7 +276,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallbackLevel( "urAdapterSetLoggerCallbackLevel", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urAdapterSetLoggerCallbackLevel\n"); + UR_LOG_L(logger, INFO, " ---> urAdapterSetLoggerCallbackLevel\n"); ur_result_t result = pfnSetLoggerCallbackLevel(hAdapter, level); @@ -286,8 +288,9 @@ __urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallbackLevel( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ADAPTER_SET_LOGGER_CALLBACK_LEVEL, ¶ms); - logger.info(" <--- urAdapterSetLoggerCallbackLevel({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urAdapterSetLoggerCallbackLevel({}) -> {};\n", + args_str.str(), result); } return result; @@ -320,7 +323,7 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGet( "urPlatformGet", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urPlatformGet\n"); + UR_LOG_L(logger, INFO, " ---> urPlatformGet\n"); ur_result_t result = pfnGet(hAdapter, NumEntries, phPlatforms, pNumPlatforms); @@ -331,7 +334,8 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGet( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PLATFORM_GET, ¶ms); - logger.info(" <--- urPlatformGet({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urPlatformGet({}) -> {};\n", args_str.str(), + result); } return result; @@ -366,7 +370,7 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetInfo( "urPlatformGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urPlatformGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urPlatformGetInfo\n"); ur_result_t result = pfnGetInfo(hPlatform, propName, propSize, pPropValue, pPropSizeRet); @@ -378,8 +382,8 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PLATFORM_GET_INFO, ¶ms); - logger.info(" <--- urPlatformGetInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urPlatformGetInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -402,7 +406,7 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetApiVersion( UR_FUNCTION_PLATFORM_GET_API_VERSION, "urPlatformGetApiVersion", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urPlatformGetApiVersion\n"); + UR_LOG_L(logger, INFO, " ---> urPlatformGetApiVersion\n"); ur_result_t result = pfnGetApiVersion(hPlatform, pVersion); @@ -414,8 +418,8 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetApiVersion( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PLATFORM_GET_API_VERSION, ¶ms); - logger.info(" <--- urPlatformGetApiVersion({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urPlatformGetApiVersion({}) -> {};\n", + args_str.str(), result); } return result; @@ -441,7 +445,7 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetNativeHandle( "urPlatformGetNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urPlatformGetNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urPlatformGetNativeHandle\n"); ur_result_t result = pfnGetNativeHandle(hPlatform, phNativePlatform); @@ -453,8 +457,8 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PLATFORM_GET_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urPlatformGetNativeHandle({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urPlatformGetNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -484,7 +488,7 @@ __urdlllocal ur_result_t UR_APICALL urPlatformCreateWithNativeHandle( "urPlatformCreateWithNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urPlatformCreateWithNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urPlatformCreateWithNativeHandle\n"); ur_result_t result = pfnCreateWithNativeHandle(hNativePlatform, hAdapter, pProperties, phPlatform); @@ -497,8 +501,9 @@ __urdlllocal ur_result_t UR_APICALL urPlatformCreateWithNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PLATFORM_CREATE_WITH_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urPlatformCreateWithNativeHandle({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urPlatformCreateWithNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -527,7 +532,7 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetBackendOption( "urPlatformGetBackendOption", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urPlatformGetBackendOption\n"); + UR_LOG_L(logger, INFO, " ---> urPlatformGetBackendOption\n"); ur_result_t result = pfnGetBackendOption(hPlatform, pFrontendOption, ppPlatformOption); @@ -540,8 +545,8 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGetBackendOption( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION, ¶ms); - logger.info(" <--- urPlatformGetBackendOption({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urPlatformGetBackendOption({}) -> {};\n", + args_str.str(), result); } return result; @@ -577,7 +582,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGet( "urDeviceGet", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urDeviceGet\n"); + UR_LOG_L(logger, INFO, " ---> urDeviceGet\n"); ur_result_t result = pfnGet(hPlatform, DeviceType, NumEntries, phDevices, pNumDevices); @@ -588,7 +593,8 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGet( if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_GET, ¶ms); - logger.info(" <--- urDeviceGet({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urDeviceGet({}) -> {};\n", args_str.str(), + result); } return result; @@ -624,7 +630,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetInfo( "urDeviceGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urDeviceGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urDeviceGetInfo\n"); ur_result_t result = pfnGetInfo(hDevice, propName, propSize, pPropValue, pPropSizeRet); @@ -636,7 +642,8 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_GET_INFO, ¶ms); - logger.info(" <--- urDeviceGetInfo({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urDeviceGetInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -657,7 +664,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRetain( "urDeviceRetain", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urDeviceRetain\n"); + UR_LOG_L(logger, INFO, " ---> urDeviceRetain\n"); ur_result_t result = pfnRetain(hDevice); @@ -668,7 +675,8 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRetain( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_RETAIN, ¶ms); - logger.info(" <--- urDeviceRetain({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urDeviceRetain({}) -> {};\n", + args_str.str(), result); } return result; @@ -689,7 +697,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRelease( "urDeviceRelease", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urDeviceRelease\n"); + UR_LOG_L(logger, INFO, " ---> urDeviceRelease\n"); ur_result_t result = pfnRelease(hDevice); @@ -700,7 +708,8 @@ __urdlllocal ur_result_t UR_APICALL urDeviceRelease( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_RELEASE, ¶ms); - logger.info(" <--- urDeviceRelease({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urDeviceRelease({}) -> {};\n", + args_str.str(), result); } return result; @@ -733,7 +742,7 @@ __urdlllocal ur_result_t UR_APICALL urDevicePartition( "urDevicePartition", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urDevicePartition\n"); + UR_LOG_L(logger, INFO, " ---> urDevicePartition\n"); ur_result_t result = pfnPartition(hDevice, pProperties, NumDevices, phSubDevices, pNumDevicesRet); @@ -745,8 +754,8 @@ __urdlllocal ur_result_t UR_APICALL urDevicePartition( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_PARTITION, ¶ms); - logger.info(" <--- urDevicePartition({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urDevicePartition({}) -> {};\n", + args_str.str(), result); } return result; @@ -778,7 +787,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceSelectBinary( UR_FUNCTION_DEVICE_SELECT_BINARY, "urDeviceSelectBinary", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urDeviceSelectBinary\n"); + UR_LOG_L(logger, INFO, " ---> urDeviceSelectBinary\n"); ur_result_t result = pfnSelectBinary(hDevice, pBinaries, NumBinaries, pSelectedBinary); @@ -790,8 +799,8 @@ __urdlllocal ur_result_t UR_APICALL urDeviceSelectBinary( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_DEVICE_SELECT_BINARY, ¶ms); - logger.info(" <--- urDeviceSelectBinary({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urDeviceSelectBinary({}) -> {};\n", + args_str.str(), result); } return result; @@ -814,7 +823,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetNativeHandle( UR_FUNCTION_DEVICE_GET_NATIVE_HANDLE, "urDeviceGetNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urDeviceGetNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urDeviceGetNativeHandle\n"); ur_result_t result = pfnGetNativeHandle(hDevice, phNativeDevice); @@ -826,8 +835,8 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_DEVICE_GET_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urDeviceGetNativeHandle({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urDeviceGetNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -857,7 +866,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceCreateWithNativeHandle( "urDeviceCreateWithNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urDeviceCreateWithNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urDeviceCreateWithNativeHandle\n"); ur_result_t result = pfnCreateWithNativeHandle(hNativeDevice, hAdapter, pProperties, phDevice); @@ -870,8 +879,9 @@ __urdlllocal ur_result_t UR_APICALL urDeviceCreateWithNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_DEVICE_CREATE_WITH_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urDeviceCreateWithNativeHandle({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urDeviceCreateWithNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -901,7 +911,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetGlobalTimestamps( "urDeviceGetGlobalTimestamps", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urDeviceGetGlobalTimestamps\n"); + UR_LOG_L(logger, INFO, " ---> urDeviceGetGlobalTimestamps\n"); ur_result_t result = pfnGetGlobalTimestamps(hDevice, pDeviceTimestamp, pHostTimestamp); @@ -914,8 +924,8 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetGlobalTimestamps( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_DEVICE_GET_GLOBAL_TIMESTAMPS, ¶ms); - logger.info(" <--- urDeviceGetGlobalTimestamps({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urDeviceGetGlobalTimestamps({}) -> {};\n", + args_str.str(), result); } return result; @@ -943,7 +953,7 @@ __urdlllocal ur_result_t UR_APICALL urContextCreate( "urContextCreate", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urContextCreate\n"); + UR_LOG_L(logger, INFO, " ---> urContextCreate\n"); ur_result_t result = pfnCreate(DeviceCount, phDevices, pProperties, phContext); @@ -955,7 +965,8 @@ __urdlllocal ur_result_t UR_APICALL urContextCreate( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_CREATE, ¶ms); - logger.info(" <--- urContextCreate({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urContextCreate({}) -> {};\n", + args_str.str(), result); } return result; @@ -976,7 +987,7 @@ __urdlllocal ur_result_t UR_APICALL urContextRetain( "urContextRetain", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urContextRetain\n"); + UR_LOG_L(logger, INFO, " ---> urContextRetain\n"); ur_result_t result = pfnRetain(hContext); @@ -987,7 +998,8 @@ __urdlllocal ur_result_t UR_APICALL urContextRetain( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_RETAIN, ¶ms); - logger.info(" <--- urContextRetain({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urContextRetain({}) -> {};\n", + args_str.str(), result); } return result; @@ -1008,7 +1020,7 @@ __urdlllocal ur_result_t UR_APICALL urContextRelease( "urContextRelease", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urContextRelease\n"); + UR_LOG_L(logger, INFO, " ---> urContextRelease\n"); ur_result_t result = pfnRelease(hContext); @@ -1019,8 +1031,8 @@ __urdlllocal ur_result_t UR_APICALL urContextRelease( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_RELEASE, ¶ms); - logger.info(" <--- urContextRelease({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urContextRelease({}) -> {};\n", + args_str.str(), result); } return result; @@ -1056,7 +1068,7 @@ __urdlllocal ur_result_t UR_APICALL urContextGetInfo( "urContextGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urContextGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urContextGetInfo\n"); ur_result_t result = pfnGetInfo(hContext, propName, propSize, pPropValue, pPropSizeRet); @@ -1068,8 +1080,8 @@ __urdlllocal ur_result_t UR_APICALL urContextGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_CONTEXT_GET_INFO, ¶ms); - logger.info(" <--- urContextGetInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urContextGetInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -1093,7 +1105,7 @@ __urdlllocal ur_result_t UR_APICALL urContextGetNativeHandle( "urContextGetNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urContextGetNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urContextGetNativeHandle\n"); ur_result_t result = pfnGetNativeHandle(hContext, phNativeContext); @@ -1105,8 +1117,8 @@ __urdlllocal ur_result_t UR_APICALL urContextGetNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_CONTEXT_GET_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urContextGetNativeHandle({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urContextGetNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -1142,7 +1154,7 @@ __urdlllocal ur_result_t UR_APICALL urContextCreateWithNativeHandle( "urContextCreateWithNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urContextCreateWithNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urContextCreateWithNativeHandle\n"); ur_result_t result = pfnCreateWithNativeHandle( hNativeContext, hAdapter, numDevices, phDevices, pProperties, phContext); @@ -1155,8 +1167,9 @@ __urdlllocal ur_result_t UR_APICALL urContextCreateWithNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_CONTEXT_CREATE_WITH_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urContextCreateWithNativeHandle({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urContextCreateWithNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -1184,7 +1197,7 @@ __urdlllocal ur_result_t UR_APICALL urContextSetExtendedDeleter( "urContextSetExtendedDeleter", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urContextSetExtendedDeleter\n"); + UR_LOG_L(logger, INFO, " ---> urContextSetExtendedDeleter\n"); ur_result_t result = pfnSetExtendedDeleter(hContext, pfnDeleter, pUserData); @@ -1196,8 +1209,8 @@ __urdlllocal ur_result_t UR_APICALL urContextSetExtendedDeleter( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_CONTEXT_SET_EXTENDED_DELETER, ¶ms); - logger.info(" <--- urContextSetExtendedDeleter({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urContextSetExtendedDeleter({}) -> {};\n", + args_str.str(), result); } return result; @@ -1229,7 +1242,7 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreate( "urMemImageCreate", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urMemImageCreate\n"); + UR_LOG_L(logger, INFO, " ---> urMemImageCreate\n"); ur_result_t result = pfnImageCreate(hContext, flags, pImageFormat, pImageDesc, pHost, phMem); @@ -1241,8 +1254,8 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreate( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_IMAGE_CREATE, ¶ms); - logger.info(" <--- urMemImageCreate({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urMemImageCreate({}) -> {};\n", + args_str.str(), result); } return result; @@ -1272,7 +1285,7 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreate( "urMemBufferCreate", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urMemBufferCreate\n"); + UR_LOG_L(logger, INFO, " ---> urMemBufferCreate\n"); ur_result_t result = pfnBufferCreate(hContext, flags, size, pProperties, phBuffer); @@ -1284,8 +1297,8 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreate( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_BUFFER_CREATE, ¶ms); - logger.info(" <--- urMemBufferCreate({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urMemBufferCreate({}) -> {};\n", + args_str.str(), result); } return result; @@ -1306,7 +1319,7 @@ __urdlllocal ur_result_t UR_APICALL urMemRetain( "urMemRetain", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urMemRetain\n"); + UR_LOG_L(logger, INFO, " ---> urMemRetain\n"); ur_result_t result = pfnRetain(hMem); @@ -1316,7 +1329,8 @@ __urdlllocal ur_result_t UR_APICALL urMemRetain( if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_RETAIN, ¶ms); - logger.info(" <--- urMemRetain({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urMemRetain({}) -> {};\n", args_str.str(), + result); } return result; @@ -1337,7 +1351,7 @@ __urdlllocal ur_result_t UR_APICALL urMemRelease( "urMemRelease", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urMemRelease\n"); + UR_LOG_L(logger, INFO, " ---> urMemRelease\n"); ur_result_t result = pfnRelease(hMem); @@ -1347,7 +1361,8 @@ __urdlllocal ur_result_t UR_APICALL urMemRelease( if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_RELEASE, ¶ms); - logger.info(" <--- urMemRelease({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urMemRelease({}) -> {};\n", args_str.str(), + result); } return result; @@ -1377,7 +1392,7 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferPartition( UR_FUNCTION_MEM_BUFFER_PARTITION, "urMemBufferPartition", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urMemBufferPartition\n"); + UR_LOG_L(logger, INFO, " ---> urMemBufferPartition\n"); ur_result_t result = pfnBufferPartition(hBuffer, flags, bufferCreateType, pRegion, phMem); @@ -1389,8 +1404,8 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferPartition( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_BUFFER_PARTITION, ¶ms); - logger.info(" <--- urMemBufferPartition({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urMemBufferPartition({}) -> {};\n", + args_str.str(), result); } return result; @@ -1416,7 +1431,7 @@ __urdlllocal ur_result_t UR_APICALL urMemGetNativeHandle( UR_FUNCTION_MEM_GET_NATIVE_HANDLE, "urMemGetNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urMemGetNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urMemGetNativeHandle\n"); ur_result_t result = pfnGetNativeHandle(hMem, hDevice, phNativeMem); @@ -1427,8 +1442,8 @@ __urdlllocal ur_result_t UR_APICALL urMemGetNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_GET_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urMemGetNativeHandle({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urMemGetNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -1458,7 +1473,7 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreateWithNativeHandle( "urMemBufferCreateWithNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urMemBufferCreateWithNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urMemBufferCreateWithNativeHandle\n"); ur_result_t result = pfnBufferCreateWithNativeHandle(hNativeMem, hContext, pProperties, phMem); @@ -1471,8 +1486,9 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreateWithNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_MEM_BUFFER_CREATE_WITH_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urMemBufferCreateWithNativeHandle({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urMemBufferCreateWithNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -1506,7 +1522,7 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreateWithNativeHandle( "urMemImageCreateWithNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urMemImageCreateWithNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urMemImageCreateWithNativeHandle\n"); ur_result_t result = pfnImageCreateWithNativeHandle( hNativeMem, hContext, pImageFormat, pImageDesc, pProperties, phMem); @@ -1519,8 +1535,9 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreateWithNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_MEM_IMAGE_CREATE_WITH_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urMemImageCreateWithNativeHandle({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urMemImageCreateWithNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -1555,7 +1572,7 @@ __urdlllocal ur_result_t UR_APICALL urMemGetInfo( "urMemGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urMemGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urMemGetInfo\n"); ur_result_t result = pfnGetInfo(hMemory, propName, propSize, pPropValue, pPropSizeRet); @@ -1567,7 +1584,8 @@ __urdlllocal ur_result_t UR_APICALL urMemGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_GET_INFO, ¶ms); - logger.info(" <--- urMemGetInfo({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urMemGetInfo({}) -> {};\n", args_str.str(), + result); } return result; @@ -1602,7 +1620,7 @@ __urdlllocal ur_result_t UR_APICALL urMemImageGetInfo( "urMemImageGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urMemImageGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urMemImageGetInfo\n"); ur_result_t result = pfnImageGetInfo(hMemory, propName, propSize, pPropValue, pPropSizeRet); @@ -1614,8 +1632,8 @@ __urdlllocal ur_result_t UR_APICALL urMemImageGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_MEM_IMAGE_GET_INFO, ¶ms); - logger.info(" <--- urMemImageGetInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urMemImageGetInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -1640,7 +1658,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerCreate( "urSamplerCreate", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urSamplerCreate\n"); + UR_LOG_L(logger, INFO, " ---> urSamplerCreate\n"); ur_result_t result = pfnCreate(hContext, pDesc, phSampler); @@ -1651,7 +1669,8 @@ __urdlllocal ur_result_t UR_APICALL urSamplerCreate( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_CREATE, ¶ms); - logger.info(" <--- urSamplerCreate({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urSamplerCreate({}) -> {};\n", + args_str.str(), result); } return result; @@ -1672,7 +1691,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRetain( "urSamplerRetain", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urSamplerRetain\n"); + UR_LOG_L(logger, INFO, " ---> urSamplerRetain\n"); ur_result_t result = pfnRetain(hSampler); @@ -1683,7 +1702,8 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRetain( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_RETAIN, ¶ms); - logger.info(" <--- urSamplerRetain({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urSamplerRetain({}) -> {};\n", + args_str.str(), result); } return result; @@ -1704,7 +1724,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRelease( "urSamplerRelease", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urSamplerRelease\n"); + UR_LOG_L(logger, INFO, " ---> urSamplerRelease\n"); ur_result_t result = pfnRelease(hSampler); @@ -1715,8 +1735,8 @@ __urdlllocal ur_result_t UR_APICALL urSamplerRelease( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_RELEASE, ¶ms); - logger.info(" <--- urSamplerRelease({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urSamplerRelease({}) -> {};\n", + args_str.str(), result); } return result; @@ -1747,7 +1767,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerGetInfo( "urSamplerGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urSamplerGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urSamplerGetInfo\n"); ur_result_t result = pfnGetInfo(hSampler, propName, propSize, pPropValue, pPropSizeRet); @@ -1759,8 +1779,8 @@ __urdlllocal ur_result_t UR_APICALL urSamplerGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_SAMPLER_GET_INFO, ¶ms); - logger.info(" <--- urSamplerGetInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urSamplerGetInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -1784,7 +1804,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerGetNativeHandle( "urSamplerGetNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urSamplerGetNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urSamplerGetNativeHandle\n"); ur_result_t result = pfnGetNativeHandle(hSampler, phNativeSampler); @@ -1796,8 +1816,8 @@ __urdlllocal ur_result_t UR_APICALL urSamplerGetNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_SAMPLER_GET_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urSamplerGetNativeHandle({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urSamplerGetNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -1827,7 +1847,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerCreateWithNativeHandle( "urSamplerCreateWithNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urSamplerCreateWithNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urSamplerCreateWithNativeHandle\n"); ur_result_t result = pfnCreateWithNativeHandle(hNativeSampler, hContext, pProperties, phSampler); @@ -1840,8 +1860,9 @@ __urdlllocal ur_result_t UR_APICALL urSamplerCreateWithNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_SAMPLER_CREATE_WITH_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urSamplerCreateWithNativeHandle({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urSamplerCreateWithNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -1871,7 +1892,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMHostAlloc( "urUSMHostAlloc", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMHostAlloc\n"); + UR_LOG_L(logger, INFO, " ---> urUSMHostAlloc\n"); ur_result_t result = pfnHostAlloc(hContext, pUSMDesc, pool, size, ppMem); @@ -1882,7 +1903,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMHostAlloc( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_HOST_ALLOC, ¶ms); - logger.info(" <--- urUSMHostAlloc({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urUSMHostAlloc({}) -> {};\n", + args_str.str(), result); } return result; @@ -1914,7 +1936,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMDeviceAlloc( "urUSMDeviceAlloc", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMDeviceAlloc\n"); + UR_LOG_L(logger, INFO, " ---> urUSMDeviceAlloc\n"); ur_result_t result = pfnDeviceAlloc(hContext, hDevice, pUSMDesc, pool, size, ppMem); @@ -1926,8 +1948,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMDeviceAlloc( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_DEVICE_ALLOC, ¶ms); - logger.info(" <--- urUSMDeviceAlloc({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urUSMDeviceAlloc({}) -> {};\n", + args_str.str(), result); } return result; @@ -1959,7 +1981,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMSharedAlloc( "urUSMSharedAlloc", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMSharedAlloc\n"); + UR_LOG_L(logger, INFO, " ---> urUSMSharedAlloc\n"); ur_result_t result = pfnSharedAlloc(hContext, hDevice, pUSMDesc, pool, size, ppMem); @@ -1971,8 +1993,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMSharedAlloc( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_SHARED_ALLOC, ¶ms); - logger.info(" <--- urUSMSharedAlloc({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urUSMSharedAlloc({}) -> {};\n", + args_str.str(), result); } return result; @@ -1995,7 +2017,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMFree( getContext()->notify_begin(UR_FUNCTION_USM_FREE, "urUSMFree", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMFree\n"); + UR_LOG_L(logger, INFO, " ---> urUSMFree\n"); ur_result_t result = pfnFree(hContext, pMem); @@ -2005,7 +2027,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMFree( if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_FREE, ¶ms); - logger.info(" <--- urUSMFree({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urUSMFree({}) -> {};\n", args_str.str(), + result); } return result; @@ -2038,7 +2061,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMGetMemAllocInfo( UR_FUNCTION_USM_GET_MEM_ALLOC_INFO, "urUSMGetMemAllocInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMGetMemAllocInfo\n"); + UR_LOG_L(logger, INFO, " ---> urUSMGetMemAllocInfo\n"); ur_result_t result = pfnGetMemAllocInfo(hContext, pMem, propName, propSize, pPropValue, pPropSizeRet); @@ -2050,8 +2073,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMGetMemAllocInfo( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_USM_GET_MEM_ALLOC_INFO, ¶ms); - logger.info(" <--- urUSMGetMemAllocInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urUSMGetMemAllocInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -2077,7 +2100,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolCreate( "urUSMPoolCreate", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMPoolCreate\n"); + UR_LOG_L(logger, INFO, " ---> urUSMPoolCreate\n"); ur_result_t result = pfnPoolCreate(hContext, pPoolDesc, ppPool); @@ -2088,7 +2111,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolCreate( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_CREATE, ¶ms); - logger.info(" <--- urUSMPoolCreate({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urUSMPoolCreate({}) -> {};\n", + args_str.str(), result); } return result; @@ -2109,7 +2133,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRetain( "urUSMPoolRetain", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMPoolRetain\n"); + UR_LOG_L(logger, INFO, " ---> urUSMPoolRetain\n"); ur_result_t result = pfnPoolRetain(pPool); @@ -2120,7 +2144,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRetain( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_RETAIN, ¶ms); - logger.info(" <--- urUSMPoolRetain({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urUSMPoolRetain({}) -> {};\n", + args_str.str(), result); } return result; @@ -2141,7 +2166,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRelease( "urUSMPoolRelease", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMPoolRelease\n"); + UR_LOG_L(logger, INFO, " ---> urUSMPoolRelease\n"); ur_result_t result = pfnPoolRelease(pPool); @@ -2152,8 +2177,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolRelease( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_RELEASE, ¶ms); - logger.info(" <--- urUSMPoolRelease({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urUSMPoolRelease({}) -> {};\n", + args_str.str(), result); } return result; @@ -2184,7 +2209,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetInfo( "urUSMPoolGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMPoolGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urUSMPoolGetInfo\n"); ur_result_t result = pfnPoolGetInfo(hPool, propName, propSize, pPropValue, pPropSizeRet); @@ -2196,8 +2221,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_GET_INFO, ¶ms); - logger.info(" <--- urUSMPoolGetInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urUSMPoolGetInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -2237,7 +2262,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemGranularityGetInfo( "urVirtualMemGranularityGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urVirtualMemGranularityGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urVirtualMemGranularityGetInfo\n"); ur_result_t result = pfnGranularityGetInfo( hContext, hDevice, propName, propSize, pPropValue, pPropSizeRet); @@ -2250,8 +2275,9 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemGranularityGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_VIRTUAL_MEM_GRANULARITY_GET_INFO, ¶ms); - logger.info(" <--- urVirtualMemGranularityGetInfo({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urVirtualMemGranularityGetInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -2282,7 +2308,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemReserve( UR_FUNCTION_VIRTUAL_MEM_RESERVE, "urVirtualMemReserve", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urVirtualMemReserve\n"); + UR_LOG_L(logger, INFO, " ---> urVirtualMemReserve\n"); ur_result_t result = pfnReserve(hContext, pStart, size, ppStart); @@ -2293,8 +2319,8 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemReserve( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_RESERVE, ¶ms); - logger.info(" <--- urVirtualMemReserve({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urVirtualMemReserve({}) -> {};\n", + args_str.str(), result); } return result; @@ -2319,7 +2345,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemFree( "urVirtualMemFree", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urVirtualMemFree\n"); + UR_LOG_L(logger, INFO, " ---> urVirtualMemFree\n"); ur_result_t result = pfnFree(hContext, pStart, size); @@ -2330,8 +2356,8 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemFree( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_FREE, ¶ms); - logger.info(" <--- urVirtualMemFree({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urVirtualMemFree({}) -> {};\n", + args_str.str(), result); } return result; @@ -2363,7 +2389,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemMap( "urVirtualMemMap", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urVirtualMemMap\n"); + UR_LOG_L(logger, INFO, " ---> urVirtualMemMap\n"); ur_result_t result = pfnMap(hContext, pStart, size, hPhysicalMem, offset, flags); @@ -2375,7 +2401,8 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemMap( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_MAP, ¶ms); - logger.info(" <--- urVirtualMemMap({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urVirtualMemMap({}) -> {};\n", + args_str.str(), result); } return result; @@ -2400,7 +2427,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemUnmap( "urVirtualMemUnmap", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urVirtualMemUnmap\n"); + UR_LOG_L(logger, INFO, " ---> urVirtualMemUnmap\n"); ur_result_t result = pfnUnmap(hContext, pStart, size); @@ -2411,8 +2438,8 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemUnmap( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_UNMAP, ¶ms); - logger.info(" <--- urVirtualMemUnmap({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urVirtualMemUnmap({}) -> {};\n", + args_str.str(), result); } return result; @@ -2440,7 +2467,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemSetAccess( UR_FUNCTION_VIRTUAL_MEM_SET_ACCESS, "urVirtualMemSetAccess", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urVirtualMemSetAccess\n"); + UR_LOG_L(logger, INFO, " ---> urVirtualMemSetAccess\n"); ur_result_t result = pfnSetAccess(hContext, pStart, size, flags); @@ -2451,8 +2478,8 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemSetAccess( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_VIRTUAL_MEM_SET_ACCESS, ¶ms); - logger.info(" <--- urVirtualMemSetAccess({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urVirtualMemSetAccess({}) -> {};\n", + args_str.str(), result); } return result; @@ -2491,7 +2518,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemGetInfo( UR_FUNCTION_VIRTUAL_MEM_GET_INFO, "urVirtualMemGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urVirtualMemGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urVirtualMemGetInfo\n"); ur_result_t result = pfnGetInfo(hContext, pStart, size, propName, propSize, pPropValue, pPropSizeRet); @@ -2503,8 +2530,8 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_VIRTUAL_MEM_GET_INFO, ¶ms); - logger.info(" <--- urVirtualMemGetInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urVirtualMemGetInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -2535,7 +2562,7 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemCreate( UR_FUNCTION_PHYSICAL_MEM_CREATE, "urPhysicalMemCreate", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urPhysicalMemCreate\n"); + UR_LOG_L(logger, INFO, " ---> urPhysicalMemCreate\n"); ur_result_t result = pfnCreate(hContext, hDevice, size, pProperties, phPhysicalMem); @@ -2547,8 +2574,8 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemCreate( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PHYSICAL_MEM_CREATE, ¶ms); - logger.info(" <--- urPhysicalMemCreate({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urPhysicalMemCreate({}) -> {};\n", + args_str.str(), result); } return result; @@ -2569,7 +2596,7 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRetain( UR_FUNCTION_PHYSICAL_MEM_RETAIN, "urPhysicalMemRetain", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urPhysicalMemRetain\n"); + UR_LOG_L(logger, INFO, " ---> urPhysicalMemRetain\n"); ur_result_t result = pfnRetain(hPhysicalMem); @@ -2580,8 +2607,8 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRetain( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PHYSICAL_MEM_RETAIN, ¶ms); - logger.info(" <--- urPhysicalMemRetain({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urPhysicalMemRetain({}) -> {};\n", + args_str.str(), result); } return result; @@ -2602,7 +2629,7 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRelease( UR_FUNCTION_PHYSICAL_MEM_RELEASE, "urPhysicalMemRelease", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urPhysicalMemRelease\n"); + UR_LOG_L(logger, INFO, " ---> urPhysicalMemRelease\n"); ur_result_t result = pfnRelease(hPhysicalMem); @@ -2613,8 +2640,8 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemRelease( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PHYSICAL_MEM_RELEASE, ¶ms); - logger.info(" <--- urPhysicalMemRelease({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urPhysicalMemRelease({}) -> {};\n", + args_str.str(), result); } return result; @@ -2648,7 +2675,7 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemGetInfo( UR_FUNCTION_PHYSICAL_MEM_GET_INFO, "urPhysicalMemGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urPhysicalMemGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urPhysicalMemGetInfo\n"); ur_result_t result = pfnGetInfo(hPhysicalMem, propName, propSize, pPropValue, pPropSizeRet); @@ -2660,8 +2687,8 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PHYSICAL_MEM_GET_INFO, ¶ms); - logger.info(" <--- urPhysicalMemGetInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urPhysicalMemGetInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -2691,7 +2718,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL( UR_FUNCTION_PROGRAM_CREATE_WITH_IL, "urProgramCreateWithIL", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramCreateWithIL\n"); + UR_LOG_L(logger, INFO, " ---> urProgramCreateWithIL\n"); ur_result_t result = pfnCreateWithIL(hContext, pIL, length, pProperties, phProgram); @@ -2703,8 +2730,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_CREATE_WITH_IL, ¶ms); - logger.info(" <--- urProgramCreateWithIL({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urProgramCreateWithIL({}) -> {};\n", + args_str.str(), result); } return result; @@ -2744,7 +2771,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary( "urProgramCreateWithBinary", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramCreateWithBinary\n"); + UR_LOG_L(logger, INFO, " ---> urProgramCreateWithBinary\n"); ur_result_t result = pfnCreateWithBinary(hContext, numDevices, phDevices, pLengths, ppBinaries, @@ -2758,8 +2785,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY, ¶ms); - logger.info(" <--- urProgramCreateWithBinary({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urProgramCreateWithBinary({}) -> {};\n", + args_str.str(), result); } return result; @@ -2784,7 +2811,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuild( "urProgramBuild", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramBuild\n"); + UR_LOG_L(logger, INFO, " ---> urProgramBuild\n"); ur_result_t result = pfnBuild(hContext, hProgram, pOptions); @@ -2795,7 +2822,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuild( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_BUILD, ¶ms); - logger.info(" <--- urProgramBuild({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urProgramBuild({}) -> {};\n", + args_str.str(), result); } return result; @@ -2820,7 +2848,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCompile( "urProgramCompile", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramCompile\n"); + UR_LOG_L(logger, INFO, " ---> urProgramCompile\n"); ur_result_t result = pfnCompile(hContext, hProgram, pOptions); @@ -2831,8 +2859,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramCompile( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_COMPILE, ¶ms); - logger.info(" <--- urProgramCompile({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urProgramCompile({}) -> {};\n", + args_str.str(), result); } return result; @@ -2865,7 +2893,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramLink( "urProgramLink", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramLink\n"); + UR_LOG_L(logger, INFO, " ---> urProgramLink\n"); ur_result_t result = pfnLink(hContext, count, phPrograms, pOptions, phProgram); @@ -2877,7 +2905,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramLink( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_LINK, ¶ms); - logger.info(" <--- urProgramLink({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urProgramLink({}) -> {};\n", args_str.str(), + result); } return result; @@ -2898,7 +2927,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramRetain( "urProgramRetain", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramRetain\n"); + UR_LOG_L(logger, INFO, " ---> urProgramRetain\n"); ur_result_t result = pfnRetain(hProgram); @@ -2909,7 +2938,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramRetain( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_RETAIN, ¶ms); - logger.info(" <--- urProgramRetain({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urProgramRetain({}) -> {};\n", + args_str.str(), result); } return result; @@ -2930,7 +2960,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramRelease( "urProgramRelease", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramRelease\n"); + UR_LOG_L(logger, INFO, " ---> urProgramRelease\n"); ur_result_t result = pfnRelease(hProgram); @@ -2941,8 +2971,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramRelease( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_RELEASE, ¶ms); - logger.info(" <--- urProgramRelease({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urProgramRelease({}) -> {};\n", + args_str.str(), result); } return result; @@ -2974,7 +3004,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetFunctionPointer( "urProgramGetFunctionPointer", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramGetFunctionPointer\n"); + UR_LOG_L(logger, INFO, " ---> urProgramGetFunctionPointer\n"); ur_result_t result = pfnGetFunctionPointer(hDevice, hProgram, pFunctionName, ppFunctionPointer); @@ -2987,8 +3017,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetFunctionPointer( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_GET_FUNCTION_POINTER, ¶ms); - logger.info(" <--- urProgramGetFunctionPointer({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urProgramGetFunctionPointer({}) -> {};\n", + args_str.str(), result); } return result; @@ -3023,7 +3053,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetGlobalVariablePointer( "urProgramGetGlobalVariablePointer", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramGetGlobalVariablePointer\n"); + UR_LOG_L(logger, INFO, " ---> urProgramGetGlobalVariablePointer\n"); ur_result_t result = pfnGetGlobalVariablePointer( hDevice, hProgram, pGlobalVariableName, pGlobalVariableSizeRet, @@ -3037,8 +3067,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetGlobalVariablePointer( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_GET_GLOBAL_VARIABLE_POINTER, ¶ms); - logger.info(" <--- urProgramGetGlobalVariablePointer({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urProgramGetGlobalVariablePointer({}) -> {};\n", + args_str.str(), result); } return result; @@ -3074,7 +3105,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetInfo( "urProgramGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urProgramGetInfo\n"); ur_result_t result = pfnGetInfo(hProgram, propName, propSize, pPropValue, pPropSizeRet); @@ -3086,8 +3117,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_GET_INFO, ¶ms); - logger.info(" <--- urProgramGetInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urProgramGetInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -3124,7 +3155,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetBuildInfo( UR_FUNCTION_PROGRAM_GET_BUILD_INFO, "urProgramGetBuildInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramGetBuildInfo\n"); + UR_LOG_L(logger, INFO, " ---> urProgramGetBuildInfo\n"); ur_result_t result = pfnGetBuildInfo(hProgram, hDevice, propName, propSize, pPropValue, pPropSizeRet); @@ -3136,8 +3167,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetBuildInfo( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_GET_BUILD_INFO, ¶ms); - logger.info(" <--- urProgramGetBuildInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urProgramGetBuildInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -3166,7 +3197,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramSetSpecializationConstants( "urProgramSetSpecializationConstants", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramSetSpecializationConstants\n"); + UR_LOG_L(logger, INFO, " ---> urProgramSetSpecializationConstants\n"); ur_result_t result = pfnSetSpecializationConstants(hProgram, count, pSpecConstants); @@ -3179,8 +3210,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramSetSpecializationConstants( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_SET_SPECIALIZATION_CONSTANTS, ¶ms); - logger.info(" <--- urProgramSetSpecializationConstants({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urProgramSetSpecializationConstants({}) -> {};\n", + args_str.str(), result); } return result; @@ -3204,7 +3236,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetNativeHandle( "urProgramGetNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramGetNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urProgramGetNativeHandle\n"); ur_result_t result = pfnGetNativeHandle(hProgram, phNativeProgram); @@ -3216,8 +3248,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_GET_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urProgramGetNativeHandle({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urProgramGetNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -3247,7 +3279,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithNativeHandle( "urProgramCreateWithNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramCreateWithNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urProgramCreateWithNativeHandle\n"); ur_result_t result = pfnCreateWithNativeHandle(hNativeProgram, hContext, pProperties, phProgram); @@ -3260,8 +3292,9 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_PROGRAM_CREATE_WITH_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urProgramCreateWithNativeHandle({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urProgramCreateWithNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -3286,7 +3319,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreate( "urKernelCreate", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelCreate\n"); + UR_LOG_L(logger, INFO, " ---> urKernelCreate\n"); ur_result_t result = pfnCreate(hProgram, pKernelName, phKernel); @@ -3297,7 +3330,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreate( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_CREATE, ¶ms); - logger.info(" <--- urKernelCreate({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urKernelCreate({}) -> {};\n", + args_str.str(), result); } return result; @@ -3329,7 +3363,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgValue( UR_FUNCTION_KERNEL_SET_ARG_VALUE, "urKernelSetArgValue", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelSetArgValue\n"); + UR_LOG_L(logger, INFO, " ---> urKernelSetArgValue\n"); ur_result_t result = pfnSetArgValue(hKernel, argIndex, argSize, pProperties, pArgValue); @@ -3341,8 +3375,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgValue( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_SET_ARG_VALUE, ¶ms); - logger.info(" <--- urKernelSetArgValue({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urKernelSetArgValue({}) -> {};\n", + args_str.str(), result); } return result; @@ -3370,7 +3404,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgLocal( UR_FUNCTION_KERNEL_SET_ARG_LOCAL, "urKernelSetArgLocal", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelSetArgLocal\n"); + UR_LOG_L(logger, INFO, " ---> urKernelSetArgLocal\n"); ur_result_t result = pfnSetArgLocal(hKernel, argIndex, argSize, pProperties); @@ -3381,8 +3415,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgLocal( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_SET_ARG_LOCAL, ¶ms); - logger.info(" <--- urKernelSetArgLocal({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urKernelSetArgLocal({}) -> {};\n", + args_str.str(), result); } return result; @@ -3418,7 +3452,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetInfo( "urKernelGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urKernelGetInfo\n"); ur_result_t result = pfnGetInfo(hKernel, propName, propSize, pPropValue, pPropSizeRet); @@ -3430,7 +3464,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_GET_INFO, ¶ms); - logger.info(" <--- urKernelGetInfo({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urKernelGetInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -3464,7 +3499,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetGroupInfo( UR_FUNCTION_KERNEL_GET_GROUP_INFO, "urKernelGetGroupInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelGetGroupInfo\n"); + UR_LOG_L(logger, INFO, " ---> urKernelGetGroupInfo\n"); ur_result_t result = pfnGetGroupInfo(hKernel, hDevice, propName, propSize, pPropValue, pPropSizeRet); @@ -3476,8 +3511,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetGroupInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_GET_GROUP_INFO, ¶ms); - logger.info(" <--- urKernelGetGroupInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urKernelGetGroupInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -3512,7 +3547,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetSubGroupInfo( "urKernelGetSubGroupInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelGetSubGroupInfo\n"); + UR_LOG_L(logger, INFO, " ---> urKernelGetSubGroupInfo\n"); ur_result_t result = pfnGetSubGroupInfo(hKernel, hDevice, propName, propSize, pPropValue, pPropSizeRet); @@ -3525,8 +3560,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetSubGroupInfo( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_GET_SUB_GROUP_INFO, ¶ms); - logger.info(" <--- urKernelGetSubGroupInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urKernelGetSubGroupInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -3547,7 +3582,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelRetain( "urKernelRetain", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelRetain\n"); + UR_LOG_L(logger, INFO, " ---> urKernelRetain\n"); ur_result_t result = pfnRetain(hKernel); @@ -3558,7 +3593,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelRetain( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_RETAIN, ¶ms); - logger.info(" <--- urKernelRetain({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urKernelRetain({}) -> {};\n", + args_str.str(), result); } return result; @@ -3579,7 +3615,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelRelease( "urKernelRelease", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelRelease\n"); + UR_LOG_L(logger, INFO, " ---> urKernelRelease\n"); ur_result_t result = pfnRelease(hKernel); @@ -3590,7 +3626,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelRelease( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_RELEASE, ¶ms); - logger.info(" <--- urKernelRelease({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urKernelRelease({}) -> {};\n", + args_str.str(), result); } return result; @@ -3619,7 +3656,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgPointer( UR_FUNCTION_KERNEL_SET_ARG_POINTER, "urKernelSetArgPointer", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelSetArgPointer\n"); + UR_LOG_L(logger, INFO, " ---> urKernelSetArgPointer\n"); ur_result_t result = pfnSetArgPointer(hKernel, argIndex, pProperties, pArgValue); @@ -3631,8 +3668,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgPointer( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_SET_ARG_POINTER, ¶ms); - logger.info(" <--- urKernelSetArgPointer({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urKernelSetArgPointer({}) -> {};\n", + args_str.str(), result); } return result; @@ -3663,7 +3700,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetExecInfo( UR_FUNCTION_KERNEL_SET_EXEC_INFO, "urKernelSetExecInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelSetExecInfo\n"); + UR_LOG_L(logger, INFO, " ---> urKernelSetExecInfo\n"); ur_result_t result = pfnSetExecInfo(hKernel, propName, propSize, pProperties, pPropValue); @@ -3675,8 +3712,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetExecInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_KERNEL_SET_EXEC_INFO, ¶ms); - logger.info(" <--- urKernelSetExecInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urKernelSetExecInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -3704,7 +3741,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgSampler( UR_FUNCTION_KERNEL_SET_ARG_SAMPLER, "urKernelSetArgSampler", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelSetArgSampler\n"); + UR_LOG_L(logger, INFO, " ---> urKernelSetArgSampler\n"); ur_result_t result = pfnSetArgSampler(hKernel, argIndex, pProperties, hArgValue); @@ -3716,8 +3753,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgSampler( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_SET_ARG_SAMPLER, ¶ms); - logger.info(" <--- urKernelSetArgSampler({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urKernelSetArgSampler({}) -> {};\n", + args_str.str(), result); } return result; @@ -3745,7 +3782,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgMemObj( UR_FUNCTION_KERNEL_SET_ARG_MEM_OBJ, "urKernelSetArgMemObj", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelSetArgMemObj\n"); + UR_LOG_L(logger, INFO, " ---> urKernelSetArgMemObj\n"); ur_result_t result = pfnSetArgMemObj(hKernel, argIndex, pProperties, hArgValue); @@ -3757,8 +3794,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgMemObj( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_SET_ARG_MEM_OBJ, ¶ms); - logger.info(" <--- urKernelSetArgMemObj({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urKernelSetArgMemObj({}) -> {};\n", + args_str.str(), result); } return result; @@ -3786,7 +3823,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetSpecializationConstants( "urKernelSetSpecializationConstants", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelSetSpecializationConstants\n"); + UR_LOG_L(logger, INFO, " ---> urKernelSetSpecializationConstants\n"); ur_result_t result = pfnSetSpecializationConstants(hKernel, count, pSpecConstants); @@ -3799,8 +3836,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetSpecializationConstants( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_SET_SPECIALIZATION_CONSTANTS, ¶ms); - logger.info(" <--- urKernelSetSpecializationConstants({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urKernelSetSpecializationConstants({}) -> {};\n", + args_str.str(), result); } return result; @@ -3823,7 +3861,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetNativeHandle( UR_FUNCTION_KERNEL_GET_NATIVE_HANDLE, "urKernelGetNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelGetNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urKernelGetNativeHandle\n"); ur_result_t result = pfnGetNativeHandle(hKernel, phNativeKernel); @@ -3835,8 +3873,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_GET_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urKernelGetNativeHandle({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urKernelGetNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -3868,7 +3906,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreateWithNativeHandle( "urKernelCreateWithNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelCreateWithNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urKernelCreateWithNativeHandle\n"); ur_result_t result = pfnCreateWithNativeHandle( hNativeKernel, hContext, hProgram, pProperties, phKernel); @@ -3881,8 +3919,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreateWithNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_CREATE_WITH_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urKernelCreateWithNativeHandle({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urKernelCreateWithNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -3922,7 +3961,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetSuggestedLocalWorkSize( "urKernelGetSuggestedLocalWorkSize", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelGetSuggestedLocalWorkSize\n"); + UR_LOG_L(logger, INFO, " ---> urKernelGetSuggestedLocalWorkSize\n"); ur_result_t result = pfnGetSuggestedLocalWorkSize( hKernel, hQueue, numWorkDim, pGlobalWorkOffset, pGlobalWorkSize, @@ -3936,8 +3975,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetSuggestedLocalWorkSize( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE, ¶ms); - logger.info(" <--- urKernelGetSuggestedLocalWorkSize({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urKernelGetSuggestedLocalWorkSize({}) -> {};\n", + args_str.str(), result); } return result; @@ -3968,7 +4008,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueGetInfo( "urQueueGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urQueueGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urQueueGetInfo\n"); ur_result_t result = pfnGetInfo(hQueue, propName, propSize, pPropValue, pPropSizeRet); @@ -3980,7 +4020,8 @@ __urdlllocal ur_result_t UR_APICALL urQueueGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_GET_INFO, ¶ms); - logger.info(" <--- urQueueGetInfo({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urQueueGetInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -4008,7 +4049,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueCreate( "urQueueCreate", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urQueueCreate\n"); + UR_LOG_L(logger, INFO, " ---> urQueueCreate\n"); ur_result_t result = pfnCreate(hContext, hDevice, pProperties, phQueue); @@ -4019,7 +4060,8 @@ __urdlllocal ur_result_t UR_APICALL urQueueCreate( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_CREATE, ¶ms); - logger.info(" <--- urQueueCreate({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urQueueCreate({}) -> {};\n", args_str.str(), + result); } return result; @@ -4040,7 +4082,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueRetain( "urQueueRetain", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urQueueRetain\n"); + UR_LOG_L(logger, INFO, " ---> urQueueRetain\n"); ur_result_t result = pfnRetain(hQueue); @@ -4051,7 +4093,8 @@ __urdlllocal ur_result_t UR_APICALL urQueueRetain( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_RETAIN, ¶ms); - logger.info(" <--- urQueueRetain({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urQueueRetain({}) -> {};\n", args_str.str(), + result); } return result; @@ -4072,7 +4115,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueRelease( "urQueueRelease", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urQueueRelease\n"); + UR_LOG_L(logger, INFO, " ---> urQueueRelease\n"); ur_result_t result = pfnRelease(hQueue); @@ -4083,7 +4126,8 @@ __urdlllocal ur_result_t UR_APICALL urQueueRelease( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_RELEASE, ¶ms); - logger.info(" <--- urQueueRelease({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urQueueRelease({}) -> {};\n", + args_str.str(), result); } return result; @@ -4109,7 +4153,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueGetNativeHandle( UR_FUNCTION_QUEUE_GET_NATIVE_HANDLE, "urQueueGetNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urQueueGetNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urQueueGetNativeHandle\n"); ur_result_t result = pfnGetNativeHandle(hQueue, pDesc, phNativeQueue); @@ -4121,8 +4165,8 @@ __urdlllocal ur_result_t UR_APICALL urQueueGetNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_QUEUE_GET_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urQueueGetNativeHandle({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urQueueGetNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -4154,7 +4198,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueCreateWithNativeHandle( "urQueueCreateWithNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urQueueCreateWithNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urQueueCreateWithNativeHandle\n"); ur_result_t result = pfnCreateWithNativeHandle(hNativeQueue, hContext, hDevice, pProperties, phQueue); @@ -4167,8 +4211,8 @@ __urdlllocal ur_result_t UR_APICALL urQueueCreateWithNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_QUEUE_CREATE_WITH_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urQueueCreateWithNativeHandle({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urQueueCreateWithNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -4189,7 +4233,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueFinish( "urQueueFinish", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urQueueFinish\n"); + UR_LOG_L(logger, INFO, " ---> urQueueFinish\n"); ur_result_t result = pfnFinish(hQueue); @@ -4200,7 +4244,8 @@ __urdlllocal ur_result_t UR_APICALL urQueueFinish( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_FINISH, ¶ms); - logger.info(" <--- urQueueFinish({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urQueueFinish({}) -> {};\n", args_str.str(), + result); } return result; @@ -4221,7 +4266,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueFlush( "urQueueFlush", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urQueueFlush\n"); + UR_LOG_L(logger, INFO, " ---> urQueueFlush\n"); ur_result_t result = pfnFlush(hQueue); @@ -4231,7 +4276,8 @@ __urdlllocal ur_result_t UR_APICALL urQueueFlush( if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_QUEUE_FLUSH, ¶ms); - logger.info(" <--- urQueueFlush({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urQueueFlush({}) -> {};\n", args_str.str(), + result); } return result; @@ -4262,7 +4308,7 @@ __urdlllocal ur_result_t UR_APICALL urEventGetInfo( "urEventGetInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEventGetInfo\n"); + UR_LOG_L(logger, INFO, " ---> urEventGetInfo\n"); ur_result_t result = pfnGetInfo(hEvent, propName, propSize, pPropValue, pPropSizeRet); @@ -4274,7 +4320,8 @@ __urdlllocal ur_result_t UR_APICALL urEventGetInfo( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_GET_INFO, ¶ms); - logger.info(" <--- urEventGetInfo({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urEventGetInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -4306,7 +4353,7 @@ __urdlllocal ur_result_t UR_APICALL urEventGetProfilingInfo( UR_FUNCTION_EVENT_GET_PROFILING_INFO, "urEventGetProfilingInfo", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEventGetProfilingInfo\n"); + UR_LOG_L(logger, INFO, " ---> urEventGetProfilingInfo\n"); ur_result_t result = pfnGetProfilingInfo(hEvent, propName, propSize, pPropValue, pPropSizeRet); @@ -4319,8 +4366,8 @@ __urdlllocal ur_result_t UR_APICALL urEventGetProfilingInfo( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_EVENT_GET_PROFILING_INFO, ¶ms); - logger.info(" <--- urEventGetProfilingInfo({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEventGetProfilingInfo({}) -> {};\n", + args_str.str(), result); } return result; @@ -4344,7 +4391,7 @@ __urdlllocal ur_result_t UR_APICALL urEventWait( "urEventWait", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEventWait\n"); + UR_LOG_L(logger, INFO, " ---> urEventWait\n"); ur_result_t result = pfnWait(numEvents, phEventWaitList); @@ -4354,7 +4401,8 @@ __urdlllocal ur_result_t UR_APICALL urEventWait( if (logger.getLevel() <= UR_LOGGER_LEVEL_INFO) { std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_WAIT, ¶ms); - logger.info(" <--- urEventWait({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urEventWait({}) -> {};\n", args_str.str(), + result); } return result; @@ -4375,7 +4423,7 @@ __urdlllocal ur_result_t UR_APICALL urEventRetain( "urEventRetain", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEventRetain\n"); + UR_LOG_L(logger, INFO, " ---> urEventRetain\n"); ur_result_t result = pfnRetain(hEvent); @@ -4386,7 +4434,8 @@ __urdlllocal ur_result_t UR_APICALL urEventRetain( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_RETAIN, ¶ms); - logger.info(" <--- urEventRetain({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urEventRetain({}) -> {};\n", args_str.str(), + result); } return result; @@ -4407,7 +4456,7 @@ __urdlllocal ur_result_t UR_APICALL urEventRelease( "urEventRelease", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEventRelease\n"); + UR_LOG_L(logger, INFO, " ---> urEventRelease\n"); ur_result_t result = pfnRelease(hEvent); @@ -4418,7 +4467,8 @@ __urdlllocal ur_result_t UR_APICALL urEventRelease( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_RELEASE, ¶ms); - logger.info(" <--- urEventRelease({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urEventRelease({}) -> {};\n", + args_str.str(), result); } return result; @@ -4441,7 +4491,7 @@ __urdlllocal ur_result_t UR_APICALL urEventGetNativeHandle( UR_FUNCTION_EVENT_GET_NATIVE_HANDLE, "urEventGetNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEventGetNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urEventGetNativeHandle\n"); ur_result_t result = pfnGetNativeHandle(hEvent, phNativeEvent); @@ -4453,8 +4503,8 @@ __urdlllocal ur_result_t UR_APICALL urEventGetNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_EVENT_GET_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urEventGetNativeHandle({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEventGetNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -4484,7 +4534,7 @@ __urdlllocal ur_result_t UR_APICALL urEventCreateWithNativeHandle( "urEventCreateWithNativeHandle", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEventCreateWithNativeHandle\n"); + UR_LOG_L(logger, INFO, " ---> urEventCreateWithNativeHandle\n"); ur_result_t result = pfnCreateWithNativeHandle(hNativeEvent, hContext, pProperties, phEvent); @@ -4497,8 +4547,8 @@ __urdlllocal ur_result_t UR_APICALL urEventCreateWithNativeHandle( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_EVENT_CREATE_WITH_NATIVE_HANDLE, ¶ms); - logger.info(" <--- urEventCreateWithNativeHandle({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urEventCreateWithNativeHandle({}) -> {};\n", + args_str.str(), result); } return result; @@ -4526,7 +4576,7 @@ __urdlllocal ur_result_t UR_APICALL urEventSetCallback( "urEventSetCallback", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEventSetCallback\n"); + UR_LOG_L(logger, INFO, " ---> urEventSetCallback\n"); ur_result_t result = pfnSetCallback(hEvent, execStatus, pfnNotify, pUserData); @@ -4537,8 +4587,8 @@ __urdlllocal ur_result_t UR_APICALL urEventSetCallback( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_EVENT_SET_CALLBACK, ¶ms); - logger.info(" <--- urEventSetCallback({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEventSetCallback({}) -> {};\n", + args_str.str(), result); } return result; @@ -4596,7 +4646,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch( UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH, "urEnqueueKernelLaunch", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueKernelLaunch\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueKernelLaunch\n"); ur_result_t result = pfnKernelLaunch( hQueue, hKernel, workDim, pGlobalWorkOffset, pGlobalWorkSize, @@ -4609,8 +4659,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH, ¶ms); - logger.info(" <--- urEnqueueKernelLaunch({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueKernelLaunch({}) -> {};\n", + args_str.str(), result); } return result; @@ -4644,7 +4694,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWait( UR_FUNCTION_ENQUEUE_EVENTS_WAIT, "urEnqueueEventsWait", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueEventsWait\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueEventsWait\n"); ur_result_t result = pfnEventsWait(hQueue, numEventsInWaitList, phEventWaitList, phEvent); @@ -4656,8 +4706,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWait( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_EVENTS_WAIT, ¶ms); - logger.info(" <--- urEnqueueEventsWait({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueEventsWait({}) -> {};\n", + args_str.str(), result); } return result; @@ -4693,7 +4743,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( "urEnqueueEventsWaitWithBarrier", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueEventsWaitWithBarrier\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueEventsWaitWithBarrier\n"); ur_result_t result = pfnEventsWaitWithBarrier(hQueue, numEventsInWaitList, phEventWaitList, phEvent); @@ -4706,8 +4756,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER, ¶ms); - logger.info(" <--- urEnqueueEventsWaitWithBarrier({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urEnqueueEventsWaitWithBarrier({}) -> {};\n", + args_str.str(), result); } return result; @@ -4752,7 +4803,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ, "urEnqueueMemBufferRead", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueMemBufferRead\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueMemBufferRead\n"); ur_result_t result = pfnMemBufferRead(hQueue, hBuffer, blockingRead, offset, size, pDst, @@ -4766,8 +4817,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ, ¶ms); - logger.info(" <--- urEnqueueMemBufferRead({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueMemBufferRead({}) -> {};\n", + args_str.str(), result); } return result; @@ -4812,7 +4863,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE, "urEnqueueMemBufferWrite", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueMemBufferWrite\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueMemBufferWrite\n"); ur_result_t result = pfnMemBufferWrite(hQueue, hBuffer, blockingWrite, offset, size, pSrc, @@ -4826,8 +4877,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE, ¶ms); - logger.info(" <--- urEnqueueMemBufferWrite({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueMemBufferWrite({}) -> {};\n", + args_str.str(), result); } return result; @@ -4887,7 +4938,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( "urEnqueueMemBufferReadRect", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueMemBufferReadRect\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueMemBufferReadRect\n"); ur_result_t result = pfnMemBufferReadRect( hQueue, hBuffer, blockingRead, bufferOrigin, hostOrigin, region, @@ -4902,8 +4953,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ_RECT, ¶ms); - logger.info(" <--- urEnqueueMemBufferReadRect({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urEnqueueMemBufferReadRect({}) -> {};\n", + args_str.str(), result); } return result; @@ -4964,7 +5015,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( "urEnqueueMemBufferWriteRect", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueMemBufferWriteRect\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueMemBufferWriteRect\n"); ur_result_t result = pfnMemBufferWriteRect( hQueue, hBuffer, blockingWrite, bufferOrigin, hostOrigin, region, @@ -4979,8 +5030,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE_RECT, ¶ms); - logger.info(" <--- urEnqueueMemBufferWriteRect({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urEnqueueMemBufferWriteRect({}) -> {};\n", + args_str.str(), result); } return result; @@ -5024,7 +5075,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY, "urEnqueueMemBufferCopy", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueMemBufferCopy\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueMemBufferCopy\n"); ur_result_t result = pfnMemBufferCopy(hQueue, hBufferSrc, hBufferDst, srcOffset, dstOffset, @@ -5038,8 +5089,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY, ¶ms); - logger.info(" <--- urEnqueueMemBufferCopy({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueMemBufferCopy({}) -> {};\n", + args_str.str(), result); } return result; @@ -5095,7 +5146,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( "urEnqueueMemBufferCopyRect", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueMemBufferCopyRect\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueMemBufferCopyRect\n"); ur_result_t result = pfnMemBufferCopyRect( hQueue, hBufferSrc, hBufferDst, srcOrigin, dstOrigin, region, srcRowPitch, @@ -5110,8 +5161,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY_RECT, ¶ms); - logger.info(" <--- urEnqueueMemBufferCopyRect({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urEnqueueMemBufferCopyRect({}) -> {};\n", + args_str.str(), result); } return result; @@ -5161,7 +5212,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( UR_FUNCTION_ENQUEUE_MEM_BUFFER_FILL, "urEnqueueMemBufferFill", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueMemBufferFill\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueMemBufferFill\n"); ur_result_t result = pfnMemBufferFill(hQueue, hBuffer, pPattern, patternSize, offset, size, @@ -5175,8 +5226,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_FILL, ¶ms); - logger.info(" <--- urEnqueueMemBufferFill({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueMemBufferFill({}) -> {};\n", + args_str.str(), result); } return result; @@ -5227,7 +5278,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( UR_FUNCTION_ENQUEUE_MEM_IMAGE_READ, "urEnqueueMemImageRead", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueMemImageRead\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueMemImageRead\n"); ur_result_t result = pfnMemImageRead( hQueue, hImage, blockingRead, origin, region, rowPitch, slicePitch, pDst, @@ -5240,8 +5291,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_IMAGE_READ, ¶ms); - logger.info(" <--- urEnqueueMemImageRead({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueMemImageRead({}) -> {};\n", + args_str.str(), result); } return result; @@ -5292,7 +5343,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( UR_FUNCTION_ENQUEUE_MEM_IMAGE_WRITE, "urEnqueueMemImageWrite", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueMemImageWrite\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueMemImageWrite\n"); ur_result_t result = pfnMemImageWrite( hQueue, hImage, blockingWrite, origin, region, rowPitch, slicePitch, pSrc, @@ -5306,8 +5357,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_IMAGE_WRITE, ¶ms); - logger.info(" <--- urEnqueueMemImageWrite({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueMemImageWrite({}) -> {};\n", + args_str.str(), result); } return result; @@ -5354,7 +5405,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( UR_FUNCTION_ENQUEUE_MEM_IMAGE_COPY, "urEnqueueMemImageCopy", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueMemImageCopy\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueMemImageCopy\n"); ur_result_t result = pfnMemImageCopy(hQueue, hImageSrc, hImageDst, srcOrigin, dstOrigin, @@ -5367,8 +5418,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_IMAGE_COPY, ¶ms); - logger.info(" <--- urEnqueueMemImageCopy({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueMemImageCopy({}) -> {};\n", + args_str.str(), result); } return result; @@ -5416,7 +5467,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferMap( UR_FUNCTION_ENQUEUE_MEM_BUFFER_MAP, "urEnqueueMemBufferMap", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueMemBufferMap\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueMemBufferMap\n"); ur_result_t result = pfnMemBufferMap(hQueue, hBuffer, blockingMap, mapFlags, offset, size, @@ -5429,8 +5480,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferMap( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_MEM_BUFFER_MAP, ¶ms); - logger.info(" <--- urEnqueueMemBufferMap({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueMemBufferMap({}) -> {};\n", + args_str.str(), result); } return result; @@ -5468,7 +5519,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemUnmap( "urEnqueueMemUnmap", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueMemUnmap\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueMemUnmap\n"); ur_result_t result = pfnMemUnmap( hQueue, hMem, pMappedPtr, numEventsInWaitList, phEventWaitList, phEvent); @@ -5480,8 +5531,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemUnmap( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_MEM_UNMAP, ¶ms); - logger.info(" <--- urEnqueueMemUnmap({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueMemUnmap({}) -> {};\n", + args_str.str(), result); } return result; @@ -5525,7 +5576,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( "urEnqueueUSMFill", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueUSMFill\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueUSMFill\n"); ur_result_t result = pfnUSMFill(hQueue, pMem, patternSize, pPattern, size, numEventsInWaitList, @@ -5538,8 +5589,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_FILL, ¶ms); - logger.info(" <--- urEnqueueUSMFill({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueUSMFill({}) -> {};\n", + args_str.str(), result); } return result; @@ -5581,7 +5632,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( "urEnqueueUSMMemcpy", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueUSMMemcpy\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueUSMMemcpy\n"); ur_result_t result = pfnUSMMemcpy(hQueue, blocking, pDst, pSrc, size, numEventsInWaitList, @@ -5594,8 +5645,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_MEMCPY, ¶ms); - logger.info(" <--- urEnqueueUSMMemcpy({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueUSMMemcpy({}) -> {};\n", + args_str.str(), result); } return result; @@ -5635,7 +5686,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( UR_FUNCTION_ENQUEUE_USM_PREFETCH, "urEnqueueUSMPrefetch", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueUSMPrefetch\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueUSMPrefetch\n"); ur_result_t result = pfnUSMPrefetch( hQueue, pMem, size, flags, numEventsInWaitList, phEventWaitList, phEvent); @@ -5647,8 +5698,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_PREFETCH, ¶ms); - logger.info(" <--- urEnqueueUSMPrefetch({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueUSMPrefetch({}) -> {};\n", + args_str.str(), result); } return result; @@ -5679,7 +5730,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMAdvise( "urEnqueueUSMAdvise", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueUSMAdvise\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueUSMAdvise\n"); ur_result_t result = pfnUSMAdvise(hQueue, pMem, size, advice, phEvent); @@ -5690,8 +5741,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMAdvise( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_ADVISE, ¶ms); - logger.info(" <--- urEnqueueUSMAdvise({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueUSMAdvise({}) -> {};\n", + args_str.str(), result); } return result; @@ -5741,7 +5792,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( UR_FUNCTION_ENQUEUE_USM_FILL_2D, "urEnqueueUSMFill2D", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueUSMFill2D\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueUSMFill2D\n"); ur_result_t result = pfnUSMFill2D(hQueue, pMem, pitch, patternSize, pPattern, width, height, @@ -5754,8 +5805,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_FILL_2D, ¶ms); - logger.info(" <--- urEnqueueUSMFill2D({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueUSMFill2D({}) -> {};\n", + args_str.str(), result); } return result; @@ -5807,7 +5858,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( UR_FUNCTION_ENQUEUE_USM_MEMCPY_2D, "urEnqueueUSMMemcpy2D", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueUSMMemcpy2D\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueUSMMemcpy2D\n"); ur_result_t result = pfnUSMMemcpy2D(hQueue, blocking, pDst, dstPitch, pSrc, srcPitch, width, @@ -5820,8 +5871,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_MEMCPY_2D, ¶ms); - logger.info(" <--- urEnqueueUSMMemcpy2D({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueUSMMemcpy2D({}) -> {};\n", + args_str.str(), result); } return result; @@ -5871,7 +5922,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableWrite( "urEnqueueDeviceGlobalVariableWrite", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueDeviceGlobalVariableWrite\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueDeviceGlobalVariableWrite\n"); ur_result_t result = pfnDeviceGlobalVariableWrite( hQueue, hProgram, name, blockingWrite, count, offset, pSrc, @@ -5885,8 +5936,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableWrite( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_WRITE, ¶ms); - logger.info(" <--- urEnqueueDeviceGlobalVariableWrite({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urEnqueueDeviceGlobalVariableWrite({}) -> {};\n", + args_str.str(), result); } return result; @@ -5936,7 +5988,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableRead( "urEnqueueDeviceGlobalVariableRead", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueDeviceGlobalVariableRead\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueDeviceGlobalVariableRead\n"); ur_result_t result = pfnDeviceGlobalVariableRead( hQueue, hProgram, name, blockingRead, count, offset, pDst, @@ -5950,8 +6002,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableRead( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_READ, ¶ms); - logger.info(" <--- urEnqueueDeviceGlobalVariableRead({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urEnqueueDeviceGlobalVariableRead({}) -> {};\n", + args_str.str(), result); } return result; @@ -6001,7 +6054,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueReadHostPipe( UR_FUNCTION_ENQUEUE_READ_HOST_PIPE, "urEnqueueReadHostPipe", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueReadHostPipe\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueReadHostPipe\n"); ur_result_t result = pfnReadHostPipe(hQueue, hProgram, pipe_symbol, blocking, pDst, size, @@ -6014,8 +6067,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueReadHostPipe( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_READ_HOST_PIPE, ¶ms); - logger.info(" <--- urEnqueueReadHostPipe({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueReadHostPipe({}) -> {};\n", + args_str.str(), result); } return result; @@ -6066,7 +6119,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE, "urEnqueueWriteHostPipe", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueWriteHostPipe\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueWriteHostPipe\n"); ur_result_t result = pfnWriteHostPipe(hQueue, hProgram, pipe_symbol, blocking, pSrc, size, @@ -6080,8 +6133,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE, ¶ms); - logger.info(" <--- urEnqueueWriteHostPipe({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueWriteHostPipe({}) -> {};\n", + args_str.str(), result); } return result; @@ -6123,7 +6176,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMDeviceAllocExp( "urEnqueueUSMDeviceAllocExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueUSMDeviceAllocExp\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueUSMDeviceAllocExp\n"); ur_result_t result = pfnUSMDeviceAllocExp(hQueue, pPool, size, pProperties, numEventsInWaitList, @@ -6137,8 +6190,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMDeviceAllocExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_USM_DEVICE_ALLOC_EXP, ¶ms); - logger.info(" <--- urEnqueueUSMDeviceAllocExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urEnqueueUSMDeviceAllocExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6180,7 +6233,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMSharedAllocExp( "urEnqueueUSMSharedAllocExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueUSMSharedAllocExp\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueUSMSharedAllocExp\n"); ur_result_t result = pfnUSMSharedAllocExp(hQueue, pPool, size, pProperties, numEventsInWaitList, @@ -6194,8 +6247,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMSharedAllocExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_USM_SHARED_ALLOC_EXP, ¶ms); - logger.info(" <--- urEnqueueUSMSharedAllocExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urEnqueueUSMSharedAllocExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6237,7 +6290,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMHostAllocExp( "urEnqueueUSMHostAllocExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueUSMHostAllocExp\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueUSMHostAllocExp\n"); ur_result_t result = pfnUSMHostAllocExp(hQueue, pPool, size, pProperties, numEventsInWaitList, @@ -6251,8 +6304,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMHostAllocExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_USM_HOST_ALLOC_EXP, ¶ms); - logger.info(" <--- urEnqueueUSMHostAllocExp({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueUSMHostAllocExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6287,7 +6340,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFreeExp( UR_FUNCTION_ENQUEUE_USM_FREE_EXP, "urEnqueueUSMFreeExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueUSMFreeExp\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueUSMFreeExp\n"); ur_result_t result = pfnUSMFreeExp(hQueue, pPool, pMem, numEventsInWaitList, phEventWaitList, phEvent); @@ -6299,8 +6352,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFreeExp( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_ENQUEUE_USM_FREE_EXP, ¶ms); - logger.info(" <--- urEnqueueUSMFreeExp({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urEnqueueUSMFreeExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6329,7 +6382,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolCreateExp( UR_FUNCTION_USM_POOL_CREATE_EXP, "urUSMPoolCreateExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMPoolCreateExp\n"); + UR_LOG_L(logger, INFO, " ---> urUSMPoolCreateExp\n"); ur_result_t result = pfnPoolCreateExp(hContext, hDevice, pPoolDesc, pPool); @@ -6340,8 +6393,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolCreateExp( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_CREATE_EXP, ¶ms); - logger.info(" <--- urUSMPoolCreateExp({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urUSMPoolCreateExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6366,7 +6419,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolDestroyExp( UR_FUNCTION_USM_POOL_DESTROY_EXP, "urUSMPoolDestroyExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMPoolDestroyExp\n"); + UR_LOG_L(logger, INFO, " ---> urUSMPoolDestroyExp\n"); ur_result_t result = pfnPoolDestroyExp(hContext, hDevice, hPool); @@ -6377,8 +6430,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolDestroyExp( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_DESTROY_EXP, ¶ms); - logger.info(" <--- urUSMPoolDestroyExp({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urUSMPoolDestroyExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6406,7 +6459,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( "urUSMPoolGetDefaultDevicePoolExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMPoolGetDefaultDevicePoolExp\n"); + UR_LOG_L(logger, INFO, " ---> urUSMPoolGetDefaultDevicePoolExp\n"); ur_result_t result = pfnPoolGetDefaultDevicePoolExp(hContext, hDevice, pPool); @@ -6418,8 +6471,9 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_USM_POOL_GET_DEFAULT_DEVICE_POOL_EXP, ¶ms); - logger.info(" <--- urUSMPoolGetDefaultDevicePoolExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urUSMPoolGetDefaultDevicePoolExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6447,7 +6501,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetInfoExp( UR_FUNCTION_USM_POOL_GET_INFO_EXP, "urUSMPoolGetInfoExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMPoolGetInfoExp\n"); + UR_LOG_L(logger, INFO, " ---> urUSMPoolGetInfoExp\n"); ur_result_t result = pfnPoolGetInfoExp(hPool, propName, pPropValue, pPropSizeRet); @@ -6459,8 +6513,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetInfoExp( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_GET_INFO_EXP, ¶ms); - logger.info(" <--- urUSMPoolGetInfoExp({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urUSMPoolGetInfoExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6488,7 +6542,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolSetInfoExp( UR_FUNCTION_USM_POOL_SET_INFO_EXP, "urUSMPoolSetInfoExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMPoolSetInfoExp\n"); + UR_LOG_L(logger, INFO, " ---> urUSMPoolSetInfoExp\n"); ur_result_t result = pfnPoolSetInfoExp(hPool, propName, pPropValue, propSize); @@ -6499,8 +6553,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolSetInfoExp( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_SET_INFO_EXP, ¶ms); - logger.info(" <--- urUSMPoolSetInfoExp({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urUSMPoolSetInfoExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6528,7 +6582,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( "urUSMPoolSetDevicePoolExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMPoolSetDevicePoolExp\n"); + UR_LOG_L(logger, INFO, " ---> urUSMPoolSetDevicePoolExp\n"); ur_result_t result = pfnPoolSetDevicePoolExp(hContext, hDevice, hPool); @@ -6540,8 +6594,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_USM_POOL_SET_DEVICE_POOL_EXP, ¶ms); - logger.info(" <--- urUSMPoolSetDevicePoolExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urUSMPoolSetDevicePoolExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6569,7 +6623,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( "urUSMPoolGetDevicePoolExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMPoolGetDevicePoolExp\n"); + UR_LOG_L(logger, INFO, " ---> urUSMPoolGetDevicePoolExp\n"); ur_result_t result = pfnPoolGetDevicePoolExp(hContext, hDevice, pPool); @@ -6581,8 +6635,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_USM_POOL_GET_DEVICE_POOL_EXP, ¶ms); - logger.info(" <--- urUSMPoolGetDevicePoolExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urUSMPoolGetDevicePoolExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6610,7 +6664,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolTrimToExp( UR_FUNCTION_USM_POOL_TRIM_TO_EXP, "urUSMPoolTrimToExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMPoolTrimToExp\n"); + UR_LOG_L(logger, INFO, " ---> urUSMPoolTrimToExp\n"); ur_result_t result = pfnPoolTrimToExp(hContext, hDevice, hPool, minBytesToKeep); @@ -6622,8 +6676,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolTrimToExp( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_POOL_TRIM_TO_EXP, ¶ms); - logger.info(" <--- urUSMPoolTrimToExp({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urUSMPoolTrimToExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6662,7 +6716,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPitchedAllocExp( UR_FUNCTION_USM_PITCHED_ALLOC_EXP, "urUSMPitchedAllocExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMPitchedAllocExp\n"); + UR_LOG_L(logger, INFO, " ---> urUSMPitchedAllocExp\n"); ur_result_t result = pfnPitchedAllocExp(hContext, hDevice, pUSMDesc, pool, widthInBytes, @@ -6675,8 +6729,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMPitchedAllocExp( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_PITCHED_ALLOC_EXP, ¶ms); - logger.info(" <--- urUSMPitchedAllocExp({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urUSMPitchedAllocExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6706,7 +6760,8 @@ urBindlessImagesUnsampledImageHandleDestroyExp( "urBindlessImagesUnsampledImageHandleDestroyExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesUnsampledImageHandleDestroyExp\n"); + UR_LOG_L(logger, INFO, + " ---> urBindlessImagesUnsampledImageHandleDestroyExp\n"); ur_result_t result = pfnUnsampledImageHandleDestroyExp(hContext, hDevice, hImage); @@ -6722,7 +6777,8 @@ urBindlessImagesUnsampledImageHandleDestroyExp( args_str, UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP, ¶ms); - logger.info( + UR_LOG_L( + logger, INFO, " <--- urBindlessImagesUnsampledImageHandleDestroyExp({}) -> {};\n", args_str.str(), result); } @@ -6754,7 +6810,8 @@ urBindlessImagesSampledImageHandleDestroyExp( "urBindlessImagesSampledImageHandleDestroyExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesSampledImageHandleDestroyExp\n"); + UR_LOG_L(logger, INFO, + " ---> urBindlessImagesSampledImageHandleDestroyExp\n"); ur_result_t result = pfnSampledImageHandleDestroyExp(hContext, hDevice, hImage); @@ -6769,7 +6826,8 @@ urBindlessImagesSampledImageHandleDestroyExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP, ¶ms); - logger.info( + UR_LOG_L( + logger, INFO, " <--- urBindlessImagesSampledImageHandleDestroyExp({}) -> {};\n", args_str.str(), result); } @@ -6803,7 +6861,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( "urBindlessImagesImageAllocateExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesImageAllocateExp\n"); + UR_LOG_L(logger, INFO, " ---> urBindlessImagesImageAllocateExp\n"); ur_result_t result = pfnImageAllocateExp(hContext, hDevice, pImageFormat, pImageDesc, phImageMem); @@ -6816,8 +6874,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_ALLOCATE_EXP, ¶ms); - logger.info(" <--- urBindlessImagesImageAllocateExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urBindlessImagesImageAllocateExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6845,7 +6904,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageFreeExp( "urBindlessImagesImageFreeExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesImageFreeExp\n"); + UR_LOG_L(logger, INFO, " ---> urBindlessImagesImageFreeExp\n"); ur_result_t result = pfnImageFreeExp(hContext, hDevice, hImageMem); @@ -6857,8 +6916,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageFreeExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_FREE_EXP, ¶ms); - logger.info(" <--- urBindlessImagesImageFreeExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urBindlessImagesImageFreeExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6892,7 +6951,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( "urBindlessImagesUnsampledImageCreateExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesUnsampledImageCreateExp\n"); + UR_LOG_L(logger, INFO, " ---> urBindlessImagesUnsampledImageCreateExp\n"); ur_result_t result = pfnUnsampledImageCreateExp( hContext, hDevice, hImageMem, pImageFormat, pImageDesc, phImage); @@ -6906,8 +6965,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP, ¶ms); - logger.info(" <--- urBindlessImagesUnsampledImageCreateExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urBindlessImagesUnsampledImageCreateExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -6944,7 +7004,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( "urBindlessImagesSampledImageCreateExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesSampledImageCreateExp\n"); + UR_LOG_L(logger, INFO, " ---> urBindlessImagesSampledImageCreateExp\n"); ur_result_t result = pfnSampledImageCreateExp(hContext, hDevice, hImageMem, pImageFormat, @@ -6959,8 +7019,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP, ¶ms); - logger.info(" <--- urBindlessImagesSampledImageCreateExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urBindlessImagesSampledImageCreateExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7023,7 +7084,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp( "urBindlessImagesImageCopyExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesImageCopyExp\n"); + UR_LOG_L(logger, INFO, " ---> urBindlessImagesImageCopyExp\n"); ur_result_t result = pfnImageCopyExp( hQueue, pSrc, pDst, pSrcImageDesc, pDstImageDesc, pSrcImageFormat, @@ -7038,8 +7099,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_COPY_EXP, ¶ms); - logger.info(" <--- urBindlessImagesImageCopyExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urBindlessImagesImageCopyExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7071,7 +7132,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( "urBindlessImagesImageGetInfoExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesImageGetInfoExp\n"); + UR_LOG_L(logger, INFO, " ---> urBindlessImagesImageGetInfoExp\n"); ur_result_t result = pfnImageGetInfoExp(hContext, hImageMem, propName, pPropValue, pPropSizeRet); @@ -7084,8 +7145,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_IMAGE_GET_INFO_EXP, ¶ms); - logger.info(" <--- urBindlessImagesImageGetInfoExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urBindlessImagesImageGetInfoExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7117,7 +7179,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp( "urBindlessImagesMipmapGetLevelExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesMipmapGetLevelExp\n"); + UR_LOG_L(logger, INFO, " ---> urBindlessImagesMipmapGetLevelExp\n"); ur_result_t result = pfnMipmapGetLevelExp(hContext, hDevice, hImageMem, mipmapLevel, phImageMem); @@ -7130,8 +7192,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_GET_LEVEL_EXP, ¶ms); - logger.info(" <--- urBindlessImagesMipmapGetLevelExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urBindlessImagesMipmapGetLevelExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7159,7 +7222,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( "urBindlessImagesMipmapFreeExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesMipmapFreeExp\n"); + UR_LOG_L(logger, INFO, " ---> urBindlessImagesMipmapFreeExp\n"); ur_result_t result = pfnMipmapFreeExp(hContext, hDevice, hMem); @@ -7171,8 +7234,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_FREE_EXP, ¶ms); - logger.info(" <--- urBindlessImagesMipmapFreeExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urBindlessImagesMipmapFreeExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7207,7 +7270,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportExternalMemoryExp( "urBindlessImagesImportExternalMemoryExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesImportExternalMemoryExp\n"); + UR_LOG_L(logger, INFO, " ---> urBindlessImagesImportExternalMemoryExp\n"); ur_result_t result = pfnImportExternalMemoryExp( hContext, hDevice, size, memHandleType, pExternalMemDesc, phExternalMem); @@ -7221,8 +7284,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportExternalMemoryExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP, ¶ms); - logger.info(" <--- urBindlessImagesImportExternalMemoryExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urBindlessImagesImportExternalMemoryExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7257,7 +7321,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( "urBindlessImagesMapExternalArrayExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesMapExternalArrayExp\n"); + UR_LOG_L(logger, INFO, " ---> urBindlessImagesMapExternalArrayExp\n"); ur_result_t result = pfnMapExternalArrayExp( hContext, hDevice, pImageFormat, pImageDesc, hExternalMem, phImageMem); @@ -7270,8 +7334,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP, ¶ms); - logger.info(" <--- urBindlessImagesMapExternalArrayExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urBindlessImagesMapExternalArrayExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7305,7 +7370,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMapExternalLinearMemoryExp( "urBindlessImagesMapExternalLinearMemoryExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesMapExternalLinearMemoryExp\n"); + UR_LOG_L(logger, INFO, + " ---> urBindlessImagesMapExternalLinearMemoryExp\n"); ur_result_t result = pfnMapExternalLinearMemoryExp( hContext, hDevice, offset, size, hExternalMem, ppRetMem); @@ -7319,9 +7385,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMapExternalLinearMemoryExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP, ¶ms); - logger.info( - " <--- urBindlessImagesMapExternalLinearMemoryExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urBindlessImagesMapExternalLinearMemoryExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7349,7 +7415,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalMemoryExp( "urBindlessImagesReleaseExternalMemoryExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesReleaseExternalMemoryExp\n"); + UR_LOG_L(logger, INFO, " ---> urBindlessImagesReleaseExternalMemoryExp\n"); ur_result_t result = pfnReleaseExternalMemoryExp(hContext, hDevice, hExternalMem); @@ -7363,8 +7429,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalMemoryExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP, ¶ms); - logger.info(" <--- urBindlessImagesReleaseExternalMemoryExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urBindlessImagesReleaseExternalMemoryExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7397,7 +7464,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportExternalSemaphoreExp( "urBindlessImagesImportExternalSemaphoreExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesImportExternalSemaphoreExp\n"); + UR_LOG_L(logger, INFO, + " ---> urBindlessImagesImportExternalSemaphoreExp\n"); ur_result_t result = pfnImportExternalSemaphoreExp( hContext, hDevice, semHandleType, pExternalSemaphoreDesc, @@ -7412,9 +7480,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportExternalSemaphoreExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP, ¶ms); - logger.info( - " <--- urBindlessImagesImportExternalSemaphoreExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urBindlessImagesImportExternalSemaphoreExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7442,7 +7510,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalSemaphoreExp( "urBindlessImagesReleaseExternalSemaphoreExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesReleaseExternalSemaphoreExp\n"); + UR_LOG_L(logger, INFO, + " ---> urBindlessImagesReleaseExternalSemaphoreExp\n"); ur_result_t result = pfnReleaseExternalSemaphoreExp(hContext, hDevice, hExternalSemaphore); @@ -7457,9 +7526,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalSemaphoreExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_SEMAPHORE_EXP, ¶ms); - logger.info( - " <--- urBindlessImagesReleaseExternalSemaphoreExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urBindlessImagesReleaseExternalSemaphoreExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7506,7 +7575,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesWaitExternalSemaphoreExp( "urBindlessImagesWaitExternalSemaphoreExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesWaitExternalSemaphoreExp\n"); + UR_LOG_L(logger, INFO, " ---> urBindlessImagesWaitExternalSemaphoreExp\n"); ur_result_t result = pfnWaitExternalSemaphoreExp( hQueue, hSemaphore, hasWaitValue, waitValue, numEventsInWaitList, @@ -7521,8 +7590,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesWaitExternalSemaphoreExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP, ¶ms); - logger.info(" <--- urBindlessImagesWaitExternalSemaphoreExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urBindlessImagesWaitExternalSemaphoreExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7569,7 +7639,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSignalExternalSemaphoreExp( "urBindlessImagesSignalExternalSemaphoreExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urBindlessImagesSignalExternalSemaphoreExp\n"); + UR_LOG_L(logger, INFO, + " ---> urBindlessImagesSignalExternalSemaphoreExp\n"); ur_result_t result = pfnSignalExternalSemaphoreExp( hQueue, hSemaphore, hasSignalValue, signalValue, numEventsInWaitList, @@ -7584,9 +7655,9 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSignalExternalSemaphoreExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP, ¶ms); - logger.info( - " <--- urBindlessImagesSignalExternalSemaphoreExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urBindlessImagesSignalExternalSemaphoreExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7615,7 +7686,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferCreateExp( "urCommandBufferCreateExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferCreateExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferCreateExp\n"); ur_result_t result = pfnCreateExp(hContext, hDevice, pCommandBufferDesc, phCommandBuffer); @@ -7628,8 +7699,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferCreateExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_CREATE_EXP, ¶ms); - logger.info(" <--- urCommandBufferCreateExp({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urCommandBufferCreateExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7651,7 +7722,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainExp( "urCommandBufferRetainExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferRetainExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferRetainExp\n"); ur_result_t result = pfnRetainExp(hCommandBuffer); @@ -7663,8 +7734,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferRetainExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_RETAIN_EXP, ¶ms); - logger.info(" <--- urCommandBufferRetainExp({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urCommandBufferRetainExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7686,7 +7757,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseExp( "urCommandBufferReleaseExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferReleaseExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferReleaseExp\n"); ur_result_t result = pfnReleaseExp(hCommandBuffer); @@ -7698,8 +7769,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferReleaseExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_RELEASE_EXP, ¶ms); - logger.info(" <--- urCommandBufferReleaseExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urCommandBufferReleaseExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7722,7 +7793,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferFinalizeExp( "urCommandBufferFinalizeExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferFinalizeExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferFinalizeExp\n"); ur_result_t result = pfnFinalizeExp(hCommandBuffer); @@ -7734,8 +7805,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferFinalizeExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP, ¶ms); - logger.info(" <--- urCommandBufferFinalizeExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urCommandBufferFinalizeExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7814,7 +7885,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( "urCommandBufferAppendKernelLaunchExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferAppendKernelLaunchExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferAppendKernelLaunchExp\n"); ur_result_t result = pfnAppendKernelLaunchExp( hCommandBuffer, hKernel, workDim, pGlobalWorkOffset, pGlobalWorkSize, @@ -7830,8 +7901,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP, ¶ms); - logger.info(" <--- urCommandBufferAppendKernelLaunchExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferAppendKernelLaunchExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7890,7 +7962,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( "urCommandBufferAppendUSMMemcpyExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferAppendUSMMemcpyExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferAppendUSMMemcpyExp\n"); ur_result_t result = pfnAppendUSMMemcpyExp( hCommandBuffer, pDst, pSrc, size, numSyncPointsInWaitList, @@ -7905,8 +7977,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP, ¶ms); - logger.info(" <--- urCommandBufferAppendUSMMemcpyExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferAppendUSMMemcpyExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -7968,7 +8041,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( "urCommandBufferAppendUSMFillExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferAppendUSMFillExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferAppendUSMFillExp\n"); ur_result_t result = pfnAppendUSMFillExp( hCommandBuffer, pMemory, pPattern, patternSize, size, @@ -7983,8 +8056,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP, ¶ms); - logger.info(" <--- urCommandBufferAppendUSMFillExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferAppendUSMFillExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -8049,7 +8123,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( "urCommandBufferAppendMemBufferCopyExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferAppendMemBufferCopyExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferAppendMemBufferCopyExp\n"); ur_result_t result = pfnAppendMemBufferCopyExp( hCommandBuffer, hSrcMem, hDstMem, srcOffset, dstOffset, size, @@ -8065,8 +8139,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP, ¶ms); - logger.info(" <--- urCommandBufferAppendMemBufferCopyExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferAppendMemBufferCopyExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -8128,7 +8203,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( "urCommandBufferAppendMemBufferWriteExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferAppendMemBufferWriteExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferAppendMemBufferWriteExp\n"); ur_result_t result = pfnAppendMemBufferWriteExp( hCommandBuffer, hBuffer, offset, size, pSrc, numSyncPointsInWaitList, @@ -8144,8 +8219,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP, ¶ms); - logger.info(" <--- urCommandBufferAppendMemBufferWriteExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferAppendMemBufferWriteExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -8207,7 +8283,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( "urCommandBufferAppendMemBufferReadExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferAppendMemBufferReadExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferAppendMemBufferReadExp\n"); ur_result_t result = pfnAppendMemBufferReadExp( hCommandBuffer, hBuffer, offset, size, pDst, numSyncPointsInWaitList, @@ -8223,8 +8299,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP, ¶ms); - logger.info(" <--- urCommandBufferAppendMemBufferReadExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferAppendMemBufferReadExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -8301,7 +8378,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( "urCommandBufferAppendMemBufferCopyRectExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferAppendMemBufferCopyRectExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferAppendMemBufferCopyRectExp\n"); ur_result_t result = pfnAppendMemBufferCopyRectExp( hCommandBuffer, hSrcMem, hDstMem, srcOrigin, dstOrigin, region, @@ -8318,9 +8395,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP, ¶ms); - logger.info( - " <--- urCommandBufferAppendMemBufferCopyRectExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferAppendMemBufferCopyRectExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -8400,7 +8477,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( "urCommandBufferAppendMemBufferWriteRectExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferAppendMemBufferWriteRectExp\n"); + UR_LOG_L(logger, INFO, + " ---> urCommandBufferAppendMemBufferWriteRectExp\n"); ur_result_t result = pfnAppendMemBufferWriteRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, @@ -8417,9 +8495,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP, ¶ms); - logger.info( - " <--- urCommandBufferAppendMemBufferWriteRectExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferAppendMemBufferWriteRectExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -8498,7 +8576,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( "urCommandBufferAppendMemBufferReadRectExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferAppendMemBufferReadRectExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferAppendMemBufferReadRectExp\n"); ur_result_t result = pfnAppendMemBufferReadRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, @@ -8515,9 +8593,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP, ¶ms); - logger.info( - " <--- urCommandBufferAppendMemBufferReadRectExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferAppendMemBufferReadRectExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -8582,7 +8660,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( "urCommandBufferAppendMemBufferFillExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferAppendMemBufferFillExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferAppendMemBufferFillExp\n"); ur_result_t result = pfnAppendMemBufferFillExp( hCommandBuffer, hBuffer, pPattern, patternSize, offset, size, @@ -8598,8 +8676,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP, ¶ms); - logger.info(" <--- urCommandBufferAppendMemBufferFillExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferAppendMemBufferFillExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -8658,7 +8737,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( "urCommandBufferAppendUSMPrefetchExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferAppendUSMPrefetchExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferAppendUSMPrefetchExp\n"); ur_result_t result = pfnAppendUSMPrefetchExp( hCommandBuffer, pMemory, size, flags, numSyncPointsInWaitList, @@ -8673,8 +8752,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP, ¶ms); - logger.info(" <--- urCommandBufferAppendUSMPrefetchExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferAppendUSMPrefetchExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -8733,7 +8813,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( "urCommandBufferAppendUSMAdviseExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferAppendUSMAdviseExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferAppendUSMAdviseExp\n"); ur_result_t result = pfnAppendUSMAdviseExp( hCommandBuffer, pMemory, size, advice, numSyncPointsInWaitList, @@ -8748,8 +8828,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP, ¶ms); - logger.info(" <--- urCommandBufferAppendUSMAdviseExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferAppendUSMAdviseExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -8793,7 +8874,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendNativeCommandExp( "urCommandBufferAppendNativeCommandExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferAppendNativeCommandExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferAppendNativeCommandExp\n"); ur_result_t result = pfnAppendNativeCommandExp( hCommandBuffer, pfnNativeCommand, pData, hChildCommandBuffer, @@ -8808,8 +8889,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendNativeCommandExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_APPEND_NATIVE_COMMAND_EXP, ¶ms); - logger.info(" <--- urCommandBufferAppendNativeCommandExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferAppendNativeCommandExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -8848,7 +8930,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCommandBufferExp( "urEnqueueCommandBufferExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueCommandBufferExp\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueCommandBufferExp\n"); ur_result_t result = pfnCommandBufferExp( hQueue, hCommandBuffer, numEventsInWaitList, phEventWaitList, phEvent); @@ -8861,8 +8943,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCommandBufferExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_COMMAND_BUFFER_EXP, ¶ms); - logger.info(" <--- urEnqueueCommandBufferExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urEnqueueCommandBufferExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -8892,7 +8974,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp( "urCommandBufferUpdateKernelLaunchExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferUpdateKernelLaunchExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferUpdateKernelLaunchExp\n"); ur_result_t result = pfnUpdateKernelLaunchExp( hCommandBuffer, numKernelUpdates, pUpdateKernelLaunch); @@ -8905,8 +8987,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP, ¶ms); - logger.info(" <--- urCommandBufferUpdateKernelLaunchExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferUpdateKernelLaunchExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -8932,7 +9015,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateSignalEventExp( "urCommandBufferUpdateSignalEventExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferUpdateSignalEventExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferUpdateSignalEventExp\n"); ur_result_t result = pfnUpdateSignalEventExp(hCommand, phSignalEvent); @@ -8944,8 +9027,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateSignalEventExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_UPDATE_SIGNAL_EVENT_EXP, ¶ms); - logger.info(" <--- urCommandBufferUpdateSignalEventExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferUpdateSignalEventExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -8975,7 +9059,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateWaitEventsExp( "urCommandBufferUpdateWaitEventsExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferUpdateWaitEventsExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferUpdateWaitEventsExp\n"); ur_result_t result = pfnUpdateWaitEventsExp(hCommand, numEventsInWaitList, phEventWaitList); @@ -8988,8 +9072,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferUpdateWaitEventsExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_UPDATE_WAIT_EVENTS_EXP, ¶ms); - logger.info(" <--- urCommandBufferUpdateWaitEventsExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferUpdateWaitEventsExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9021,7 +9106,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferGetInfoExp( "urCommandBufferGetInfoExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferGetInfoExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferGetInfoExp\n"); ur_result_t result = pfnGetInfoExp(hCommandBuffer, propName, propSize, pPropValue, pPropSizeRet); @@ -9034,8 +9119,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferGetInfoExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP, ¶ms); - logger.info(" <--- urCommandBufferGetInfoExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urCommandBufferGetInfoExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9061,7 +9146,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferGetNativeHandleExp( "urCommandBufferGetNativeHandleExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urCommandBufferGetNativeHandleExp\n"); + UR_LOG_L(logger, INFO, " ---> urCommandBufferGetNativeHandleExp\n"); ur_result_t result = pfnGetNativeHandleExp(hCommandBuffer, phNativeCommandBuffer); @@ -9074,8 +9159,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferGetNativeHandleExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_COMMAND_BUFFER_GET_NATIVE_HANDLE_EXP, ¶ms); - logger.info(" <--- urCommandBufferGetNativeHandleExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urCommandBufferGetNativeHandleExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9136,7 +9222,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( "urEnqueueCooperativeKernelLaunchExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueCooperativeKernelLaunchExp\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueCooperativeKernelLaunchExp\n"); ur_result_t result = pfnCooperativeKernelLaunchExp( hQueue, hKernel, workDim, pGlobalWorkOffset, pGlobalWorkSize, @@ -9150,8 +9236,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP, ¶ms); - logger.info(" <--- urEnqueueCooperativeKernelLaunchExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urEnqueueCooperativeKernelLaunchExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9194,7 +9281,8 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( "urKernelSuggestMaxCooperativeGroupCountExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urKernelSuggestMaxCooperativeGroupCountExp\n"); + UR_LOG_L(logger, INFO, + " ---> urKernelSuggestMaxCooperativeGroupCountExp\n"); ur_result_t result = pfnSuggestMaxCooperativeGroupCountExp( hKernel, hDevice, workDim, pLocalWorkSize, dynamicSharedMemorySize, @@ -9209,9 +9297,9 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( ur::extras::printFunctionParams( args_str, UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP, ¶ms); - logger.info( - " <--- urKernelSuggestMaxCooperativeGroupCountExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urKernelSuggestMaxCooperativeGroupCountExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9257,7 +9345,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueTimestampRecordingExp( "urEnqueueTimestampRecordingExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueTimestampRecordingExp\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueTimestampRecordingExp\n"); ur_result_t result = pfnTimestampRecordingExp( hQueue, blocking, numEventsInWaitList, phEventWaitList, phEvent); @@ -9270,8 +9358,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueTimestampRecordingExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP, ¶ms); - logger.info(" <--- urEnqueueTimestampRecordingExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urEnqueueTimestampRecordingExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9338,7 +9427,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp( "urEnqueueKernelLaunchCustomExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueKernelLaunchCustomExp\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueKernelLaunchCustomExp\n"); ur_result_t result = pfnKernelLaunchCustomExp( hQueue, hKernel, workDim, pGlobalWorkOffset, pGlobalWorkSize, @@ -9353,8 +9442,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP, ¶ms); - logger.info(" <--- urEnqueueKernelLaunchCustomExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urEnqueueKernelLaunchCustomExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9382,7 +9472,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuildExp( "urProgramBuildExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramBuildExp\n"); + UR_LOG_L(logger, INFO, " ---> urProgramBuildExp\n"); ur_result_t result = pfnBuildExp(hProgram, numDevices, phDevices, pOptions); @@ -9393,8 +9483,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuildExp( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_BUILD_EXP, ¶ms); - logger.info(" <--- urProgramBuildExp({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urProgramBuildExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9422,7 +9512,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCompileExp( UR_FUNCTION_PROGRAM_COMPILE_EXP, "urProgramCompileExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramCompileExp\n"); + UR_LOG_L(logger, INFO, " ---> urProgramCompileExp\n"); ur_result_t result = pfnCompileExp(hProgram, numDevices, phDevices, pOptions); @@ -9433,8 +9523,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramCompileExp( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_COMPILE_EXP, ¶ms); - logger.info(" <--- urProgramCompileExp({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urProgramCompileExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9472,7 +9562,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramLinkExp( "urProgramLinkExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urProgramLinkExp\n"); + UR_LOG_L(logger, INFO, " ---> urProgramLinkExp\n"); ur_result_t result = pfnLinkExp(hContext, numDevices, phDevices, count, phPrograms, pOptions, phProgram); @@ -9484,8 +9574,8 @@ __urdlllocal ur_result_t UR_APICALL urProgramLinkExp( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_PROGRAM_LINK_EXP, ¶ms); - logger.info(" <--- urProgramLinkExp({}) -> {};\n", args_str.str(), - result); + UR_LOG_L(logger, INFO, " <--- urProgramLinkExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9510,7 +9600,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMImportExp( "urUSMImportExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMImportExp\n"); + UR_LOG_L(logger, INFO, " ---> urUSMImportExp\n"); ur_result_t result = pfnImportExp(hContext, pMem, size); @@ -9521,7 +9611,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMImportExp( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_IMPORT_EXP, ¶ms); - logger.info(" <--- urUSMImportExp({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urUSMImportExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9544,7 +9635,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMReleaseExp( "urUSMReleaseExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUSMReleaseExp\n"); + UR_LOG_L(logger, INFO, " ---> urUSMReleaseExp\n"); ur_result_t result = pfnReleaseExp(hContext, pMem); @@ -9555,7 +9646,8 @@ __urdlllocal ur_result_t UR_APICALL urUSMReleaseExp( std::ostringstream args_str; ur::extras::printFunctionParams(args_str, UR_FUNCTION_USM_RELEASE_EXP, ¶ms); - logger.info(" <--- urUSMReleaseExp({}) -> {};\n", args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urUSMReleaseExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9581,7 +9673,7 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PEnablePeerAccessExp( "urUsmP2PEnablePeerAccessExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUsmP2PEnablePeerAccessExp\n"); + UR_LOG_L(logger, INFO, " ---> urUsmP2PEnablePeerAccessExp\n"); ur_result_t result = pfnEnablePeerAccessExp(commandDevice, peerDevice); @@ -9593,8 +9685,8 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PEnablePeerAccessExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP, ¶ms); - logger.info(" <--- urUsmP2PEnablePeerAccessExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urUsmP2PEnablePeerAccessExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9620,7 +9712,7 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PDisablePeerAccessExp( "urUsmP2PDisablePeerAccessExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUsmP2PDisablePeerAccessExp\n"); + UR_LOG_L(logger, INFO, " ---> urUsmP2PDisablePeerAccessExp\n"); ur_result_t result = pfnDisablePeerAccessExp(commandDevice, peerDevice); @@ -9632,8 +9724,8 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PDisablePeerAccessExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_USM_P2P_DISABLE_PEER_ACCESS_EXP, ¶ms); - logger.info(" <--- urUsmP2PDisablePeerAccessExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urUsmP2PDisablePeerAccessExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9674,7 +9766,7 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp( "urUsmP2PPeerAccessGetInfoExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urUsmP2PPeerAccessGetInfoExp\n"); + UR_LOG_L(logger, INFO, " ---> urUsmP2PPeerAccessGetInfoExp\n"); ur_result_t result = pfnPeerAccessGetInfoExp( commandDevice, peerDevice, propName, propSize, pPropValue, pPropSizeRet); @@ -9687,8 +9779,8 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP, ¶ms); - logger.info(" <--- urUsmP2PPeerAccessGetInfoExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urUsmP2PPeerAccessGetInfoExp({}) -> {};\n", + args_str.str(), result); } return result; @@ -9726,7 +9818,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrierExt( "urEnqueueEventsWaitWithBarrierExt", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueEventsWaitWithBarrierExt\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueEventsWaitWithBarrierExt\n"); ur_result_t result = pfnEventsWaitWithBarrierExt( hQueue, pProperties, numEventsInWaitList, phEventWaitList, phEvent); @@ -9739,8 +9831,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrierExt( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER_EXT, ¶ms); - logger.info(" <--- urEnqueueEventsWaitWithBarrierExt({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, + " <--- urEnqueueEventsWaitWithBarrierExt({}) -> {};\n", + args_str.str(), result); } return result; @@ -9798,7 +9891,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueNativeCommandExp( "urEnqueueNativeCommandExp", ¶ms); auto &logger = getContext()->logger; - logger.info(" ---> urEnqueueNativeCommandExp\n"); + UR_LOG_L(logger, INFO, " ---> urEnqueueNativeCommandExp\n"); ur_result_t result = pfnNativeCommandExp( hQueue, pfnNativeEnqueue, data, numMemsInMemList, phMemList, pProperties, @@ -9812,8 +9905,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueNativeCommandExp( std::ostringstream args_str; ur::extras::printFunctionParams( args_str, UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP, ¶ms); - logger.info(" <--- urEnqueueNativeCommandExp({}) -> {};\n", - args_str.str(), result); + UR_LOG_L(logger, INFO, " <--- urEnqueueNativeCommandExp({}) -> {};\n", + args_str.str(), result); } return result; diff --git a/unified-runtime/source/loader/layers/validation/ur_leak_check.hpp b/unified-runtime/source/loader/layers/validation/ur_leak_check.hpp index f9a82d258d98..b2d41f28e45c 100644 --- a/unified-runtime/source/loader/layers/validation/ur_leak_check.hpp +++ b/unified-runtime/source/loader/layers/validation/ur_leak_check.hpp @@ -68,14 +68,17 @@ struct RefCountContext { ptr, RefRuntimeInfo{1, std::type_index(typeid(handle)), getCurrentBacktrace()}); } else { - getContext()->logger.error("Handle {} already exists", ptr); + getContext()->logger.log(UR_LOGGER_LEVEL_ERROR, SHORT_FILE, + UR_STR_(__LINE__), "Handle {} already exists", + ptr); return; } break; case REFCOUNT_INCREASE: if (it == counts.end()) { - getContext()->logger.error("Attempting to retain nonexistent handle {}", - ptr); + getContext()->logger.log( + UR_LOGGER_LEVEL_ERROR, SHORT_FILE, UR_STR_(__LINE__), + "Attempting to retain nonexistent handle {}", ptr); return; } else { it->second.refCount++; @@ -91,7 +94,8 @@ struct RefCountContext { } if (it->second.refCount < 0) { - getContext()->logger.error( + getContext()->logger.log( + UR_LOGGER_LEVEL_ERROR, SHORT_FILE, UR_STR_(__LINE__), "Attempting to release nonexistent handle {}", ptr); } else if (it->second.refCount == 0 && isAdapterHandle) { adapterCount--; @@ -99,8 +103,10 @@ struct RefCountContext { break; } - getContext()->logger.debug("Reference count for handle {} changed to {}", - ptr, it->second.refCount); + getContext()->logger.log(UR_LOGGER_LEVEL_DEBUG, SHORT_FILE, + UR_STR_(__LINE__), + "Reference count for handle {} changed to {}", ptr, + it->second.refCount); if (it->second.refCount == 0) { counts.erase(ptr); @@ -108,7 +114,7 @@ struct RefCountContext { // No more active adapters, so any references still held are leaked if (adapterCount == 0) { - logInvalidReferences(); + logInvalidReferences(SHORT_FILE, UR_STR_(__LINE__)); counts.clear(); } } @@ -143,25 +149,36 @@ struct RefCountContext { return (it->second.type == std::type_index(typeid(handle))); } - void logInvalidReferences() { + void logInvalidReferences(const char *filename, const char *lineno) { for (auto &[ptr, refRuntimeInfo] : counts) { - getContext()->logger.error("Retained {} reference(s) to handle {}", - refRuntimeInfo.refCount, ptr); - getContext()->logger.error("Handle {} was recorded for first time here:", - ptr); + getContext()->logger.log(UR_LOGGER_LEVEL_ERROR, filename, lineno, + "Retained {} reference(s) to handle {}", + refRuntimeInfo.refCount, ptr); + getContext()->logger.log( + UR_LOGGER_LEVEL_ERROR, filename, lineno, + "Handle {} was recorded for first time here:", ptr); for (size_t i = 0; i < refRuntimeInfo.backtrace.size(); i++) { - getContext()->logger.error("#{} {}", i, - refRuntimeInfo.backtrace[i].c_str()); + getContext()->logger.log(UR_LOGGER_LEVEL_ERROR, filename, lineno, + "#{} {}", i, + refRuntimeInfo.backtrace[i].c_str()); } } } - void logInvalidReference(void *ptr) { - getContext()->logger.error("There are no valid references to handle {}", - ptr); + void logInvalidReference(const char *filename, const char *lineno, + void *ptr) { + getContext()->logger.log(UR_LOGGER_LEVEL_ERROR, filename, lineno, + "There are no valid references to handle {}", ptr); } }; } // namespace ur_validation_layer +#define URLOG_CTX_INVALID_REFERENCE(ptr) \ + getContext()->refCountContext->logInvalidReference(SHORT_FILE, \ + UR_STR_(__LINE__), ptr); +#define URLOG_CTX_INVALID_REFERENCES() \ + getContext()->refCountContext->logInvalidReferences(SHORT_FILE, \ + UR_STR_(__LINE__)); + #endif /* UR_LEAK_CHECK_H */ diff --git a/unified-runtime/source/loader/layers/validation/ur_valddi.cpp b/unified-runtime/source/loader/layers/validation/ur_valddi.cpp index 87023c800e23..7d66d59622e7 100644 --- a/unified-runtime/source/loader/layers/validation/ur_valddi.cpp +++ b/unified-runtime/source/loader/layers/validation/ur_valddi.cpp @@ -136,7 +136,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetLastError( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hAdapter)) { - getContext()->refCountContext->logInvalidReference(hAdapter); + URLOG_CTX_INVALID_REFERENCE(hAdapter); } ur_result_t result = pfnAdapterGetLastError(hAdapter, ppMessage, pError); @@ -187,7 +187,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGetInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hAdapter)) { - getContext()->refCountContext->logInvalidReference(hAdapter); + URLOG_CTX_INVALID_REFERENCE(hAdapter); } ur_result_t result = @@ -227,7 +227,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallback( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hAdapter)) { - getContext()->refCountContext->logInvalidReference(hAdapter); + URLOG_CTX_INVALID_REFERENCE(hAdapter); } ur_result_t result = @@ -260,7 +260,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterSetLoggerCallbackLevel( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hAdapter)) { - getContext()->refCountContext->logInvalidReference(hAdapter); + URLOG_CTX_INVALID_REFERENCE(hAdapter); } ur_result_t result = pfnSetLoggerCallbackLevel(hAdapter, level); @@ -303,7 +303,7 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGet( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hAdapter)) { - getContext()->refCountContext->logInvalidReference(hAdapter); + URLOG_CTX_INVALID_REFERENCE(hAdapter); } ur_result_t result = pfnGet(hAdapter, NumEntries, phPlatforms, pNumPlatforms); @@ -439,7 +439,7 @@ __urdlllocal ur_result_t UR_APICALL urPlatformCreateWithNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hAdapter)) { - getContext()->refCountContext->logInvalidReference(hAdapter); + URLOG_CTX_INVALID_REFERENCE(hAdapter); } ur_result_t result = pfnCreateWithNativeHandle(hNativePlatform, hAdapter, @@ -579,7 +579,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = @@ -673,7 +673,7 @@ __urdlllocal ur_result_t UR_APICALL urDevicePartition( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnPartition(hDevice, pProperties, NumDevices, @@ -719,7 +719,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceSelectBinary( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = @@ -751,7 +751,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnGetNativeHandle(hDevice, phNativeDevice); @@ -787,7 +787,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceCreateWithNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hAdapter)) { - getContext()->refCountContext->logInvalidReference(hAdapter); + URLOG_CTX_INVALID_REFERENCE(hAdapter); } ur_result_t result = @@ -825,7 +825,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetGlobalTimestamps( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = @@ -966,7 +966,7 @@ __urdlllocal ur_result_t UR_APICALL urContextGetInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = @@ -998,7 +998,7 @@ __urdlllocal ur_result_t UR_APICALL urContextGetNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnGetNativeHandle(hContext, phNativeContext); @@ -1039,7 +1039,7 @@ __urdlllocal ur_result_t UR_APICALL urContextCreateWithNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hAdapter)) { - getContext()->refCountContext->logInvalidReference(hAdapter); + URLOG_CTX_INVALID_REFERENCE(hAdapter); } ur_result_t result = pfnCreateWithNativeHandle( @@ -1078,7 +1078,7 @@ __urdlllocal ur_result_t UR_APICALL urContextSetExtendedDeleter( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnSetExtendedDeleter(hContext, pfnDeleter, pUserData); @@ -1152,7 +1152,7 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreate( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = @@ -1215,7 +1215,7 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreate( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = @@ -1319,7 +1319,7 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferPartition( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBuffer)) { - getContext()->refCountContext->logInvalidReference(hBuffer); + URLOG_CTX_INVALID_REFERENCE(hBuffer); } ur_result_t result = @@ -1354,12 +1354,12 @@ __urdlllocal ur_result_t UR_APICALL urMemGetNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hMem)) { - getContext()->refCountContext->logInvalidReference(hMem); + URLOG_CTX_INVALID_REFERENCE(hMem); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnGetNativeHandle(hMem, hDevice, phNativeMem); @@ -1395,7 +1395,7 @@ __urdlllocal ur_result_t UR_APICALL urMemBufferCreateWithNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = @@ -1446,7 +1446,7 @@ __urdlllocal ur_result_t UR_APICALL urMemImageCreateWithNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnImageCreateWithNativeHandle( @@ -1502,7 +1502,7 @@ __urdlllocal ur_result_t UR_APICALL urMemGetInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hMemory)) { - getContext()->refCountContext->logInvalidReference(hMemory); + URLOG_CTX_INVALID_REFERENCE(hMemory); } ur_result_t result = @@ -1554,7 +1554,7 @@ __urdlllocal ur_result_t UR_APICALL urMemImageGetInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hMemory)) { - getContext()->refCountContext->logInvalidReference(hMemory); + URLOG_CTX_INVALID_REFERENCE(hMemory); } ur_result_t result = @@ -1597,7 +1597,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerCreate( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnCreate(hContext, pDesc, phSampler); @@ -1698,7 +1698,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerGetInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hSampler)) { - getContext()->refCountContext->logInvalidReference(hSampler); + URLOG_CTX_INVALID_REFERENCE(hSampler); } ur_result_t result = @@ -1730,7 +1730,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerGetNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hSampler)) { - getContext()->refCountContext->logInvalidReference(hSampler); + URLOG_CTX_INVALID_REFERENCE(hSampler); } ur_result_t result = pfnGetNativeHandle(hSampler, phNativeSampler); @@ -1766,7 +1766,7 @@ __urdlllocal ur_result_t UR_APICALL urSamplerCreateWithNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnCreateWithNativeHandle(hNativeSampler, hContext, @@ -1818,12 +1818,12 @@ __urdlllocal ur_result_t UR_APICALL urUSMHostAlloc( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(pool)) { - getContext()->refCountContext->logInvalidReference(pool); + URLOG_CTX_INVALID_REFERENCE(pool); } ur_result_t result = pfnHostAlloc(hContext, pUSMDesc, pool, size, ppMem); @@ -1875,17 +1875,17 @@ __urdlllocal ur_result_t UR_APICALL urUSMDeviceAlloc( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(pool)) { - getContext()->refCountContext->logInvalidReference(pool); + URLOG_CTX_INVALID_REFERENCE(pool); } ur_result_t result = @@ -1938,17 +1938,17 @@ __urdlllocal ur_result_t UR_APICALL urUSMSharedAlloc( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(pool)) { - getContext()->refCountContext->logInvalidReference(pool); + URLOG_CTX_INVALID_REFERENCE(pool); } ur_result_t result = @@ -1980,7 +1980,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMFree( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnFree(hContext, pMem); @@ -2023,7 +2023,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMGetMemAllocInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnGetMemAllocInfo(hContext, pMem, propName, propSize, @@ -2064,7 +2064,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolCreate( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnPoolCreate(hContext, pPoolDesc, ppPool); @@ -2165,7 +2165,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hPool)) { - getContext()->refCountContext->logInvalidReference(hPool); + URLOG_CTX_INVALID_REFERENCE(hPool); } ur_result_t result = @@ -2221,12 +2221,12 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemGranularityGetInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnGranularityGetInfo( @@ -2265,7 +2265,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemReserve( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnReserve(hContext, pStart, size, ppStart); @@ -2298,7 +2298,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemFree( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnFree(hContext, pStart, size); @@ -2343,12 +2343,12 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemMap( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hPhysicalMem)) { - getContext()->refCountContext->logInvalidReference(hPhysicalMem); + URLOG_CTX_INVALID_REFERENCE(hPhysicalMem); } ur_result_t result = @@ -2382,7 +2382,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemUnmap( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnUnmap(hContext, pStart, size); @@ -2420,7 +2420,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemSetAccess( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnSetAccess(hContext, pStart, size, flags); @@ -2468,7 +2468,7 @@ __urdlllocal ur_result_t UR_APICALL urVirtualMemGetInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnGetInfo(hContext, pStart, size, propName, propSize, @@ -2513,12 +2513,12 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemCreate( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = @@ -2614,7 +2614,7 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemGetInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hPhysicalMem)) { - getContext()->refCountContext->logInvalidReference(hPhysicalMem); + URLOG_CTX_INVALID_REFERENCE(hPhysicalMem); } ur_result_t result = @@ -2666,7 +2666,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithIL( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = @@ -2736,7 +2736,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithBinary( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = @@ -2775,12 +2775,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuild( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = pfnBuild(hContext, hProgram, pOptions); @@ -2813,12 +2813,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramCompile( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = pfnCompile(hContext, hProgram, pOptions); @@ -2864,7 +2864,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramLink( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = @@ -2959,12 +2959,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetFunctionPointer( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = pfnGetFunctionPointer(hDevice, hProgram, pFunctionName, @@ -3011,12 +3011,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetGlobalVariablePointer( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = pfnGetGlobalVariablePointer( @@ -3070,7 +3070,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = @@ -3118,12 +3118,12 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetBuildInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnGetBuildInfo(hProgram, hDevice, propName, propSize, @@ -3162,7 +3162,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramSetSpecializationConstants( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = @@ -3194,7 +3194,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramGetNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = pfnGetNativeHandle(hProgram, phNativeProgram); @@ -3230,7 +3230,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCreateWithNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnCreateWithNativeHandle(hNativeProgram, hContext, @@ -3271,7 +3271,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreate( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = pfnCreate(hProgram, pKernelName, phKernel); @@ -3314,7 +3314,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgValue( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } ur_result_t result = @@ -3347,7 +3347,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgLocal( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } ur_result_t result = pfnSetArgLocal(hKernel, argIndex, argSize, pProperties); @@ -3399,7 +3399,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } ur_result_t result = @@ -3444,12 +3444,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetGroupInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnGetGroupInfo(hKernel, hDevice, propName, propSize, @@ -3494,12 +3494,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetSubGroupInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnGetSubGroupInfo(hKernel, hDevice, propName, propSize, @@ -3583,7 +3583,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgPointer( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } ur_result_t result = @@ -3625,7 +3625,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetExecInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } ur_result_t result = @@ -3661,12 +3661,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgSampler( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hArgValue)) { - getContext()->refCountContext->logInvalidReference(hArgValue); + URLOG_CTX_INVALID_REFERENCE(hArgValue); } ur_result_t result = @@ -3702,12 +3702,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgMemObj( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hArgValue)) { - getContext()->refCountContext->logInvalidReference(hArgValue); + URLOG_CTX_INVALID_REFERENCE(hArgValue); } ur_result_t result = @@ -3745,7 +3745,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetSpecializationConstants( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } ur_result_t result = @@ -3777,7 +3777,7 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } ur_result_t result = pfnGetNativeHandle(hKernel, phNativeKernel); @@ -3815,12 +3815,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelCreateWithNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = pfnCreateWithNativeHandle( @@ -3879,12 +3879,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelGetSuggestedLocalWorkSize( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = pfnGetSuggestedLocalWorkSize( @@ -3933,7 +3933,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueGetInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = @@ -3985,12 +3985,12 @@ __urdlllocal ur_result_t UR_APICALL urQueueCreate( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnCreate(hContext, hDevice, pProperties, phQueue); @@ -4077,7 +4077,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueGetNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = pfnGetNativeHandle(hQueue, pDesc, phNativeQueue); @@ -4115,12 +4115,12 @@ __urdlllocal ur_result_t UR_APICALL urQueueCreateWithNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnCreateWithNativeHandle(hNativeQueue, hContext, @@ -4151,7 +4151,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueFinish( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = pfnFinish(hQueue); @@ -4177,7 +4177,7 @@ __urdlllocal ur_result_t UR_APICALL urQueueFlush( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = pfnFlush(hQueue); @@ -4224,7 +4224,7 @@ __urdlllocal ur_result_t UR_APICALL urEventGetInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hEvent)) { - getContext()->refCountContext->logInvalidReference(hEvent); + URLOG_CTX_INVALID_REFERENCE(hEvent); } ur_result_t result = @@ -4267,7 +4267,7 @@ __urdlllocal ur_result_t UR_APICALL urEventGetProfilingInfo( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hEvent)) { - getContext()->refCountContext->logInvalidReference(hEvent); + URLOG_CTX_INVALID_REFERENCE(hEvent); } ur_result_t result = @@ -4376,7 +4376,7 @@ __urdlllocal ur_result_t UR_APICALL urEventGetNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hEvent)) { - getContext()->refCountContext->logInvalidReference(hEvent); + URLOG_CTX_INVALID_REFERENCE(hEvent); } ur_result_t result = pfnGetNativeHandle(hEvent, phNativeEvent); @@ -4412,7 +4412,7 @@ __urdlllocal ur_result_t UR_APICALL urEventCreateWithNativeHandle( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = @@ -4459,7 +4459,7 @@ __urdlllocal ur_result_t UR_APICALL urEventSetCallback( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hEvent)) { - getContext()->refCountContext->logInvalidReference(hEvent); + URLOG_CTX_INVALID_REFERENCE(hEvent); } ur_result_t result = pfnSetCallback(hEvent, execStatus, pfnNotify, pUserData); @@ -4537,12 +4537,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } ur_result_t result = pfnKernelLaunch( @@ -4601,7 +4601,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWait( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = @@ -4660,7 +4660,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = pfnEventsWaitWithBarrier(hQueue, numEventsInWaitList, @@ -4740,12 +4740,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBuffer)) { - getContext()->refCountContext->logInvalidReference(hBuffer); + URLOG_CTX_INVALID_REFERENCE(hBuffer); } ur_result_t result = @@ -4826,12 +4826,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBuffer)) { - getContext()->refCountContext->logInvalidReference(hBuffer); + URLOG_CTX_INVALID_REFERENCE(hBuffer); } ur_result_t result = @@ -4954,12 +4954,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBuffer)) { - getContext()->refCountContext->logInvalidReference(hBuffer); + URLOG_CTX_INVALID_REFERENCE(hBuffer); } ur_result_t result = pfnMemBufferReadRect( @@ -5084,12 +5084,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBuffer)) { - getContext()->refCountContext->logInvalidReference(hBuffer); + URLOG_CTX_INVALID_REFERENCE(hBuffer); } ur_result_t result = pfnMemBufferWriteRect( @@ -5178,17 +5178,17 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBufferSrc)) { - getContext()->refCountContext->logInvalidReference(hBufferSrc); + URLOG_CTX_INVALID_REFERENCE(hBufferSrc); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBufferDst)) { - getContext()->refCountContext->logInvalidReference(hBufferDst); + URLOG_CTX_INVALID_REFERENCE(hBufferDst); } ur_result_t result = @@ -5312,17 +5312,17 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBufferSrc)) { - getContext()->refCountContext->logInvalidReference(hBufferSrc); + URLOG_CTX_INVALID_REFERENCE(hBufferSrc); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBufferDst)) { - getContext()->refCountContext->logInvalidReference(hBufferDst); + URLOG_CTX_INVALID_REFERENCE(hBufferDst); } ur_result_t result = pfnMemBufferCopyRect( @@ -5419,12 +5419,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBuffer)) { - getContext()->refCountContext->logInvalidReference(hBuffer); + URLOG_CTX_INVALID_REFERENCE(hBuffer); } ur_result_t result = @@ -5513,12 +5513,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hImage)) { - getContext()->refCountContext->logInvalidReference(hImage); + URLOG_CTX_INVALID_REFERENCE(hImage); } ur_result_t result = pfnMemImageRead( @@ -5607,12 +5607,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hImage)) { - getContext()->refCountContext->logInvalidReference(hImage); + URLOG_CTX_INVALID_REFERENCE(hImage); } ur_result_t result = pfnMemImageWrite( @@ -5706,17 +5706,17 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hImageSrc)) { - getContext()->refCountContext->logInvalidReference(hImageSrc); + URLOG_CTX_INVALID_REFERENCE(hImageSrc); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hImageDst)) { - getContext()->refCountContext->logInvalidReference(hImageDst); + URLOG_CTX_INVALID_REFERENCE(hImageDst); } ur_result_t result = @@ -5803,12 +5803,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferMap( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBuffer)) { - getContext()->refCountContext->logInvalidReference(hBuffer); + URLOG_CTX_INVALID_REFERENCE(hBuffer); } ur_result_t result = @@ -5876,12 +5876,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemUnmap( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hMem)) { - getContext()->refCountContext->logInvalidReference(hMem); + URLOG_CTX_INVALID_REFERENCE(hMem); } ur_result_t result = pfnMemUnmap( @@ -5969,7 +5969,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = @@ -6058,7 +6058,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = @@ -6138,7 +6138,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = pfnUSMPrefetch( @@ -6195,7 +6195,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMAdvise( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = pfnUSMAdvise(hQueue, pMem, size, advice, phEvent); @@ -6303,7 +6303,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = @@ -6407,7 +6407,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = @@ -6483,12 +6483,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableWrite( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = pfnDeviceGlobalVariableWrite( @@ -6569,12 +6569,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableRead( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = pfnDeviceGlobalVariableRead( @@ -6656,12 +6656,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueReadHostPipe( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = @@ -6744,12 +6744,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = @@ -6815,12 +6815,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMDeviceAllocExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(pPool)) { - getContext()->refCountContext->logInvalidReference(pPool); + URLOG_CTX_INVALID_REFERENCE(pPool); } ur_result_t result = pfnUSMDeviceAllocExp(hQueue, pPool, size, pProperties, @@ -6886,12 +6886,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMSharedAllocExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(pPool)) { - getContext()->refCountContext->logInvalidReference(pPool); + URLOG_CTX_INVALID_REFERENCE(pPool); } ur_result_t result = pfnUSMSharedAllocExp(hQueue, pPool, size, pProperties, @@ -6957,12 +6957,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMHostAllocExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(pPool)) { - getContext()->refCountContext->logInvalidReference(pPool); + URLOG_CTX_INVALID_REFERENCE(pPool); } ur_result_t result = @@ -7019,12 +7019,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFreeExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(pPool)) { - getContext()->refCountContext->logInvalidReference(pPool); + URLOG_CTX_INVALID_REFERENCE(pPool); } ur_result_t result = pfnUSMFreeExp(hQueue, pPool, pMem, numEventsInWaitList, @@ -7075,12 +7075,12 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolCreateExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnPoolCreateExp(hContext, hDevice, pPoolDesc, pPool); @@ -7120,17 +7120,17 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolDestroyExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hPool)) { - getContext()->refCountContext->logInvalidReference(hPool); + URLOG_CTX_INVALID_REFERENCE(hPool); } ur_result_t result = pfnPoolDestroyExp(hContext, hDevice, hPool); @@ -7167,12 +7167,12 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetDefaultDevicePoolExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnPoolGetDefaultDevicePoolExp(hContext, hDevice, pPool); @@ -7210,7 +7210,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetInfoExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hPool)) { - getContext()->refCountContext->logInvalidReference(hPool); + URLOG_CTX_INVALID_REFERENCE(hPool); } ur_result_t result = @@ -7249,7 +7249,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolSetInfoExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hPool)) { - getContext()->refCountContext->logInvalidReference(hPool); + URLOG_CTX_INVALID_REFERENCE(hPool); } ur_result_t result = pfnPoolSetInfoExp(hPool, propName, pPropValue, propSize); @@ -7286,17 +7286,17 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolSetDevicePoolExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hPool)) { - getContext()->refCountContext->logInvalidReference(hPool); + URLOG_CTX_INVALID_REFERENCE(hPool); } ur_result_t result = pfnPoolSetDevicePoolExp(hContext, hDevice, hPool); @@ -7333,12 +7333,12 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolGetDevicePoolExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnPoolGetDevicePoolExp(hContext, hDevice, pPool); @@ -7376,17 +7376,17 @@ __urdlllocal ur_result_t UR_APICALL urUSMPoolTrimToExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hPool)) { - getContext()->refCountContext->logInvalidReference(hPool); + URLOG_CTX_INVALID_REFERENCE(hPool); } ur_result_t result = @@ -7448,17 +7448,17 @@ __urdlllocal ur_result_t UR_APICALL urUSMPitchedAllocExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(pool)) { - getContext()->refCountContext->logInvalidReference(pool); + URLOG_CTX_INVALID_REFERENCE(pool); } ur_result_t result = @@ -7496,12 +7496,12 @@ urBindlessImagesUnsampledImageHandleDestroyExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = @@ -7538,12 +7538,12 @@ urBindlessImagesSampledImageHandleDestroyExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = @@ -7594,12 +7594,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnImageAllocateExp(hContext, hDevice, pImageFormat, @@ -7634,12 +7634,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageFreeExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnImageFreeExp(hContext, hDevice, hImageMem); @@ -7691,12 +7691,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnUnsampledImageCreateExp( @@ -7754,17 +7754,17 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hSampler)) { - getContext()->refCountContext->logInvalidReference(hSampler); + URLOG_CTX_INVALID_REFERENCE(hSampler); } ur_result_t result = @@ -7860,7 +7860,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = pfnImageCopyExp( @@ -7904,7 +7904,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnImageGetInfoExp(hContext, hImageMem, propName, @@ -7946,12 +7946,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnMipmapGetLevelExp(hContext, hDevice, hImageMem, @@ -7986,12 +7986,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnMipmapFreeExp(hContext, hDevice, hMem); @@ -8040,12 +8040,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportExternalMemoryExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnImportExternalMemoryExp( @@ -8101,12 +8101,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnMapExternalArrayExp( @@ -8153,12 +8153,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesMapExternalLinearMemoryExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnMapExternalLinearMemoryExp( @@ -8196,12 +8196,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalMemoryExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = @@ -8249,12 +8249,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImportExternalSemaphoreExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnImportExternalSemaphoreExp( @@ -8293,12 +8293,12 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesReleaseExternalSemaphoreExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = @@ -8358,7 +8358,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesWaitExternalSemaphoreExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = pfnWaitExternalSemaphoreExp( @@ -8419,7 +8419,7 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSignalExternalSemaphoreExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = pfnSignalExternalSemaphoreExp( @@ -8462,12 +8462,12 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferCreateExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = @@ -8635,7 +8635,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } ur_result_t result = pfnAppendKernelLaunchExp( @@ -8887,12 +8887,12 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hSrcMem)) { - getContext()->refCountContext->logInvalidReference(hSrcMem); + URLOG_CTX_INVALID_REFERENCE(hSrcMem); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDstMem)) { - getContext()->refCountContext->logInvalidReference(hDstMem); + URLOG_CTX_INVALID_REFERENCE(hDstMem); } ur_result_t result = pfnAppendMemBufferCopyExp( @@ -8975,7 +8975,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBuffer)) { - getContext()->refCountContext->logInvalidReference(hBuffer); + URLOG_CTX_INVALID_REFERENCE(hBuffer); } ur_result_t result = pfnAppendMemBufferWriteExp( @@ -9058,7 +9058,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBuffer)) { - getContext()->refCountContext->logInvalidReference(hBuffer); + URLOG_CTX_INVALID_REFERENCE(hBuffer); } ur_result_t result = pfnAppendMemBufferReadExp( @@ -9151,12 +9151,12 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hSrcMem)) { - getContext()->refCountContext->logInvalidReference(hSrcMem); + URLOG_CTX_INVALID_REFERENCE(hSrcMem); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDstMem)) { - getContext()->refCountContext->logInvalidReference(hDstMem); + URLOG_CTX_INVALID_REFERENCE(hDstMem); } ur_result_t result = pfnAppendMemBufferCopyRectExp( @@ -9253,7 +9253,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBuffer)) { - getContext()->refCountContext->logInvalidReference(hBuffer); + URLOG_CTX_INVALID_REFERENCE(hBuffer); } ur_result_t result = pfnAppendMemBufferWriteRectExp( @@ -9349,7 +9349,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBuffer)) { - getContext()->refCountContext->logInvalidReference(hBuffer); + URLOG_CTX_INVALID_REFERENCE(hBuffer); } ur_result_t result = pfnAppendMemBufferReadRectExp( @@ -9435,7 +9435,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hBuffer)) { - getContext()->refCountContext->logInvalidReference(hBuffer); + URLOG_CTX_INVALID_REFERENCE(hBuffer); } ur_result_t result = pfnAppendMemBufferFillExp( @@ -9705,7 +9705,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCommandBufferExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = pfnCommandBufferExp( @@ -9969,12 +9969,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } ur_result_t result = pfnCooperativeKernelLaunchExp( @@ -10031,12 +10031,12 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hDevice)) { - getContext()->refCountContext->logInvalidReference(hDevice); + URLOG_CTX_INVALID_REFERENCE(hDevice); } ur_result_t result = pfnSuggestMaxCooperativeGroupCountExp( @@ -10104,7 +10104,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueTimestampRecordingExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = pfnTimestampRecordingExp( @@ -10190,12 +10190,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hKernel)) { - getContext()->refCountContext->logInvalidReference(hKernel); + URLOG_CTX_INVALID_REFERENCE(hKernel); } ur_result_t result = pfnKernelLaunchCustomExp( @@ -10238,7 +10238,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuildExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = pfnBuildExp(hProgram, numDevices, phDevices, pOptions); @@ -10273,7 +10273,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramCompileExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hProgram)) { - getContext()->refCountContext->logInvalidReference(hProgram); + URLOG_CTX_INVALID_REFERENCE(hProgram); } ur_result_t result = pfnCompileExp(hProgram, numDevices, phDevices, pOptions); @@ -10326,7 +10326,7 @@ __urdlllocal ur_result_t UR_APICALL urProgramLinkExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnLinkExp(hContext, numDevices, phDevices, count, @@ -10360,7 +10360,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMImportExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnImportExp(hContext, pMem, size); @@ -10391,7 +10391,7 @@ __urdlllocal ur_result_t UR_APICALL urUSMReleaseExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hContext)) { - getContext()->refCountContext->logInvalidReference(hContext); + URLOG_CTX_INVALID_REFERENCE(hContext); } ur_result_t result = pfnReleaseExp(hContext, pMem); @@ -10423,12 +10423,12 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PEnablePeerAccessExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(commandDevice)) { - getContext()->refCountContext->logInvalidReference(commandDevice); + URLOG_CTX_INVALID_REFERENCE(commandDevice); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(peerDevice)) { - getContext()->refCountContext->logInvalidReference(peerDevice); + URLOG_CTX_INVALID_REFERENCE(peerDevice); } ur_result_t result = pfnEnablePeerAccessExp(commandDevice, peerDevice); @@ -10460,12 +10460,12 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PDisablePeerAccessExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(commandDevice)) { - getContext()->refCountContext->logInvalidReference(commandDevice); + URLOG_CTX_INVALID_REFERENCE(commandDevice); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(peerDevice)) { - getContext()->refCountContext->logInvalidReference(peerDevice); + URLOG_CTX_INVALID_REFERENCE(peerDevice); } ur_result_t result = pfnDisablePeerAccessExp(commandDevice, peerDevice); @@ -10523,12 +10523,12 @@ __urdlllocal ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(commandDevice)) { - getContext()->refCountContext->logInvalidReference(commandDevice); + URLOG_CTX_INVALID_REFERENCE(commandDevice); } if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(peerDevice)) { - getContext()->refCountContext->logInvalidReference(peerDevice); + URLOG_CTX_INVALID_REFERENCE(peerDevice); } ur_result_t result = pfnPeerAccessGetInfoExp( @@ -10588,7 +10588,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrierExt( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = pfnEventsWaitWithBarrierExt( @@ -10663,7 +10663,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueNativeCommandExp( if (getContext()->enableLifetimeValidation && !getContext()->refCountContext->isReferenceValid(hQueue)) { - getContext()->refCountContext->logInvalidReference(hQueue); + URLOG_CTX_INVALID_REFERENCE(hQueue); } ur_result_t result = pfnNativeCommandExp( @@ -12175,7 +12175,7 @@ ur_result_t context_t::init(ur_dditable_t *dditable, ur_result_t context_t::tearDown() { if (enableLeakChecking) { - getContext()->refCountContext->logInvalidReferences(); + URLOG_CTX_INVALID_REFERENCES(); } return UR_RESULT_SUCCESS; diff --git a/unified-runtime/source/loader/layers/validation/ur_validation_layer.cpp b/unified-runtime/source/loader/layers/validation/ur_validation_layer.cpp index 4e47e102c73b..8d44badc74b3 100644 --- a/unified-runtime/source/loader/layers/validation/ur_validation_layer.cpp +++ b/unified-runtime/source/loader/layers/validation/ur_validation_layer.cpp @@ -33,8 +33,8 @@ context_t::~context_t() {} result == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) \ return UR_RESULT_SUCCESS; \ if (result != UR_RESULT_SUCCESS) { \ - getContext()->logger.error("Unexpected non-success result code from {}", \ - #result); \ + UR_LOG_L(getContext()->logger, ERR, \ + "Unexpected non-success result code from {}", #result); \ assert(0); \ return result; \ } diff --git a/unified-runtime/source/loader/ur_adapter_registry.hpp b/unified-runtime/source/loader/ur_adapter_registry.hpp index 53fed55ea0c8..f7e33c7aa86a 100644 --- a/unified-runtime/source/loader/ur_adapter_registry.hpp +++ b/unified-runtime/source/loader/ur_adapter_registry.hpp @@ -49,9 +49,9 @@ struct FilterTerm { auto backendIter = backendNameMap.find(backend); if (backendIter == backendNameMap.end()) { - logger::debug( - "ONEAPI_DEVICE_SELECTOR Pre-Filter with illegal backend '{}' ", - backend); + UR_LOG(DEBUG, + "ONEAPI_DEVICE_SELECTOR Pre-Filter with illegal backend '{}' ", + backend); return false; } if (backendIter->second == match_backend) { @@ -74,9 +74,9 @@ struct FilterTerm { } auto deviceIter = deviceTypeMap.find(deviceString); if (deviceIter == deviceTypeMap.end()) { - logger::debug( - "ONEAPI_DEVICE_SELECTOR Pre-Filter with illegal device '{}' ", - deviceString); + UR_LOG(DEBUG, + "ONEAPI_DEVICE_SELECTOR Pre-Filter with illegal device '{}' ", + deviceString); continue; } if (deviceIter->second == match_device) { @@ -102,16 +102,17 @@ class AdapterRegistry { try { forceLoadedAdaptersOpt = getenv_to_vec("UR_ADAPTERS_FORCE_LOAD"); } catch (const std::invalid_argument &e) { - logger::error(e.what()); + UR_LOG(ERR, e.what()); } if (forceLoadedAdaptersOpt.has_value()) { for (const auto &s : forceLoadedAdaptersOpt.value()) { auto path = fs::path(s); if (path.filename().extension() == STATIC_LIBRARY_EXTENSION) { - logger::warning("UR_ADAPTERS_FORCE_LOAD contains a path to a static" - "library {}, it will be skipped", - s); + UR_LOG(WARN, + "UR_ADAPTERS_FORCE_LOAD contains a path to a static" + "library {}, it will be skipped", + s); continue; } @@ -119,16 +120,17 @@ class AdapterRegistry { try { exists = fs::exists(path); } catch (std::exception &e) { - logger::error(e.what()); + UR_LOG(ERR, e.what()); } if (exists) { forceLoaded = true; adaptersLoadPaths.emplace_back(std::vector{std::move(path)}); } else { - logger::warning("Detected nonexistent path {} in environment " - "variable UR_ADAPTERS_FORCE_LOAD", - s); + UR_LOG(WARN, + "Detected nonexistent path {} in environment " + "variable UR_ADAPTERS_FORCE_LOAD", + s); } } } else { @@ -203,7 +205,7 @@ class AdapterRegistry { try { pathStringsOpt = getenv_to_vec("UR_ADAPTERS_SEARCH_PATH"); } catch (const std::invalid_argument &e) { - logger::error(e.what()); + UR_LOG(ERR, e.what()); return std::nullopt; } @@ -214,9 +216,10 @@ class AdapterRegistry { if (fs::exists(path)) { paths.emplace_back(path); } else { - logger::warning("Detected nonexistent path {} in environmental " - "variable UR_ADAPTERS_SEARCH_PATH", - s); + UR_LOG(WARN, + "Detected nonexistent path {} in environmental " + "variable UR_ADAPTERS_SEARCH_PATH", + s); } } } @@ -232,12 +235,12 @@ class AdapterRegistry { } catch (...) { // If the selector is malformed, then we ignore selector and return // success. - logger::error("ERROR: missing backend, format of filter = " - "'[!]backend:filterStrings'"); + UR_LOG(ERR, "ERROR: missing backend, format of filter = " + "'[!]backend:filterStrings'"); odsEnvMap = std::nullopt; } - logger::debug("getenv_to_map parsed env var and {} a map", - (odsEnvMap.has_value() ? "produced" : "failed to produce")); + UR_LOG(DEBUG, "getenv_to_map parsed env var and {} a map", + (odsEnvMap.has_value() ? "produced" : "failed to produce")); // if the ODS env var is not set at all, then pretend it was set to the // default @@ -273,17 +276,24 @@ class AdapterRegistry { std::string backend = termPair.first; // TODO: Figure out how to process all ODS errors rather than returning // on the first error. - logger::debug("ONEAPI_DEVICE_SELECTOR Pre-Filter with backend '{}' ", - backend); + if (backend.empty()) { + // FIXME: never true because getenv_to_map rejects this case + // malformed term: missing backend -- output ERR, then continue + UR_LOG(ERR, "ERROR: missing backend, format of filter = " + "'[!]backend:filterStrings'"); + continue; + } + UR_LOG(DEBUG, "ONEAPI_DEVICE_SELECTOR Pre-Filter with backend '{}' ", + backend); bool PositiveFilter = backend.front() != '!'; - logger::debug("term is a {} filter", - (PositiveFilter ? "positive" : "negative")); + UR_LOG(DEBUG, "term is a {} filter", + (PositiveFilter ? "positive" : "negative")); if (!PositiveFilter) { - logger::debug("DEBUG: backend was '{}'", backend); + UR_LOG(DEBUG, "DEBUG: backend was '{}'", backend); // Trim off the "!" from the backend backend.erase(backend.cbegin()); - logger::debug("DEBUG: backend now '{}'", backend); + UR_LOG(DEBUG, "DEBUG: backend now '{}'", backend); } // Make sure the backend is lower case @@ -352,10 +362,10 @@ class AdapterRegistry { std::string(adapterName).find("v2") != std::string::npos; if (v2Requested != v2Adapter) { - logger::info( - "The adapter '{}' is skipped because {} {}.", adapterName, - "UR_LOADER_USE_LEVEL_ZERO_V2 or SYCL_UR_USE_LEVEL_ZERO_V2", - v2Requested ? "is set" : "is not set"); + UR_LOG(INFO, "The adapter '{}' is skipped because {} {}.", + adapterName, + "UR_LOADER_USE_LEVEL_ZERO_V2 or SYCL_UR_USE_LEVEL_ZERO_V2", + v2Requested ? "is set" : "is not set"); continue; } } diff --git a/unified-runtime/source/loader/ur_lib.cpp b/unified-runtime/source/loader/ur_lib.cpp index 8163be0fbaeb..6a2aef2f2b06 100644 --- a/unified-runtime/source/loader/ur_lib.cpp +++ b/unified-runtime/source/loader/ur_lib.cpp @@ -76,7 +76,7 @@ __urdlllocal ur_result_t context_t::Init( ur_result_t result; const char *logger_name = "loader"; logger::init(logger_name); - logger::debug("Logger {} initialized successfully!", logger_name); + UR_LOG(DEBUG, "Logger {} initialized successfully!", logger_name); result = ur_loader::getContext()->init(); @@ -215,7 +215,7 @@ ur_result_t urLoaderTearDown() { ur_result_t result = ret == 0 ? UR_RESULT_SUCCESS : UR_RESULT_ERROR_UNINITIALIZED; - logger::info("---> urLoaderTearDown() -> {}", result); + UR_LOG(INFO, "---> urLoaderTearDown() -> {}", result); return result; } @@ -336,12 +336,11 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, getenv_to_map("ONEAPI_DEVICE_SELECTOR", /* reject_empty= */ false, /* allow_duplicate= */ false, /* lower= */ true); } catch (...) { - logger::error("ERROR: could not parse ONEAPI_DEVICE_SELECTOR string"); + UR_LOG(ERR, "ERROR: could not parse ONEAPI_DEVICE_SELECTOR string"); return UR_RESULT_ERROR_INVALID_VALUE; } - logger::debug( - "getenv_to_map parsed env var and {} a map", - (maybeEnvVarMap.has_value() ? "produced" : "failed to produce")); + UR_LOG(DEBUG, "getenv_to_map parsed env var and {} a map", + (maybeEnvVarMap.has_value() ? "produced" : "failed to produce")); // if the ODS env var is not set at all, then pretend it was set to the // default @@ -448,23 +447,22 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, if (backend.empty()) { // FIXME: never true because getenv_to_map rejects this case // malformed term: missing backend -- output ERROR, then continue - logger::error("ERROR: missing backend, format of filter = " - "'[!]backend:filterStrings'"); + UR_LOG(ERR, "ERROR: missing backend, format of filter = " + "'[!]backend:filterStrings'"); continue; } enum FilterType { AcceptFilter, DiscardFilter, } termType = (backend.front() != '!') ? AcceptFilter : DiscardFilter; - logger::debug( - "termType is {}", - (termType != AcceptFilter ? "DiscardFilter" : "AcceptFilter")); + UR_LOG(DEBUG, "termType is {}", + (termType != AcceptFilter ? "DiscardFilter" : "AcceptFilter")); auto &deviceList = (termType != AcceptFilter) ? discardDeviceList : acceptDeviceList; if (termType != AcceptFilter) { - logger::debug("DEBUG: backend was '{}'", backend); + UR_LOG(DEBUG, "DEBUG: backend was '{}'", backend); backend.erase(backend.cbegin()); - logger::debug("DEBUG: backend now '{}'", backend); + UR_LOG(DEBUG, "DEBUG: backend now '{}'", backend); } // Note the hPlatform -> platformBackend -> platformBackendName conversion // above guarantees minimal sanity for the comparison with backend from the @@ -475,7 +473,7 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, [&](auto &p) { return p.second == backend; }); if (found == cend) { // It's not a legal backend - logger::error("unrecognised backend '{}'", backend); + UR_LOG(ERR, "unrecognised backend '{}'", backend); return UR_RESULT_ERROR_INVALID_VALUE; } else if (found->first != platformBackend) { // If it's a rule for a different backend, ignore it @@ -484,8 +482,8 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, } if (termPair.second.size() == 0) { // malformed term: missing filterStrings -- output ERROR - logger::error("missing filterStrings, format of filter = " - "'[!]backend:filterStrings'"); + UR_LOG(ERR, "missing filterStrings, format of filter = " + "'[!]backend:filterStrings'"); return UR_RESULT_ERROR_INVALID_VALUE; } if (std::find_if(termPair.second.cbegin(), termPair.second.cend(), @@ -493,8 +491,8 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, termPair.second.cend()) { // FIXME: never true because getenv_to_map rejects this case // malformed term: missing filterString -- output warning, then continue - logger::warning("WARNING: empty filterString, format of filterStrings " - "= 'filterString[,filterString[,...]]'"); + UR_LOG(WARN, "WARNING: empty filterString, format of filterStrings " + "= 'filterString[,filterString[,...]]'"); continue; } if (std::find_if(termPair.second.cbegin(), termPair.second.cend(), @@ -502,8 +500,8 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, return std::count(s.cbegin(), s.cend(), '.') > 2; }) != termPair.second.cend()) { // malformed term: too many dots in filterString - logger::error("too many dots in filterString, format of " - "filterString = 'root[.sub[.subsub]]'"); + UR_LOG(ERR, "too many dots in filterString, format of " + "filterString = 'root[.sub[.subsub]]'"); return UR_RESULT_ERROR_INVALID_VALUE; } if (std::find_if(termPair.second.cbegin(), termPair.second.cend(), @@ -524,7 +522,7 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, return false; // no BAD things, so must be okay }) != termPair.second.cend()) { // malformed term: star dot no-star in filterString - logger::error("invalid wildcard in filterString, '*.' => '*.*'"); + UR_LOG(ERR, "invalid wildcard in filterString, '*.' => '*.*'"); return UR_RESULT_ERROR_INVALID_VALUE; } @@ -587,10 +585,10 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, 0, 0, nullptr}); } - logger::debug("DEBUG: size of acceptDeviceList = {}", - acceptDeviceList.size()); - logger::debug("DEBUG: size of discardDeviceList = {}", - discardDeviceList.size()); + UR_LOG(DEBUG, "DEBUG: size of acceptDeviceList = {}", + acceptDeviceList.size()); + UR_LOG(DEBUG, "DEBUG: size of discardDeviceList = {}", + discardDeviceList.size()); std::vector rootDevices; std::vector subDevices; @@ -750,50 +748,50 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, // is a subsubdevice filter, then it must be '*.*.*' matches = (filter.hwType == device.hwType) || (filter.hwType == DeviceHardwareType::UR_DEVICE_TYPE_ALL); - logger::debug("DEBUG: In ApplyFilter, if block case 1, matches = {}", - matches); + UR_LOG(DEBUG, "DEBUG: In ApplyFilter, if block case 1, matches = {}", + matches); } else if (filter.rootId != device.rootId) { // root part in filter is a number but does not match the number in the // root part of device matches = false; - logger::debug("DEBUG: In ApplyFilter, if block case 2, matches = ", - matches); + UR_LOG(DEBUG, + "DEBUG: In ApplyFilter, if block case 2, matches = ", matches); } else if (filter.level == DevicePartLevel::ROOT) { // this is a root device filter with a number that matches matches = true; - logger::debug("DEBUG: In ApplyFilter, if block case 3, matches = ", - matches); + UR_LOG(DEBUG, + "DEBUG: In ApplyFilter, if block case 3, matches = ", matches); } else if (filter.subId == DeviceIdTypeALL) { // sub type of star always matches (when root part matches, which we // already know here) if this is a subdevice filter, then it must be // 'matches.*' if this is a subsubdevice filter, then it must be // 'matches.*.*' matches = true; - logger::debug("DEBUG: In ApplyFilter, if block case 4, matches = ", - matches); + UR_LOG(DEBUG, + "DEBUG: In ApplyFilter, if block case 4, matches = ", matches); } else if (filter.subId != device.subId) { // sub part in filter is a number but does not match the number in the sub // part of device matches = false; - logger::debug("DEBUG: In ApplyFilter, if block case 5, matches = ", - matches); + UR_LOG(DEBUG, + "DEBUG: In ApplyFilter, if block case 5, matches = ", matches); } else if (filter.level == DevicePartLevel::SUB) { // this is a sub device number filter, numbers match in both parts matches = true; - logger::debug("DEBUG: In ApplyFilter, if block case 6, matches = ", - matches); + UR_LOG(DEBUG, + "DEBUG: In ApplyFilter, if block case 6, matches = ", matches); } else if (filter.subsubId == DeviceIdTypeALL) { // subsub type of star always matches (when other parts match, which we // already know here) this is a subsub device filter, it must be // 'matches.matches.*' matches = true; - logger::debug("DEBUG: In ApplyFilter, if block case 7, matches = ", - matches); + UR_LOG(DEBUG, + "DEBUG: In ApplyFilter, if block case 7, matches = ", matches); } else { // this is a subsub device filter, numbers in all three parts match matches = (filter.subsubId == device.subsubId); - logger::debug("DEBUG: In ApplyFilter, if block case 8, matches = ", - matches); + UR_LOG(DEBUG, + "DEBUG: In ApplyFilter, if block case 8, matches = ", matches); } return matches; }; @@ -857,10 +855,11 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, subSubDevices.end()); } if (numAlreadySelected == selectedDevices.size()) { - logger::warning("WARNING: an accept term was ignored because it " - "does not select any additional devices" - "selectedDevices.size() = {}", - selectedDevices.size()); + UR_LOG(WARN, + "WARNING: an accept term was ignored because it " + "does not select any additional devices" + "selectedDevices.size() = {}", + selectedDevices.size()); } } diff --git a/unified-runtime/source/ur/ur.hpp b/unified-runtime/source/ur/ur.hpp index ab6bae9491c6..76305daaf77c 100644 --- a/unified-runtime/source/ur/ur.hpp +++ b/unified-runtime/source/ur/ur.hpp @@ -37,10 +37,10 @@ #define UR_CALL(Call) \ { \ if (PrintTrace) \ - logger::always("UR ---> {}", #Call); \ + UR_LOG(QUIET, "UR ---> {}", #Call); \ ur_result_t Result = (Call); \ if (PrintTrace) \ - logger::always("UR <--- {}({})", #Call, getUrResultString(Result)); \ + UR_LOG(QUIET, "UR <--- {}({})", #Call, getUrResultString(Result)); \ if (Result != UR_RESULT_SUCCESS) \ return Result; \ } @@ -49,10 +49,10 @@ #define UR_CALL_THROWS(Call) \ { \ if (PrintTrace) \ - logger::always("UR ---> {}", #Call); \ + UR_LOG(QUIET, "UR ---> {}", #Call); \ ur_result_t Result = (Call); \ if (PrintTrace) \ - logger::always("UR <--- {}({})", #Call, getUrResultString(Result)); \ + UR_LOG(QUIET, "UR <--- {}({})", #Call, getUrResultString(Result)); \ if (Result != UR_RESULT_SUCCESS) \ throw Result; \ } @@ -61,10 +61,10 @@ #define UR_CALL_NOCHECK(Call) \ { \ if (PrintTrace) \ - logger::always("UR ---> {}", #Call); \ + UR_LOG(QUIET, "UR ---> {}", #Call); \ (void)(Call); \ if (PrintTrace) \ - logger::always("UR <--- {}({})", #Call); \ + UR_LOG(QUIET, "UR <--- {}", #Call); \ } static auto getUrResultString = [](ur_result_t Result) { @@ -244,7 +244,7 @@ const ur_command_t UR_EXT_COMMAND_TYPE_USER = // Terminates the process with a catastrophic error message. [[noreturn]] inline void die(const char *Message) { - logger::always("ur_die: {}", Message); + UR_LOG(QUIET, "ur_die: {}", Message); std::terminate(); } diff --git a/unified-runtime/test/loader/platforms/platforms.cpp b/unified-runtime/test/loader/platforms/platforms.cpp index e4b980441d1a..b3b609d27520 100644 --- a/unified-runtime/test/loader/platforms/platforms.cpp +++ b/unified-runtime/test/loader/platforms/platforms.cpp @@ -27,23 +27,23 @@ int main(int, char *[]) { // Initialize the platform status = urLoaderInit(0, nullptr); if (status != UR_RESULT_SUCCESS) { - out.error("urLoaderInit failed with return code: {}", status); + UR_LOG_L(out, ERR, "urLoaderInit failed with return code: {}", status); return 1; } - out.info("urLoaderInit succeeded."); + UR_LOG_L(out, INFO, "urLoaderInit succeeded."); uint32_t adapterCount = 0; std::vector adapters; status = urAdapterGet(0, nullptr, &adapterCount); if (status != UR_RESULT_SUCCESS) { - out.error("urAdapterGet failed with return code: {}", status); + UR_LOG_L(out, ERR, "urAdapterGet failed with return code: {}", status); return 1; } adapters.resize(adapterCount); status = urAdapterGet(adapterCount, adapters.data(), nullptr); if (status != UR_RESULT_SUCCESS) { - out.error("urAdapterGet failed with return code: {}", status); + UR_LOG_L(out, ERR, "urAdapterGet failed with return code: {}", status); return 1; } @@ -53,16 +53,17 @@ int main(int, char *[]) { uint32_t adapterPlatformCount = 0; status = urPlatformGet(adapter, 0, nullptr, &adapterPlatformCount); if (status != UR_RESULT_SUCCESS) { - out.error("urPlatformGet failed with return code: {}", status); + UR_LOG_L(out, ERR, "urPlatformGet failed with return code: {}", status); goto out; } - out.info("urPlatformGet found {} platforms", adapterPlatformCount); + UR_LOG_L(out, INFO, "urPlatformGet found {} platforms", + adapterPlatformCount); platforms.resize(platformCount + adapterPlatformCount); status = urPlatformGet(adapter, adapterPlatformCount, &platforms[platformCount], &adapterPlatformCount); if (status != UR_RESULT_SUCCESS) { - out.error("urPlatformGet failed with return code: {}", status); + UR_LOG_L(out, ERR, "urPlatformGet failed with return code: {}", status); goto out; } platformCount += adapterPlatformCount; @@ -72,7 +73,8 @@ int main(int, char *[]) { size_t name_len; status = urPlatformGetInfo(p, UR_PLATFORM_INFO_NAME, 0, nullptr, &name_len); if (status != UR_RESULT_SUCCESS) { - out.error("urPlatformGetInfo failed with return code: {}", status); + UR_LOG_L(out, ERR, "urPlatformGetInfo failed with return code: {}", + status); goto out; } @@ -82,11 +84,12 @@ int main(int, char *[]) { status = urPlatformGetInfo(p, UR_PLATFORM_INFO_NAME, name_len, name, nullptr); if (status != UR_RESULT_SUCCESS) { - out.error("urPlatformGetInfo failed with return code: {}", status); + UR_LOG_L(out, ERR, "urPlatformGetInfo failed with return code: {}", + status); free(name); goto out; } - out.info("Found {} ", name); + UR_LOG_L(out, INFO, "Found {} ", name); free(name); } diff --git a/unified-runtime/test/logger/env_var.cpp b/unified-runtime/test/logger/env_var.cpp index faf7a15d8889..e8f43e45889c 100644 --- a/unified-runtime/test/logger/env_var.cpp +++ b/unified-runtime/test/logger/env_var.cpp @@ -8,17 +8,17 @@ ////////////////////////////////////////////////////////////////////////////// TEST_F(LoggerFromEnvVar, DebugMessage) { - logger::debug("Test message: {}", "success"); + UR_LOG(DEBUG, "Test message: {}", "success"); } TEST_F(LoggerFromEnvVar, InfoMessage) { - logger::info("Test message: {}", "success"); + UR_LOG(INFO, "Test message: {}", "success"); } TEST_F(LoggerFromEnvVar, WarningMessage) { - logger::warning("Test message: {}", "success"); + UR_LOG(WARN, "Test message: {}", "success"); } TEST_F(LoggerFromEnvVar, ErrorMessage) { - logger::error("Test message: {}", "success"); + UR_LOG(ERR, "Test message: {}", "success"); } diff --git a/unified-runtime/test/unit/logger.cpp b/unified-runtime/test/unit/logger.cpp index 9e6176f40ae9..7ac5fe8d756e 100644 --- a/unified-runtime/test/unit/logger.cpp +++ b/unified-runtime/test/unit/logger.cpp @@ -14,41 +14,41 @@ ////////////////////////////////////////////////////////////////////////////// TEST_F(DefaultLoggerWithFileSink, DefaultLevelNoOutput) { - logger->info("This should not be printed: {}", 42); + UR_LOG_L(*logger, INFO, "This should not be printed: {}", 42); test_msg.clear(); } TEST_F(DefaultLoggerWithFileSink, MultipleLines) { - logger->warning("Test message: {}", "success"); - logger->debug("This should not be printed: {}", 42); - logger->error("Test message: {}", "success"); + UR_LOG_L(*logger, WARN, "Test message: {}", "success"); + UR_LOG_L(*logger, DEBUG, "This should not be printed: {}", 42); + UR_LOG_L(*logger, ERR, "Test message: {}", "success"); test_msg << test_msg_prefix << "[WARNING]: Test message: success\n" << test_msg_prefix << "[ERROR]: Test message: success\n"; } TEST_F(DefaultLoggerWithFileSink, ThreeParams) { - logger->error("{} {}: {}", "Test", 42, 3.8); + UR_LOG_L(*logger, ERR, "{} {}: {}", "Test", 42, 3.8); test_msg << test_msg_prefix << "[ERROR]: Test 42: 3.8\n"; } TEST_F(DefaultLoggerWithFileSink, DoubleBraces) { - logger->error("{{}} {}: {}", "Test", 42); + UR_LOG_L(*logger, ERR, "{{}} {}: {}", "Test", 42); test_msg << test_msg_prefix << "[ERROR]: {} Test: 42\n"; } TEST_F(DefaultLoggerWithFileSink, DoubleBraces2) { - logger->error("200 {{ {}: {{{}}} 3.8", "Test", 42); + UR_LOG_L(*logger, ERR, "200 {{ {}: {{{}}} 3.8", "Test", 42); test_msg << test_msg_prefix << "[ERROR]: 200 { Test: {42} 3.8\n"; } TEST_F(DefaultLoggerWithFileSink, DoubleBraces3) { - logger->error("{{ {}:}} {}}}", "Test", 42); + UR_LOG_L(*logger, ERR, "{{ {}:}} {}}}", "Test", 42); test_msg << test_msg_prefix << "[ERROR]: { Test:} 42}\n"; } TEST_F(DefaultLoggerWithFileSink, NoBraces) { - logger->error(" Test: 42"); + UR_LOG_L(*logger, ERR, " Test: 42"); test_msg << test_msg_prefix << "[ERROR]: Test: 42\n"; } @@ -56,7 +56,7 @@ TEST_F(DefaultLoggerWithFileSink, SetLevelDebug) { auto level = UR_LOGGER_LEVEL_DEBUG; logger->setLevel(level); logger->setFlushLevel(level); - logger->debug("Test message: {}", "success"); + UR_LOG_L(*logger, DEBUG, "Test message: {}", "success"); test_msg << test_msg_prefix << "[DEBUG]: Test message: success\n"; } @@ -65,8 +65,8 @@ TEST_F(DefaultLoggerWithFileSink, SetLevelInfo) { auto level = UR_LOGGER_LEVEL_INFO; logger->setLevel(level); logger->setFlushLevel(level); - logger->info("Test message: {}", "success"); - logger->debug("This should not be printed: {}", 42); + UR_LOG_L(*logger, INFO, "Test message: {}", "success"); + UR_LOG_L(*logger, DEBUG, "This should not be printed: {}", 42); test_msg << test_msg_prefix << "[INFO]: Test message: success\n"; } @@ -74,16 +74,16 @@ TEST_F(DefaultLoggerWithFileSink, SetLevelInfo) { TEST_F(DefaultLoggerWithFileSink, SetLevelWarning) { auto level = UR_LOGGER_LEVEL_WARN; logger->setLevel(level); - logger->warning("Test message: {}", "success"); - logger->info("This should not be printed: {}", 42); + UR_LOG_L(*logger, WARN, "Test message: {}", "success"); + UR_LOG_L(*logger, INFO, "This should not be printed: {}", 42); test_msg << test_msg_prefix << "[WARNING]: Test message: success\n"; } TEST_F(DefaultLoggerWithFileSink, SetLevelError) { logger->setLevel(UR_LOGGER_LEVEL_ERROR); - logger->error("Test message: {}", "success"); - logger->warning("This should not be printed: {}", 42); + UR_LOG_L(*logger, ERR, "Test message: {}", "success"); + UR_LOG_L(*logger, WARN, "This should not be printed: {}", 42); test_msg << test_msg_prefix << "[ERROR]: Test message: success\n"; } @@ -94,7 +94,7 @@ TEST_F(UniquePtrLoggerWithFilesink, SetLogLevelAndFlushLevelDebugWithCtor) { logger = std::make_unique( level, std::make_unique(logger_name, file_path, level)); - logger->debug("Test message: {}", "success"); + UR_LOG_L(*logger, DEBUG, "Test message: {}", "success"); test_msg << test_msg_prefix << "[DEBUG]: Test message: success\n"; } @@ -110,13 +110,13 @@ TEST_F(UniquePtrLoggerWithFilesink, NestedFilePath) { UR_LOGGER_LEVEL_WARN, std::make_unique( logger_name, file_path, UR_LOGGER_LEVEL_WARN)); - logger->warning("Test message: {}", "success"); + UR_LOG_L(*logger, WARN, "Test message: {}", "success"); test_msg << test_msg_prefix << "[WARNING]: Test message: success\n"; } TEST_F(UniquePtrLoggerWithFilesinkFail, NullSink) { logger = std::make_unique(UR_LOGGER_LEVEL_INFO, nullptr); - logger->info("This should not be printed: {}", 42); + UR_LOG_L(*logger, INFO, "This should not be printed: {}", 42); test_msg.clear(); } @@ -137,7 +137,7 @@ TEST_P(FileSinkLoggerMultipleThreads, Multithreaded) { for (int i = 0; i < thread_count; i++) { threads.emplace_back([&]() { for (int j = 0; j < message_count; ++j) { - local_logger.warn("Test message: {}", "it's a success"); + UR_LOG_L(local_logger, WARN, "Test message: {}", "it's a success"); } }); } @@ -151,7 +151,8 @@ TEST_P(FileSinkLoggerMultipleThreads, Multithreaded) { for (int i = 0; i < thread_count; i++) { threads.emplace_back([&]() { for (int j = 0; j < message_count; ++j) { - local_logger.error("Flushed test message: {}", "it's a success"); + UR_LOG_L(local_logger, ERR, "Flushed test message: {}", + "it's a success"); } }); } @@ -182,7 +183,7 @@ TEST_P(CommonLoggerWithMultipleThreads, StdoutMultithreaded) { for (int i = 0; i < thread_count; i++) { threads.emplace_back([&]() { for (int j = 0; j < message_count; ++j) { - local_logger.warn("Test message: {}", "it's a success"); + UR_LOG_L(local_logger, WARN, "Test message: {}", "it's a success"); } }); } @@ -196,7 +197,8 @@ TEST_P(CommonLoggerWithMultipleThreads, StdoutMultithreaded) { for (int i = 0; i < thread_count; i++) { threads.emplace_back([&]() { for (int j = 0; j < message_count; ++j) { - local_logger.error("Flushed test message: {}", "it's a success"); + UR_LOG_L(local_logger, ERR, "Flushed test message: {}", + "it's a success"); } }); } diff --git a/unified-runtime/tools/urtrace/collector.cpp b/unified-runtime/tools/urtrace/collector.cpp index 3d4abb944c59..3e20ecf1ba44 100644 --- a/unified-runtime/tools/urtrace/collector.cpp +++ b/unified-runtime/tools/urtrace/collector.cpp @@ -86,7 +86,7 @@ std::string time_to_str(std::chrono::nanoseconds dur, enum time_unit unit) { ostr << d.count() << "s"; } break; default: { - out.error("invalid time unit {}", unit); + UR_LOG_L(out, ERR, "invalid time unit {}", unit); break; } } @@ -123,7 +123,7 @@ static class cli_args { return std::nullopt; } if (arg_values.size() != 1) { - out.warn("{} requires a single argument, skipping...", name); + UR_LOG_L(out, WARN, "{} requires a single argument, skipping...", name); return std::nullopt; } return arg_values.at(0); @@ -161,18 +161,20 @@ static class cli_args { try { filter = filter_str; } catch (const std::regex_error &err) { - out.warn("invalid filter regex {} {}", *filter_str, err.what()); + UR_LOG_L(out, WARN, "invalid filter regex {} {}", *filter_str, + err.what()); } } else { - out.warn("unknown {} argument {}.", ARGS_ENV, arg_name); + UR_LOG_L(out, WARN, "unknown {} argument {}.", ARGS_ENV, arg_name); } } } - out.debug("collector args (.print_begin = {}, .profiling = {}, " - ".time_unit = {}, .filter = {}, .output_format = {})", - print_begin, profiling, time_unit_str[time_unit], - filter_str.has_value() ? *filter_str : "none", - output_format_str[output_format]); + UR_LOG_L(out, DEBUG, + "collector args (.print_begin = {}, .profiling = {}, " + ".time_unit = {}, .filter = {}, .output_format = {})", + print_begin, profiling, time_unit_str[time_unit], + filter_str.has_value() ? *filter_str : "none", + output_format_str[output_format]); } enum time_unit time_unit; @@ -202,7 +204,7 @@ class TraceWriter { class HumanReadable : public TraceWriter { void begin(uint64_t id, const char *fname, std::string args) override { if (cli_args.print_begin) { - out.info("begin({}) - {}({});", id, fname, args); + UR_LOG_L(out, INFO, "begin({}) - {}({});", id, fname, args); } } void end(uint64_t id, const char *fname, std::string args, Timepoint tp, @@ -218,8 +220,8 @@ class HumanReadable : public TraceWriter { std::chrono::duration_cast(tp - start_tp); profile_str << " (" << time_to_str(dur, cli_args.time_unit) << ")"; } - out.info("{}{}({}) -> {};{}", prefix_str.str(), fname, args, *resultp, - profile_str.str()); + UR_LOG_L(out, INFO, "{}{}({}) -> {};{}", prefix_str.str(), fname, args, + *resultp, profile_str.str()); } }; @@ -234,15 +236,16 @@ class JsonWriter : public TraceWriter { // not much we can do here... } } - void prologue() override { out.info("{{\n \"traceEvents\": ["); } + void prologue() override { UR_LOG_L(out, INFO, "{{\n \"traceEvents\": ["); } void epilogue() override { // Empty trace to avoid ending in a comma // To prevent that last comma from being printed in the first place // we could synchronize the entire 'end' function, while reversing the // logic and printing commas at the front. Not worth it probably. - out.info("{{\"name\": \"\", \"cat\": \"\", \"ph\": \"\", \"pid\": \"\", " + UR_LOG_L(out, INFO, + "{{\"name\": \"\", \"cat\": \"\", \"ph\": \"\", \"pid\": \"\", " "\"tid\": \"\", \"ts\": \"\"}}"); - out.info("]\n}}"); + UR_LOG_L(out, INFO, "]\n}}"); } void begin(uint64_t, const char *, std::string) override {} @@ -254,7 +257,7 @@ class JsonWriter : public TraceWriter { .count(); auto dur_us = std::chrono::duration_cast(dur).count(); - out.info("{{\ + UR_LOG_L(out, INFO, "{{\ \"cat\": \"UR\", \ \"ph\": \"X\",\ \"pid\": {},\ @@ -320,8 +323,9 @@ XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, xpti::trace_event_data_t *, if (auto regex = cli_args.filter) { if (!std::regex_match(args->function_name, *regex)) { - out.debug("function {} does not match regex filter, skipping...", - args->function_name); + UR_LOG_L(out, DEBUG, + "function {} does not match regex filter, skipping...", + args->function_name); return; } } @@ -342,9 +346,10 @@ XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, xpti::trace_event_data_t *, } else if (trace_type == TRACE_FN_END) { auto ctx = pop_instance_data(instance); if (!ctx) { - out.error("Received TRACE_FN_END without corresponding " - "TRACE_FN_BEGIN, instance {}. Skipping...", - instance); + UR_LOG_L(out, ERR, + "Received TRACE_FN_END without corresponding " + "TRACE_FN_BEGIN, instance {}. Skipping...", + instance); return; } auto resultp = static_cast(args->ret_data); @@ -352,7 +357,7 @@ XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, xpti::trace_event_data_t *, writer()->end(instance, args->function_name, args_str.str(), time_for_end, *ctx->start, resultp); } else { - out.warn("unsupported trace type"); + UR_LOG_L(out, WARN, "unsupported trace type"); } } @@ -365,27 +370,27 @@ XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version, unsigned int minor_version, const char *, const char *stream_name) { if (stream_name == nullptr) { - out.debug("Found stream with null name. Skipping..."); + UR_LOG_L(out, DEBUG, "Found stream with null name. Skipping..."); return; } if (std::string_view(stream_name) != UR_STREAM_NAME) { - out.debug("Found stream: {}. Expected: {}. Skipping...", stream_name, - UR_STREAM_NAME); + UR_LOG_L(out, DEBUG, "Found stream: {}. Expected: {}. Skipping...", + stream_name, UR_STREAM_NAME); return; } if (UR_MAKE_VERSION(major_version, minor_version) != UR_API_VERSION_CURRENT) { - out.error("Invalid stream version: {}.{}. Expected: {}.{}. Skipping...", - major_version, minor_version, - UR_MAJOR_VERSION(UR_API_VERSION_CURRENT), - UR_MINOR_VERSION(UR_API_VERSION_CURRENT)); + UR_LOG_L( + out, ERR, "Invalid stream version: {}.{}. Expected: {}.{}. Skipping...", + major_version, minor_version, UR_MAJOR_VERSION(UR_API_VERSION_CURRENT), + UR_MINOR_VERSION(UR_API_VERSION_CURRENT)); return; } uint8_t stream_id = xptiRegisterStream(stream_name); - out.debug("Registered stream {} ({}.{}).", stream_name, major_version, - minor_version); + UR_LOG_L(out, DEBUG, "Registered stream {} ({}.{}).", stream_name, + major_version, minor_version); writer()->prologue(); xptiRegisterCallback(stream_id, TRACE_FN_BEGIN, trace_cb); @@ -397,12 +402,12 @@ XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version, */ XPTI_CALLBACK_API void xptiTraceFinish(const char *stream_name) { if (stream_name == nullptr) { - out.debug("Found stream with null name. Skipping..."); + UR_LOG_L(out, DEBUG, "Found stream with null name. Skipping..."); return; } if (std::string_view(stream_name) != UR_STREAM_NAME) { - out.debug("Found stream: {}. Expected: {}. Skipping...", stream_name, - UR_STREAM_NAME); + UR_LOG_L(out, DEBUG, "Found stream: {}. Expected: {}. Skipping...", + stream_name, UR_STREAM_NAME); return; }