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
40 changes: 40 additions & 0 deletions scripts/templates/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1726,6 +1726,46 @@ def get_class_function_objs_exp(specs, cname):
return objects, exp_objects, optional


"""
Comment thread
rwmcguir marked this conversation as resolved.
Public:
returns the version of a function object
"""
def get_version(obj):
if obj_traits.is_function(obj):
ret_version = "ZE_API_VERSION_FORCE_UINT32"
version = obj.get('version')
if version == "1.0":
ret_version = "ZE_API_VERSION_1_0"
if version == "1.1":
ret_version = "ZE_API_VERSION_1_1"
if version == "1.2":
ret_version = "ZE_API_VERSION_1_2"
if version == "1.3":
ret_version = "ZE_API_VERSION_1_3"
if version == "1.4":
ret_version = "ZE_API_VERSION_1_4"
if version == "1.5":
ret_version = "ZE_API_VERSION_1_5"
if version == "1.6":
ret_version = "ZE_API_VERSION_1_6"
if version == "1.7":
ret_version = "ZE_API_VERSION_1_7"
if version == "1.8":
ret_version = "ZE_API_VERSION_1_8"
if version == "1.9":
ret_version = "ZE_API_VERSION_1_9"
if version == "1.10":
ret_version = "ZE_API_VERSION_1_10"
if version == "1.11":
ret_version = "ZE_API_VERSION_1_11"
if version == "1.12":
ret_version = "ZE_API_VERSION_1_12"
if version == "1.13":
ret_version = "ZE_API_VERSION_1_13"
if (ret_version == "ZE_API_VERSION_FORCE_UINT32"):
ret_version = "ZE_API_VERSION_1_0"
return ret_version

"""
Public:
returns string name of DDI table for function object
Expand Down
6 changes: 4 additions & 2 deletions scripts/templates/ldrddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -443,15 +443,17 @@ ${tbl['export']['name']}(
{
// return pointers to loader's DDIs
%for obj in tbl['functions']:
if (version >= ${th.get_version(obj)}) {
Comment thread
rwmcguir marked this conversation as resolved.
%if 'condition' in obj:
#if ${th.subt(n, tags, obj['condition'])}
%endif
pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = loader::${th.make_func_name(n, tags, obj)};
pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = loader::${th.make_func_name(n, tags, obj)};
%if 'condition' in obj:
#else
pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = nullptr;
pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = nullptr;
#endif
%endif
}
%endfor
}
else
Expand Down
14 changes: 7 additions & 7 deletions scripts/templates/tracing/trcddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,25 @@ ${tbl['export']['name']}(
if( nullptr == pDdiTable )
return ${X}_RESULT_ERROR_INVALID_NULL_POINTER;

if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) ||
ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version))
if (tracing_layer::context.version < version)
return ${X}_RESULT_ERROR_UNSUPPORTED_VERSION;

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

%for obj in tbl['functions']:
if (version >= ${th.get_version(obj)}) {
%if 'condition' in obj:
#if ${th.subt(n, tags, obj['condition'])}
%endif
dditable.${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = pDdiTable->${th.make_pfn_name(n, tags, obj)};
pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 41)} = tracing_layer::${th.make_func_name(n, tags, obj)};
dditable.${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = pDdiTable->${th.make_pfn_name(n, tags, obj)};
pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 41)} = tracing_layer::${th.make_func_name(n, tags, obj)};
%if 'condition' in obj:
#else
dditable.${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = nullptr;
pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 41)} = nullptr;
dditable.${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = nullptr;
pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 41)} = nullptr;
#endif
%endif

}
%endfor
return result;
}
Expand Down
14 changes: 7 additions & 7 deletions scripts/templates/validation/valddi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -154,25 +154,25 @@ ${tbl['export']['name']}(
if( nullptr == pDdiTable )
return ${X}_RESULT_ERROR_INVALID_NULL_POINTER;

if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) ||
ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version))
if (validation_layer::context.version < version)
return ${X}_RESULT_ERROR_UNSUPPORTED_VERSION;

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

%for obj in tbl['functions']:
if (version >= ${th.get_version(obj)}) {
%if 'condition' in obj:
#if ${th.subt(n, tags, obj['condition'])}
%endif
dditable.${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = pDdiTable->${th.make_pfn_name(n, tags, obj)};
pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 41)} = validation_layer::${th.make_func_name(n, tags, obj)};
dditable.${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = pDdiTable->${th.make_pfn_name(n, tags, obj)};
pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 41)} = validation_layer::${th.make_func_name(n, tags, obj)};
%if 'condition' in obj:
#else
dditable.${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = nullptr;
pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 41)} = nullptr;
dditable.${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = nullptr;
pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 41)} = nullptr;
#endif
%endif

}
%endfor
return result;
}
Expand Down
Loading
Loading