fix: correct loading L0 loader functions

- don't load ze_loader.dll from file system
- to perform self-open on Windows use getModuleHandleA with proper module name
- don't free library loaded with getModuleHandleA
- as loader may be not available during runtime teardown:
- load translate handle function during global setup
- load setDriverTeardown function during global teardown
- when loader is not available during teardown, unset translate handle
function

Related-To: GSD-10147

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2024-10-16 19:53:07 +00:00
committed by Compute-Runtime-Automation
parent 9d6d6e85f1
commit 4154e6666b
38 changed files with 300 additions and 123 deletions

View File

@@ -19,7 +19,7 @@ namespace GmmInterface {
GMM_STATUS initialize(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs) {
if (!gmmLib) {
gmmLib.reset(OsLibrary::loadFunc(GMM_UMD_DLL));
gmmLib.reset(OsLibrary::loadFunc({GMM_UMD_DLL}));
UNRECOVERABLE_IF(!gmmLib);
}
auto initGmmFunc = reinterpret_cast<decltype(&InitializeGmm)>(gmmLib->getProcAddress(GMM_ADAPTER_INIT_NAME));