-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathlibddi.cpp.mako
More file actions
76 lines (68 loc) · 2.15 KB
/
libddi.cpp.mako
File metadata and controls
76 lines (68 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<%!
import re
from templates import helper as th
%><%
n=namespace
N=n.upper()
x=tags['$x']
X=x.upper()
%>/*
*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
* @file ${name}.cpp
*
*/
#include "${x}_lib.h"
#ifndef L0_STATIC_LOADER_BUILD
#include "${n}_ddi.h"
#endif
namespace ${x}_lib
{
///////////////////////////////////////////////////////////////////////////////
#ifdef L0_STATIC_LOADER_BUILD
__zedlllocal ${x}_result_t context_t::${n}DdiTableInit(ze_api_version_t version)
{
${x}_result_t result = ${X}_RESULT_SUCCESS;
%for tbl in th.get_pfntables(specs, meta, n, tags):
if( ${X}_RESULT_SUCCESS == result )
{
%if tbl['optional'] == True:
// Optional
auto getTable = reinterpret_cast<${tbl['pfn']}>(
GET_FUNCTION_PTR(loader, "${tbl['export']['name']}") );
getTableWithCheck(getTable, version, &initial${n}DdiTable.${tbl['name']} );
%else:
auto getTable = reinterpret_cast<${tbl['pfn']}>(
GET_FUNCTION_PTR(loader, "${tbl['export']['name']}") );
result = getTableWithCheck(getTable, version, &initial${n}DdiTable.${tbl['name']} );
%endif
%for obj in tbl['functions']:
initial${n}DdiTable.${tbl['name']}.${th.make_pfn_name(n, tags, obj)} = reinterpret_cast<${th.make_pfn_type(n, tags, obj)}>(
GET_FUNCTION_PTR(loader, "${th.make_func_name(n, tags, obj)}") );
%endfor
}
%endfor
return result;
}
#else
__zedlllocal ${x}_result_t context_t::${n}DdiTableInit(ze_api_version_t version)
{
${x}_result_t result = ${X}_RESULT_SUCCESS;
%for tbl in th.get_pfntables(specs, meta, n, tags):
if( ${X}_RESULT_SUCCESS == result )
{
%if tbl['optional'] == True:
// Optional
${tbl['export']['name']}( version, &initial${n}DdiTable.${tbl['name']} );
%else:
result = ${tbl['export']['name']}( version, &initial${n}DdiTable.${tbl['name']} );
%endif
}
%endfor
return result;
}
#endif
} // namespace ${x}_lib