Skip to content

Commit 7e9cff8

Browse files
committed
Restore some of ZE_ENABLE_LOADER_DEBUG_TRACE
Signed-off-by: Russell McGuire <russell.w.mcguire@intel.com>
1 parent 2f75d73 commit 7e9cff8

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,19 @@ When the `-DBUILD_STATIC=1` is executed, the dynamic loader and layers are not b
4646
Testing with the static loader requires a build of the dynamic loader or an installation of the dynamic loader to exist in the library path.
4747

4848
# Debug Trace
49+
50+
> **Deprecated:** `ZE_ENABLE_LOADER_DEBUG_TRACE` is deprecated and will be removed in a future release.
51+
> Use `ZEL_LOADER_LOG_CONSOLE=1` with `ZEL_LOADER_LOGGING_LEVEL=trace` instead, which provides
52+
> the same or enhanced information with structured timestamps, thread IDs, and log levels via the logging system.
53+
4954
The Level Zero Loader has the ability to print warnings and errors which occur within the internals of the Level Zero Loader itself.
5055

5156
To enable this debug tracing feature, set the environment variable `ZE_ENABLE_LOADER_DEBUG_TRACE=1`.
5257

5358
This will enforce the Loader to print all errors whether fatal or non-fatal to stderr with the PREFIX `ZE_LOADER_DEBUG_TRACE:`.
5459

5560

56-
# Logging to File
61+
# Logging to File or Console
5762
The Level Zero Loader provides built-in logging controlled via environment variables:
5863

5964
| Environment Variable | Default | Description |

source/lib/ze_lib.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ namespace ze_lib
6464
__zedlllocal context_t::context_t()
6565
{
6666
debugTraceEnabled = getenv_tobool( "ZE_ENABLE_LOADER_DEBUG_TRACE" );
67+
if (debugTraceEnabled) {
68+
std::cerr << "ZE_LOADER_DEBUG_TRACE: WARNING: ZE_ENABLE_LOADER_DEBUG_TRACE is deprecated and will be removed in a future release." << std::endl;
69+
std::cerr << "ZE_LOADER_DEBUG_TRACE: WARNING: Use ZEL_LOADER_LOG_CONSOLE=1 with ZEL_LOADER_LOGGING_LEVEL=trace instead." << std::endl;
70+
}
6771
memset(&initialzeDdiTable, 0, sizeof(ze_dditable_t));
6872
memset(&initialzetDdiTable, 0, sizeof(zet_dditable_t));
6973
memset(&initialzesDdiTable, 0, sizeof(zes_dditable_t));

source/loader/ze_loader.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ namespace loader
2525
context_t *context;
2626

2727
void context_t::debug_trace_message(std::string message, std::string result) {
28+
if (debugTraceEnabled) {
29+
std::cerr << "ZE_LOADER_DEBUG_TRACE:" << message << result << std::endl;
30+
}
2831
zel_logger->log_trace(message + result);
2932
};
3033

@@ -618,6 +621,10 @@ namespace loader
618621
loader::loaderDispatch->pRuntime->version = ZE_API_VERSION_CURRENT;
619622
loader::loaderDispatch->pRuntime->isValidFlag = 1;
620623
debugTraceEnabled = getenv_tobool( "ZE_ENABLE_LOADER_DEBUG_TRACE" );
624+
if (debugTraceEnabled) {
625+
std::cerr << "ZE_LOADER_DEBUG_TRACE: WARNING: ZE_ENABLE_LOADER_DEBUG_TRACE is deprecated and will be removed in a future release." << std::endl;
626+
std::cerr << "ZE_LOADER_DEBUG_TRACE: WARNING: Use ZEL_LOADER_LOG_CONSOLE=1 with ZEL_LOADER_LOGGING_LEVEL=trace instead." << std::endl;
627+
}
621628
// DDI Driver Extension Path is enabled by default.
622629
// This can be overridden by the environment variable ZE_ENABLE_LOADER_DRIVER_DDI_PATH.
623630
std::string ddiPathConfig = getenv_string("ZE_ENABLE_LOADER_DRIVER_DDI_PATH");

source/utils/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ add_library(level_zero_utils STATIC ${logging_files})
77
target_include_directories(level_zero_utils PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
88

99
set_property(TARGET level_zero_utils PROPERTY POSITION_INDEPENDENT_CODE ON)
10+
11+
# Hide all symbols — ZeLogger is an internal implementation detail, not a public ABI.
12+
# Each consumer (loader, validation layer, static shim) links its own copy.
13+
# Prevents runtime symbol interposition when multiple copies coexist in one process.
14+
if(NOT WIN32)
15+
target_compile_options(level_zero_utils PRIVATE -fvisibility=hidden -fvisibility-inlines-hidden)
16+
endif()

0 commit comments

Comments
 (0)