Defer Sysman Engine Module Initialization

With this change, init for sysman Engine API would not be done during zeInit.
init and thereby Engine API handle creation would be done only
when user explicitly requests to enumerate handles
using zesDeviceEnumEngineGroups

Related-To: LOCI-3127

Signed-off-by: Kulkarni, Ashwin Kumar <ashwin.kumar.kulkarni@intel.com>
This commit is contained in:
Kulkarni, Ashwin Kumar
2022-08-11 13:42:59 +00:00
committed by Compute-Runtime-Automation
parent 94ff080c2a
commit 44649faa0f
14 changed files with 110 additions and 10 deletions

View File

@@ -47,6 +47,10 @@ void EngineHandleContext::releaseEngines() {
}
ze_result_t EngineHandleContext::engineGet(uint32_t *pCount, zes_engine_handle_t *phEngine) {
std::call_once(initEngineOnce, [this]() {
this->init();
this->engineInitDone = true;
});
uint32_t handleListSize = static_cast<uint32_t>(handleList.size());
uint32_t numToCopy = std::min(*pCount, handleListSize);
if (0 == *pCount || *pCount > handleListSize) {