Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[L0] Update L0 Init checking to print details in error log #2449

Merged
merged 1 commit into from
Dec 16, 2024
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
13 changes: 9 additions & 4 deletions source/adapters/level_zero/adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//===----------------------------------------------------------------------===//

#include "adapter.hpp"
#include "common.hpp"
#include "ur_level_zero.hpp"
#include <iomanip>

Expand Down Expand Up @@ -162,7 +163,7 @@ ur_result_t initPlatforms(PlatformVec &platforms,
ZE2UR_CALL(zeDriverGet, (&ZeDriverGetCount, ZeDriverGetHandles.data()));
}
if (ZeDriverGetCount == 0 && GlobalAdapter->ZeInitDriversCount == 0) {
logger::debug("\nNo Valid L0 Drivers found.\n");
logger::error("\nNo Valid L0 Drivers found.\n");
return UR_RESULT_SUCCESS;
}

Expand Down Expand Up @@ -376,7 +377,9 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
static_cast<int>(L0InitFlags));
GlobalAdapter->ZeInitResult = ZE_CALL_NOCHECK(zeInit, (L0InitFlags));
if (GlobalAdapter->ZeInitResult != ZE_RESULT_SUCCESS) {
logger::debug("\nzeInit failed with {}\n", GlobalAdapter->ZeInitResult);
const char *ErrorString = "Unknown";
zeParseError(GlobalAdapter->ZeInitResult, ErrorString);
logger::error("\nzeInit failed with {}\n", ErrorString);
}

bool useInitDrivers = false;
Expand Down Expand Up @@ -422,8 +425,9 @@ ur_adapter_handle_t_::ur_adapter_handle_t_()
if (GlobalAdapter->ZeInitDriversResult == ZE_RESULT_SUCCESS) {
GlobalAdapter->InitDriversSupported = true;
} else {
logger::debug("\nzeInitDrivers failed with {}\n",
GlobalAdapter->ZeInitDriversResult);
const char *ErrorString = "Unknown";
zeParseError(GlobalAdapter->ZeInitDriversResult, ErrorString);
logger::error("\nzeInitDrivers failed with {}\n", ErrorString);
}
}
}
Expand All @@ -441,6 +445,7 @@ 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");
result = std::move(platforms);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ ZeUSMImportExtension ZeUSMImport;

std::map<std::string, int> *ZeCallCount = nullptr;

inline void zeParseError(ze_result_t ZeError, const char *&ErrorString) {
void zeParseError(ze_result_t ZeError, const char *&ErrorString) {
switch (ZeError) {
#define ZE_ERRCASE(ERR) \
case ERR: \
Expand Down
3 changes: 3 additions & 0 deletions source/adapters/level_zero/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ bool setEnvVar(const char *name, const char *value);
// Map Level Zero runtime error code to UR error code.
ur_result_t ze2urResult(ze_result_t ZeResult);

// Parse Level Zero error code and return the error string.
void zeParseError(ze_result_t ZeError, const char *&ErrorString);

// Trace a call to Level-Zero RT
#define ZE2UR_CALL(ZeName, ZeArgs) \
{ \
Expand Down
Loading