Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions scripts/templates/ldrddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ ${tbl['export']['name']}(

${x}_result_t result = ${X}_RESULT_SUCCESS;

%if tbl['experimental'] is False: #//Experimental Tables may not be implemented in driver
%if tbl['experimental'] is False and namespace != "zer": #//Experimental Tables may not be implemented in driver
bool atLeastOneDriverValid = false;
%endif
// Load the device-driver DDI tables
Expand All @@ -547,7 +547,7 @@ ${tbl['export']['name']}(
auto getTable = reinterpret_cast<${tbl['pfn']}>(
GET_FUNCTION_PTR( drv.handle, "${tbl['export']['name']}") );
if(!getTable)
%if th.isNewProcTable(tbl['export']['name']) is True:
%if th.isNewProcTable(tbl['export']['name']) is True and namespace != "zer":
{
atLeastOneDriverValid = true;
//It is valid to not have this proc addr table
Expand All @@ -556,15 +556,15 @@ ${tbl['export']['name']}(
%else:
continue;
%endif
%if tbl['experimental'] is False: #//Experimental Tables may not be implemented in driver
%if tbl['experimental'] is False and namespace != "zer": #//Experimental Tables may not be implemented in driver
auto getTableResult = getTable( version, &drv.dditable.${n}.${tbl['name']});
if(getTableResult == ZE_RESULT_SUCCESS) {
atLeastOneDriverValid = true;
loader::context->configured_version = version;
} else
drv.initStatus = getTableResult;
%if namespace != "zes":
%if tbl['name'] == "Global":
%if tbl['name'] == "Global" and namespace != "zer":
if (drv.dditable.ze.Global.pfnInitDrivers) {
loader::context->initDriversSupport = true;
}
Expand All @@ -575,7 +575,7 @@ ${tbl['export']['name']}(
%endif
}

%if tbl['experimental'] is False: #//Experimental Tables may not be implemented in driver
%if tbl['experimental'] is False and namespace != "zer": #//Experimental Tables may not be implemented in driver
if(!atLeastOneDriverValid)
result = ${X}_RESULT_ERROR_UNINITIALIZED;
else
Expand Down
4 changes: 4 additions & 0 deletions source/lib/ze_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ namespace ze_lib

if ( ZE_RESULT_SUCCESS == result )
{
memset(&initialzeDdiTable, 0, sizeof(ze_dditable_t));
memset(&initialzetDdiTable, 0, sizeof(zet_dditable_t));
memset(&initialzesDdiTable, 0, sizeof(zes_dditable_t));
memset(&initialzerDdiTable, 0, sizeof(zer_dditable_t));
ze_lib::context->zeDdiTable.exchange(&ze_lib::context->initialzeDdiTable);
ze_lib::context->zetDdiTable.exchange(&ze_lib::context->initialzetDdiTable);
ze_lib::context->zesDdiTable.exchange(&ze_lib::context->initialzesDdiTable);
Expand Down
15 changes: 1 addition & 14 deletions source/loader/zer_ldrddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ zerGetGlobalProcAddrTable(

ze_result_t result = ZE_RESULT_SUCCESS;

bool atLeastOneDriverValid = false;
// Load the device-driver DDI tables
for( auto& drv : loader::context->zeDrivers )
{
Expand All @@ -151,21 +150,9 @@ zerGetGlobalProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zerGetGlobalProcAddrTable") );
if(!getTable)
continue;
auto getTableResult = getTable( version, &drv.dditable.zer.Global);
if(getTableResult == ZE_RESULT_SUCCESS) {
atLeastOneDriverValid = true;
loader::context->configured_version = version;
} else
drv.initStatus = getTableResult;
if (drv.dditable.ze.Global.pfnInitDrivers) {
loader::context->initDriversSupport = true;
}
result = getTable( version, &drv.dditable.zer.Global);
}

if(!atLeastOneDriverValid)
result = ZE_RESULT_ERROR_UNINITIALIZED;
else
result = ZE_RESULT_SUCCESS;

if( ZE_RESULT_SUCCESS == result )
{
Expand Down
7 changes: 3 additions & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ function(add_runtime_api_test test_scenario init_method driver_config)
set(gtest_filter "*GivenLevelZeroLoaderPresentWithLoaderInterceptEnabledAndDdiExtNotSupportedWhenCallingRuntimeApisAfter${init_method}ThenExpectNullDriverIsReachedSuccessfully")
elseif(test_scenario STREQUAL "ddi_ext_v1_0")
set(gtest_filter "*GivenLevelZeroLoaderPresentWithLoaderInterceptEnabledAndDdiExtSupportedWithVersion1_0WhenCallingRuntimeApisAfter${init_method}ThenExpectErrorUninitialized")
elseif(test_scenario STREQUAL "runtime_api_unsupported")
elseif(test_scenario STREQUAL "unsupported")
set(gtest_filter "*GivenLevelZeroLoaderPresentWithLoaderInterceptEnabledAndRuntimeApiUnsupportedWhenCallingRuntimeApisAfter${init_method}ThenExpectErrorUnsupportedFeature")
endif()

Expand Down Expand Up @@ -656,9 +656,8 @@ foreach(init_method IN LISTS init_methods)
# Add multi-driver tests
add_runtime_api_test(${test_scenario} ${init_method} "multi_driver")
endforeach()

# Add runtime_api_unsupported tests for single driver
if(init_method STREQUAL "ZeInitDrivers")
add_runtime_api_test("runtime_api_unsupported" ${init_method} "single_driver")
if(init_method STREQUAL "ZeInitDrivers" OR init_method STREQUAL "ZeInit")
add_runtime_api_test("unsupported" ${init_method} "single_driver")
endif()
endforeach()
2 changes: 0 additions & 2 deletions test/loader_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2557,7 +2557,6 @@ TEST_F(DriverOrderingTest,
EXPECT_EQ(0, strcmp(errorDesc, "ERROR UNSUPPORTED FEATURE"));
}

/*
TEST(
RuntimeApiLoaderDriverInteraction,
GivenLevelZeroLoaderPresentWithLoaderInterceptEnabledAndRuntimeApiUnsupportedWhenCallingRuntimeApisAfterZeInitThenExpectErrorUnsupportedFeature)
Expand Down Expand Up @@ -2599,7 +2598,6 @@ TEST_F(DriverOrderingTest,
EXPECT_NE(errorDesc, nullptr);
EXPECT_EQ(0, strcmp(errorDesc, "ERROR UNSUPPORTED FEATURE"));
}
*/


} // namespace
Loading