Skip to content

Commit

Permalink
Remove call to zeInit for driver check when only initializing sysman
Browse files Browse the repository at this point in the history
zesInit path should not call zeInit

Resolves: VLCLJ-1875

Signed-off-by: Brandon Yates <[email protected]>
  • Loading branch information
bmyates committed Mar 1, 2023
1 parent b2b24fa commit f2286c6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
7 changes: 6 additions & 1 deletion scripts/templates/libapi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ ${th.make_func_name(n, tags, obj)}(
%if re.match("Init", obj['name']):
static ${x}_result_t result = ${X}_RESULT_SUCCESS;
std::call_once(${x}_lib::context->initOnce, [flags]() {
result = ${x}_lib::context->Init(flags);
%if re.match("zes", n):
result = ${x}_lib::context->Init(flags, true);
%else:
result = ${x}_lib::context->Init(flags, false);
%endif

});

if( ${X}_RESULT_SUCCESS != result )
Expand Down
6 changes: 4 additions & 2 deletions source/lib/ze_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace ze_lib
};

//////////////////////////////////////////////////////////////////////////
__zedlllocal ze_result_t context_t::Init(ze_init_flags_t flags)
__zedlllocal ze_result_t context_t::Init(ze_init_flags_t flags, bool sysmanOnly)
{
ze_result_t result;
#ifdef DYNAMIC_LOAD_LOADER
Expand Down Expand Up @@ -83,8 +83,10 @@ namespace ze_lib
result = zelTracingInit();
}

if( ZE_RESULT_SUCCESS == result )
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);
}

Expand Down
2 changes: 1 addition & 1 deletion source/lib/ze_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace ze_lib

std::once_flag initOnce;

ze_result_t Init(ze_init_flags_t flags);
ze_result_t Init(ze_init_flags_t flags, bool sysmanOnly);

ze_result_t zeInit();
ze_dditable_t zeDdiTable = {};
Expand Down
3 changes: 2 additions & 1 deletion source/lib/ze_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ zeInit(
{
static ze_result_t result = ZE_RESULT_SUCCESS;
std::call_once(ze_lib::context->initOnce, [flags]() {
result = ze_lib::context->Init(flags);
result = ze_lib::context->Init(flags, false);

});

if( ZE_RESULT_SUCCESS != result )
Expand Down
3 changes: 2 additions & 1 deletion source/lib/zes_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ zesInit(
{
static ze_result_t result = ZE_RESULT_SUCCESS;
std::call_once(ze_lib::context->initOnce, [flags]() {
result = ze_lib::context->Init(flags);
result = ze_lib::context->Init(flags, true);

});

if( ZE_RESULT_SUCCESS != result )
Expand Down

0 comments on commit f2286c6

Please sign in to comment.