diff --git a/source/lib/ze_lib.cpp b/source/lib/ze_lib.cpp index 801fffe..cfa21f5 100644 --- a/source/lib/ze_lib.cpp +++ b/source/lib/ze_lib.cpp @@ -74,6 +74,16 @@ namespace ze_lib ze_lib::context->zesDdiTable.exchange(&ze_lib::context->initialzesDdiTable); } + + // Check which drivers and layers are functional by checking which can be loaded. + // This check needs to be done before all inits to avoid overwriting the layer ddi table pointers. + if( ZE_RESULT_SUCCESS == result && !sysmanOnly) + { + //Check which drivers support the ze_driver_flag_t specified + //No need to check if only initializing sysman + result = zelLoaderDriverCheck(flags); + } + if( ZE_RESULT_SUCCESS == result ) { result = zeInit(); @@ -99,13 +109,6 @@ namespace ze_lib result = zelLoaderTracingLayerInit(this->pTracingZeDdiTable, this->pTracingZetDdiTable, this->pTracingZesDdiTable); } - if( ZE_RESULT_SUCCESS == result && !sysmanOnly) - { - //Check which drivers support the ze_driver_flag_t specified - //No need to check if only initializing sysman - result = zelLoaderDriverCheck(flags); - } - if( ZE_RESULT_SUCCESS == result ) { isInitialized = true;