Improve GtPin init error status reporting

Related-To: LOCI-1286

Signed-off-by: davidoli <david.olien@intel.com>
This commit is contained in:
davidoli
2022-07-26 01:38:44 +00:00
committed by Compute-Runtime-Automation
parent a931f1654e
commit d7c43d022a
8 changed files with 110 additions and 14 deletions

View File

@@ -18,27 +18,28 @@ const std::string gtPinOpenFunctionName = "OpenGTPin";
namespace L0 {
ze_result_t PinContext::init() {
std::unique_ptr<NEO::OsLibrary> hGtPinLibrary = nullptr;
PinContext::OsLibraryLoadPtr PinContext::osLibraryLoadFunction(NEO::OsLibrary::load);
hGtPinLibrary.reset(NEO::OsLibrary::load(gtPinLibraryFilename.c_str()));
if (hGtPinLibrary.get() == nullptr) {
ze_result_t PinContext::init() {
NEO::OsLibrary *hGtPinLibrary = nullptr;
hGtPinLibrary = PinContext::osLibraryLoadFunction(gtPinLibraryFilename.c_str());
if (hGtPinLibrary == nullptr) {
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find gtpin library %s\n", gtPinLibraryFilename.c_str());
return ZE_RESULT_ERROR_UNKNOWN;
return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE;
}
OpenGTPin_fn openGTPin = reinterpret_cast<OpenGTPin_fn>(hGtPinLibrary->getProcAddress(gtPinOpenFunctionName.c_str()));
if (openGTPin == nullptr) {
hGtPinLibrary.reset(nullptr);
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find gtpin library open function symbol %s\n", gtPinOpenFunctionName.c_str());
return ZE_RESULT_ERROR_UNKNOWN;
return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE;
}
uint32_t openResult = openGTPin(nullptr);
if (openResult != 0) {
hGtPinLibrary.reset(nullptr);
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "gtpin library open %s failed with status %u\n", gtPinOpenFunctionName.c_str(), openResult);
return ZE_RESULT_ERROR_UNKNOWN;
return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE;
}
return ZE_RESULT_SUCCESS;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -16,6 +16,8 @@ namespace L0 {
class PinContext {
public:
static ze_result_t init();
using OsLibraryLoadPtr = std::add_pointer<NEO::OsLibrary *(const std::string &)>::type;
static OsLibraryLoadPtr osLibraryLoadFunction;
private:
static const std::string gtPinLibraryFilename;