Move Pin init from zetInit to zeInit

Change-Id: Iea704cda26916315343e3cef6840954ba3d62c06
Signed-off-by: davidoli <david.olien@intel.com>
This commit is contained in:
davidoli
2020-07-16 10:41:28 -07:00
committed by sys_ocldev
parent 697fa86e2f
commit b4577ade07
6 changed files with 24 additions and 22 deletions

View File

@@ -18,36 +18,30 @@ const std::string gtPinOpenFunctionName = "OpenGTPin";
namespace L0 {
void PinContext::init(ze_init_flag_t flag, ze_result_t &result) {
ze_result_t PinContext::init() {
std::unique_ptr<NEO::OsLibrary> hGtPinLibrary = nullptr;
result = ZE_RESULT_SUCCESS;
if (!getenv_tobool("ZE_ENABLE_PROGRAM_INSTRUMENTATION")) {
return;
}
hGtPinLibrary.reset(NEO::OsLibrary::load(gtPinLibraryFilename.c_str()));
if (hGtPinLibrary.get() == nullptr) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find gtpin library %s\n", gtPinLibraryFilename.c_str());
result = ZE_RESULT_ERROR_UNKNOWN;
return;
return ZE_RESULT_ERROR_UNKNOWN;
}
OpenGTPin_fn openGTPin = reinterpret_cast<OpenGTPin_fn>(hGtPinLibrary.get()->getProcAddress(gtPinOpenFunctionName.c_str()));
if (openGTPin == nullptr) {
hGtPinLibrary.reset(nullptr);
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find gtpin library open function symbol %s\n", gtPinOpenFunctionName.c_str());
result = ZE_RESULT_ERROR_UNKNOWN;
return;
return ZE_RESULT_ERROR_UNKNOWN;
}
uint32_t openResult = openGTPin(nullptr);
if (openResult != 0) {
hGtPinLibrary.reset(nullptr);
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "gtpin library open %s failed with status %u\n", gtPinOpenFunctionName.c_str(), openResult);
result = ZE_RESULT_ERROR_UNKNOWN;
return;
return ZE_RESULT_ERROR_UNKNOWN;
}
return ZE_RESULT_SUCCESS;
}
} // namespace L0

View File

@@ -15,7 +15,7 @@ namespace L0 {
class PinContext {
public:
static void init(ze_init_flag_t flag, ze_result_t &result);
static ze_result_t init();
private:
static const std::string gtPinLibraryFilename;