Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Level zero loader changelog
## v1.28.2
* fix logging of apis in validation layer to only print successful apis given ZEL_LOADER_LOGGING_ENABLE_SUCCESS_PRINT
## v1.28.1
* feature: Improve API Call Tracing and add ults
* add performance validation layer checker
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if(MSVC AND (MSVC_VERSION LESS 1900))
endif()

# This project follows semantic versioning (https://semver.org/)
project(level-zero VERSION 1.28.1)
project(level-zero VERSION 1.28.2)
include(GNUInstallDirs)

find_package(Git)
Expand Down
4 changes: 2 additions & 2 deletions PRODUCT_GUID.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1.28.1
3622767c-2b40-4af8-961d-06eda1231409
1.28.2
115378b3-db3b-44cf-8c29-eb1184210c18
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ validation layer is enabled. Following variables need to be set to enable API lo

`ZE_ENABLE_VALIDATION_LAYER=1`

To print successful API call results, set
`ZEL_LOADER_LOGGING_ENABLE_SUCCESS_PRINT=1`
Otherwise, only error results will be printed in the API trace output.
NOTE: This will become the default behavior in future releases. for now, please set the env var to enable this logging feature.

By default logs will be written to the log file, as described above. To print the logs
to stderr instead, `ZEL_LOADER_LOG_CONSOLE=1` needs to be set.

Expand Down
8 changes: 8 additions & 0 deletions scripts/templates/validation/valddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ namespace validation_layer
%endfor
%endif
) {
// Only log success results if verbose logging is enabled
if (result == ${X}_RESULT_SUCCESS && !context.verboseLogging) {
return result;
}
std::string status = (result == ${X}_RESULT_SUCCESS) ? "SUCCESS" : "ERROR";
%if is_void_params:
context.logger->log_trace(status + " (" + loader::to_string(result) + ") in ${func_name}()");
Expand Down Expand Up @@ -117,6 +121,10 @@ namespace validation_layer
const void* desc,
ze_event_handle_t* phEvent
) {
// Only log success results if verbose logging is enabled
if (result == ${X}_RESULT_SUCCESS && !context.verboseLogging) {
return result;
}
std::string status = (result == ${X}_RESULT_SUCCESS) ? "SUCCESS" : "ERROR";
std::ostringstream oss;
oss << status << " (" << loader::to_string(result) << ") in zexCounterBasedEventCreate2("
Expand Down
868 changes: 868 additions & 0 deletions source/layers/validation/ze_valddi.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions source/layers/validation/ze_validation_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace validation_layer
handleLifetime = std::make_unique<HandleLifetimeValidation>();
}
enableThreadingValidation = getenv_tobool( "ZE_ENABLE_THREADING_VALIDATION" );
verboseLogging = getenv_tobool( "ZEL_LOADER_LOGGING_ENABLE_SUCCESS_PRINT" );

logger = loader::createLogger();
}
Expand Down
1 change: 1 addition & 0 deletions source/layers/validation/ze_validation_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace validation_layer

bool enableHandleLifetime = false;
bool enableThreadingValidation = false;
bool verboseLogging = false;

ze_dditable_t zeDdiTable = {};
zet_dditable_t zetDdiTable = {};
Expand Down
16 changes: 16 additions & 0 deletions source/layers/validation/zer_valddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ namespace validation_layer
const char** ppString ///< [in,out] pointer to a null-terminated array of characters describing
///< cause of error.
) {
// Only log success results if verbose logging is enabled
if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) {
return result;
}
std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR";
std::ostringstream oss;
oss << status << " (" << loader::to_string(result) << ") in zerGetLastErrorDescription(";
Expand All @@ -46,6 +50,10 @@ namespace validation_layer
ze_result_t result,
ze_device_handle_t hDevice ///< [in] handle of the device
) {
// Only log success results if verbose logging is enabled
if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) {
return result;
}
std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR";
std::ostringstream oss;
oss << status << " (" << loader::to_string(result) << ") in zerTranslateDeviceHandleToIdentifier(";
Expand All @@ -61,6 +69,10 @@ namespace validation_layer
ze_result_t result,
uint32_t identifier ///< [in] integer identifier of the device
) {
// Only log success results if verbose logging is enabled
if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) {
return result;
}
std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR";
std::ostringstream oss;
oss << status << " (" << loader::to_string(result) << ") in zerTranslateIdentifierToDeviceHandle(";
Expand All @@ -74,6 +86,10 @@ namespace validation_layer
}
VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zerGetDefaultContext(
ze_result_t result) {
// Only log success results if verbose logging is enabled
if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) {
return result;
}
std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR";
context.logger->log_trace(status + " (" + loader::to_string(result) + ") in zerGetDefaultContext()");
return result;
Expand Down
Loading
Loading