Skip to content

Commit 9bf0958

Browse files
committed
Support for legacy ddi pass thru
Signed-off-by: Neil R. Spruit <neil.r.spruit@intel.com>
1 parent c88063d commit 9bf0958

14 files changed

Lines changed: 1868 additions & 5 deletions

scripts/templates/ldrddi.cpp.mako

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,13 @@ ${tbl['export']['name']}(
278278
%endif
279279
{
280280
// return pointers to loader's DDIs
281+
%if namespace == "ze":
282+
loader::loaderDispatch->pCore->${tbl['name']} = new ${tbl['type']};
283+
%elif namespace == "zet":
284+
loader::loaderDispatch->pTools->${tbl['name']} = new ${tbl['type']};
285+
%elif namespace == "zes":
286+
loader::loaderDispatch->pSysman->${tbl['name']} = new ${tbl['type']};
287+
%endif
281288
%for obj in tbl['functions']:
282289
%if 'condition' in obj:
283290
#if ${th.subt(n, tags, obj['condition'])}
@@ -289,6 +296,7 @@ ${tbl['export']['name']}(
289296
#endif
290297
%endif
291298
%endfor
299+
${tbl['export']['name']}Legacy();
292300
}
293301
else
294302
{

scripts/templates/ldrddi.h.mako

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,16 @@ namespace loader
3333
%endif
3434
%endfor
3535
}
36+
37+
#if defined(__cplusplus)
38+
extern "C" {
39+
#endif
40+
41+
%for tbl in th.get_pfntables(specs, meta, n, tags):
42+
__${x}dlllocal void ${X}_APICALL
43+
${tbl['export']['name']}Legacy();
44+
%endfor
45+
46+
#if defined(__cplusplus)
47+
};
48+
#endif

scripts/templates/ldrddi_legacy.cpp.mako

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,3 +306,52 @@ namespace loader_legacy
306306

307307
%endfor
308308
} // namespace loader_legacy
309+
310+
#if defined(__cplusplus)
311+
extern "C" {
312+
#endif
313+
314+
%for tbl in th.get_pfntables(specs, meta, n, tags):
315+
///////////////////////////////////////////////////////////////////////////////
316+
/// @brief function for filling the legacy api pointers for ${tbl['name']} table
317+
/// with current process' addresses
318+
///
319+
/// @returns
320+
/// - ::${X}_RESULT_SUCCESS
321+
/// - ::${X}_RESULT_ERROR_UNINITIALIZED
322+
/// - ::${X}_RESULT_ERROR_INVALID_NULL_POINTER
323+
/// - ::${X}_RESULT_ERROR_UNSUPPORTED_VERSION
324+
__${x}dlllocal void ${X}_APICALL
325+
${tbl['export']['name']}Legacy()
326+
{
327+
// return pointers to the Loader's Functions.
328+
%for obj in tbl['functions']:
329+
%if 'condition' in obj:
330+
#if ${th.subt(n, tags, obj['condition'])}
331+
%endif
332+
%if namespace == "ze":
333+
loader::loaderDispatch->pCore->${tbl['name']}->${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = loader_legacy::${th.make_func_name(n, tags, obj)};
334+
%elif namespace == "zet":
335+
loader::loaderDispatch->pTools->${tbl['name']}->${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = loader_legacy::${th.make_func_name(n, tags, obj)};
336+
%elif namespace == "zes":
337+
loader::loaderDispatch->pSysman->${tbl['name']}->${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = loader_legacy::${th.make_func_name(n, tags, obj)};
338+
%endif
339+
%if 'condition' in obj:
340+
#else
341+
%if namespace == "ze":
342+
loader::loaderDispatch->pCore->${tbl['name']}->${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = nullptr;
343+
%elif namespace == "zet":
344+
loader::loaderDispatch->pTools->${tbl['name']}->${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = nullptr;
345+
%elif namespace == "zes":
346+
loader::loaderDispatch->pSysman->${tbl['name']}->${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = nullptr;
347+
%endif
348+
#endif
349+
%endif
350+
%endfor
351+
}
352+
353+
%endfor
354+
355+
#if defined(__cplusplus)
356+
};
357+
#endif

source/loader/ze_ldrddi.cpp

Lines changed: 56 additions & 0 deletions
Large diffs are not rendered by default.

source/loader/ze_ldrddi.h

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,68 @@ namespace loader
7070
using ze_rtas_parallel_operation_exp_factory_t = singleton_factory_t < ze_rtas_parallel_operation_exp_object_t, ze_rtas_parallel_operation_exp_handle_t >;
7171

7272
}
73+
74+
#if defined(__cplusplus)
75+
extern "C" {
76+
#endif
77+
78+
__zedlllocal void ZE_APICALL
79+
zeGetGlobalProcAddrTableLegacy();
80+
__zedlllocal void ZE_APICALL
81+
zeGetRTASBuilderExpProcAddrTableLegacy();
82+
__zedlllocal void ZE_APICALL
83+
zeGetRTASParallelOperationExpProcAddrTableLegacy();
84+
__zedlllocal void ZE_APICALL
85+
zeGetDriverProcAddrTableLegacy();
86+
__zedlllocal void ZE_APICALL
87+
zeGetDriverExpProcAddrTableLegacy();
88+
__zedlllocal void ZE_APICALL
89+
zeGetDeviceProcAddrTableLegacy();
90+
__zedlllocal void ZE_APICALL
91+
zeGetDeviceExpProcAddrTableLegacy();
92+
__zedlllocal void ZE_APICALL
93+
zeGetContextProcAddrTableLegacy();
94+
__zedlllocal void ZE_APICALL
95+
zeGetCommandQueueProcAddrTableLegacy();
96+
__zedlllocal void ZE_APICALL
97+
zeGetCommandListProcAddrTableLegacy();
98+
__zedlllocal void ZE_APICALL
99+
zeGetCommandListExpProcAddrTableLegacy();
100+
__zedlllocal void ZE_APICALL
101+
zeGetEventProcAddrTableLegacy();
102+
__zedlllocal void ZE_APICALL
103+
zeGetEventExpProcAddrTableLegacy();
104+
__zedlllocal void ZE_APICALL
105+
zeGetEventPoolProcAddrTableLegacy();
106+
__zedlllocal void ZE_APICALL
107+
zeGetFenceProcAddrTableLegacy();
108+
__zedlllocal void ZE_APICALL
109+
zeGetImageProcAddrTableLegacy();
110+
__zedlllocal void ZE_APICALL
111+
zeGetImageExpProcAddrTableLegacy();
112+
__zedlllocal void ZE_APICALL
113+
zeGetKernelProcAddrTableLegacy();
114+
__zedlllocal void ZE_APICALL
115+
zeGetKernelExpProcAddrTableLegacy();
116+
__zedlllocal void ZE_APICALL
117+
zeGetMemProcAddrTableLegacy();
118+
__zedlllocal void ZE_APICALL
119+
zeGetMemExpProcAddrTableLegacy();
120+
__zedlllocal void ZE_APICALL
121+
zeGetModuleProcAddrTableLegacy();
122+
__zedlllocal void ZE_APICALL
123+
zeGetModuleBuildLogProcAddrTableLegacy();
124+
__zedlllocal void ZE_APICALL
125+
zeGetPhysicalMemProcAddrTableLegacy();
126+
__zedlllocal void ZE_APICALL
127+
zeGetSamplerProcAddrTableLegacy();
128+
__zedlllocal void ZE_APICALL
129+
zeGetVirtualMemProcAddrTableLegacy();
130+
__zedlllocal void ZE_APICALL
131+
zeGetFabricEdgeExpProcAddrTableLegacy();
132+
__zedlllocal void ZE_APICALL
133+
zeGetFabricVertexExpProcAddrTableLegacy();
134+
135+
#if defined(__cplusplus)
136+
};
137+
#endif

0 commit comments

Comments
 (0)