Skip to content

Commit 8e0ee19

Browse files
committed
Fix zer Global table init to be optional
- Fix the zer Global Init to be treated like an experimental init that cannot affect the ability to use a driver. Signed-off-by: Neil R. Spruit <[email protected]>
1 parent e6f47c3 commit 8e0ee19

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

scripts/templates/ldrddi.cpp.mako

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ ${tbl['export']['name']}(
532532

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

535-
%if tbl['experimental'] is False: #//Experimental Tables may not be implemented in driver
535+
%if tbl['experimental'] is False and namespace != "zer": #//Experimental Tables may not be implemented in driver
536536
bool atLeastOneDriverValid = false;
537537
%endif
538538
// Load the device-driver DDI tables
@@ -547,7 +547,7 @@ ${tbl['export']['name']}(
547547
auto getTable = reinterpret_cast<${tbl['pfn']}>(
548548
GET_FUNCTION_PTR( drv.handle, "${tbl['export']['name']}") );
549549
if(!getTable)
550-
%if th.isNewProcTable(tbl['export']['name']) is True:
550+
%if th.isNewProcTable(tbl['export']['name']) is True and namespace != "zer":
551551
{
552552
atLeastOneDriverValid = true;
553553
//It is valid to not have this proc addr table
@@ -556,15 +556,15 @@ ${tbl['export']['name']}(
556556
%else:
557557
continue;
558558
%endif
559-
%if tbl['experimental'] is False: #//Experimental Tables may not be implemented in driver
559+
%if tbl['experimental'] is False and namespace != "zer": #//Experimental Tables may not be implemented in driver
560560
auto getTableResult = getTable( version, &drv.dditable.${n}.${tbl['name']});
561561
if(getTableResult == ZE_RESULT_SUCCESS) {
562562
atLeastOneDriverValid = true;
563563
loader::context->configured_version = version;
564564
} else
565565
drv.initStatus = getTableResult;
566566
%if namespace != "zes":
567-
%if tbl['name'] == "Global":
567+
%if tbl['name'] == "Global" and namespace != "zer":
568568
if (drv.dditable.ze.Global.pfnInitDrivers) {
569569
loader::context->initDriversSupport = true;
570570
}
@@ -575,7 +575,7 @@ ${tbl['export']['name']}(
575575
%endif
576576
}
577577

578-
%if tbl['experimental'] is False: #//Experimental Tables may not be implemented in driver
578+
%if tbl['experimental'] is False and namespace != "zer": #//Experimental Tables may not be implemented in driver
579579
if(!atLeastOneDriverValid)
580580
result = ${X}_RESULT_ERROR_UNINITIALIZED;
581581
else

source/loader/zer_ldrddi.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ zerGetGlobalProcAddrTable(
141141

142142
ze_result_t result = ZE_RESULT_SUCCESS;
143143

144-
bool atLeastOneDriverValid = false;
145144
// Load the device-driver DDI tables
146145
for( auto& drv : loader::context->zeDrivers )
147146
{
@@ -151,21 +150,9 @@ zerGetGlobalProcAddrTable(
151150
GET_FUNCTION_PTR( drv.handle, "zerGetGlobalProcAddrTable") );
152151
if(!getTable)
153152
continue;
154-
auto getTableResult = getTable( version, &drv.dditable.zer.Global);
155-
if(getTableResult == ZE_RESULT_SUCCESS) {
156-
atLeastOneDriverValid = true;
157-
loader::context->configured_version = version;
158-
} else
159-
drv.initStatus = getTableResult;
160-
if (drv.dditable.ze.Global.pfnInitDrivers) {
161-
loader::context->initDriversSupport = true;
162-
}
153+
result = getTable( version, &drv.dditable.zer.Global);
163154
}
164155

165-
if(!atLeastOneDriverValid)
166-
result = ZE_RESULT_ERROR_UNINITIALIZED;
167-
else
168-
result = ZE_RESULT_SUCCESS;
169156

170157
if( ZE_RESULT_SUCCESS == result )
171158
{

0 commit comments

Comments
 (0)