Skip to content

Commit 51658cc

Browse files
committed
Add API Version check derived from the spec for each api
Signed-off-by: Neil R. Spruit <neil.r.spruit@intel.com>
1 parent 5c62ce5 commit 51658cc

5 files changed

Lines changed: 1647 additions & 0 deletions

File tree

scripts/templates/helper.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,6 +1702,41 @@ def get_class_function_objs(specs, cname, minVersion = 0, maxVersion = 9999):
17021702
objects.append(obj)
17031703
return sorted(objects, key=lambda obj: (float(obj.get('version',"1.0"))*10000) + int(obj.get('ordinal',"100")))
17041704

1705+
"""
1706+
Public:
1707+
returns the version of a function object
1708+
"""
1709+
def get_version(obj):
1710+
if obj_traits.is_function(obj):
1711+
version = obj.get('version')
1712+
if version == "1.0":
1713+
return "ZE_API_VERSION_1_0"
1714+
if version == "1.1":
1715+
return "ZE_API_VERSION_1_1"
1716+
if version == "1.2":
1717+
return "ZE_API_VERSION_1_2"
1718+
if version == "1.3":
1719+
return "ZE_API_VERSION_1_3"
1720+
if version == "1.4":
1721+
return "ZE_API_VERSION_1_4"
1722+
if version == "1.5":
1723+
return "ZE_API_VERSION_1_5"
1724+
if version == "1.6":
1725+
return "ZE_API_VERSION_1_6"
1726+
if version == "1.7":
1727+
return "ZE_API_VERSION_1_7"
1728+
if version == "1.8":
1729+
return "ZE_API_VERSION_1_8"
1730+
if version == "1.9":
1731+
return "ZE_API_VERSION_1_9"
1732+
if version == "1.10":
1733+
return "ZE_API_VERSION_1_10"
1734+
if version == "1.11":
1735+
return "ZE_API_VERSION_1_11"
1736+
if version == "1.12":
1737+
return "ZE_API_VERSION_1_12"
1738+
return "ZE_API_VERSION_1_0"
1739+
17051740
"""
17061741
Public:
17071742
returns a list of all non-experimental function objs and a list of experimental function objs for the specified class

scripts/templates/ldrddi.cpp.mako

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ namespace loader
183183
%endif
184184
if (dditable->isValidFlag == 0)
185185
return ${X}_RESULT_ERROR_UNINITIALIZED;
186+
// Check that api version in the driver is supported by this version of the API
187+
if (dditable->version < ${th.get_version(obj)}) {
188+
return ${X}_RESULT_ERROR_UNSUPPORTED_VERSION;
189+
}
186190
auto ${th.make_pfn_name(n, tags, obj)} = dditable->${th.get_table_name(n, tags, obj)}->${th.make_pfn_name(n, tags, obj)};
187191
if( nullptr == ${th.make_pfn_name(n, tags, obj)} )
188192
return ${X}_RESULT_ERROR_UNINITIALIZED;

0 commit comments

Comments
 (0)