@@ -620,8 +620,13 @@ namespace loader
620620 loader::loaderDispatch->pRuntime = new zer_dditable_driver_t ();
621621 loader::loaderDispatch->pRuntime ->version = ZE_API_VERSION_CURRENT ;
622622 loader::loaderDispatch->pRuntime ->isValidFlag = 1 ;
623- debugTraceEnabled = getenv_tobool ( " ZE_ENABLE_LOADER_DEBUG_TRACE" );
624- if (debugTraceEnabled) {
623+ {
624+ uint32_t dtMode = getenv_tomode ( " ZE_ENABLE_LOADER_DEBUG_TRACE" );
625+ const uint32_t loggingMode = getenv_tomode (" ZEL_ENABLE_LOADER_LOGGING" );
626+ debugTraceEnabled = (dtMode != 0 );
627+ debugTraceAdvanced = (dtMode == 2 ) || (loggingMode == 2 );
628+ }
629+ if (debugTraceAdvanced) {
625630 std::cerr << " ZE_LOADER_DEBUG_TRACE: WARNING: ZE_ENABLE_LOADER_DEBUG_TRACE is deprecated and will be removed in a future release." << std::endl;
626631 std::cerr << " ZE_LOADER_DEBUG_TRACE: WARNING: Use ZEL_LOADER_LOG_CONSOLE=1 with ZEL_LOADER_LOGGING_LEVEL=trace instead." << std::endl;
627632 }
@@ -646,10 +651,6 @@ namespace loader
646651 zel_logger = createLogger (" Dynamic Loader" );
647652#endif
648653
649- if ((getenv_string (" ZEL_LOADER_LOGGING_LEVEL" ) == " trace" ) && !debugTraceEnabled) {
650- debugTraceEnabled = true ;
651- }
652-
653654 if (zel_logger->getLevel () != loader::LogLevel::off) {
654655 std::string ver_msg = " Loader Version " +
655656 std::to_string (LOADER_VERSION_MAJOR ) + " ." +
@@ -670,12 +671,9 @@ namespace loader
670671 loaderLibraryPath = readLevelZeroLoaderLibraryPath ();
671672 }
672673#endif
673- if (debugTraceEnabled) {
674- if (loaderLibraryPath.empty ())
675- debug_trace_message (" Using Loader Library Path: " , " Not set" );
676- else
677- debug_trace_message (" Using Loader Library Path: " , loaderLibraryPath);
678- }
674+ if (debugTraceEnabled)
675+ debug_trace_message (" Using Loader Library Path: " ,
676+ (debugTraceAdvanced && loaderLibraryPath.empty ()) ? " Not set" : loaderLibraryPath);
679677
680678 if (debugTraceEnabled && driverDDIPathDefault) {
681679 debug_trace_message (" DDI Driver Extension Path is Enabled" , " " );
@@ -690,12 +688,16 @@ namespace loader
690688 {
691689 zel_logger->log_info (" Enabling Null Driver" );
692690 std::string nullDriverPath = create_library_path ( MAKE_LIBRARY_NAME ( " ze_null" , L0_LOADER_VERSION ), loaderLibraryPath.c_str ());
693- if (debugTraceEnabled)
694- debug_trace_message (" Null Driver Library Path (requested): " , nullDriverPath);
691+ if (debugTraceEnabled) {
692+ if (debugTraceAdvanced)
693+ debug_trace_message (" Null Driver Library Path (requested): " , nullDriverPath);
694+ else
695+ debug_trace_message (" ze_null Driver Init" , " " );
696+ }
695697 auto handle = LOAD_DRIVER_LIBRARY ( nullDriverPath.c_str () );
696698 if ( NULL != handle )
697699 {
698- if (debugTraceEnabled) {
700+ if (debugTraceEnabled && debugTraceAdvanced ) {
699701#if !defined(_WIN32) && !defined(ANDROID)
700702 struct link_map *dlinfo_map;
701703 if (dlinfo (handle, RTLD_DI_LINKMAP , &dlinfo_map) == 0 ) {
@@ -770,12 +772,12 @@ namespace loader
770772 {
771773 zel_logger->log_info (" Validation Layer Enabled" );
772774 std::string validationLayerLibraryPath = create_library_path (MAKE_LAYER_NAME ( " ze_validation_layer" ), loaderLibraryPath.c_str ());
773- if (debugTraceEnabled)
775+ if (debugTraceEnabled && debugTraceAdvanced )
774776 debug_trace_message (" Validation Layer Library Path (requested): " , validationLayerLibraryPath);
775777 validationLayer = LOAD_DRIVER_LIBRARY ( validationLayerLibraryPath.c_str () );
776778 if (validationLayer)
777779 {
778- if (debugTraceEnabled) {
780+ if (debugTraceEnabled && debugTraceAdvanced ) {
779781#if !defined(_WIN32) && !defined(ANDROID)
780782 struct link_map *dlinfo_map;
781783 if (dlinfo (validationLayer, RTLD_DI_LINKMAP , &dlinfo_map) == 0 ) {
@@ -818,11 +820,11 @@ namespace loader
818820 }
819821 std::string tracingLayerLibraryPath = create_library_path (MAKE_LAYER_NAME ( " ze_tracing_layer" ), loaderLibraryPath.c_str ());
820822 if (debugTraceEnabled)
821- debug_trace_message (" Tracing Layer Library Path (requested): " , tracingLayerLibraryPath);
823+ debug_trace_message (debugTraceAdvanced ? " Tracing Layer Library Path (requested): " : " Tracing Layer Library Path : " , tracingLayerLibraryPath);
822824 tracingLayer = LOAD_DRIVER_LIBRARY ( tracingLayerLibraryPath.c_str () );
823825 if (tracingLayer)
824826 {
825- if (debugTraceEnabled) {
827+ if (debugTraceEnabled && debugTraceAdvanced ) {
826828#if !defined(_WIN32) && !defined(ANDROID)
827829 struct link_map *dlinfo_map;
828830 if (dlinfo (tracingLayer, RTLD_DI_LINKMAP , &dlinfo_map) == 0 ) {
0 commit comments