88 */
99
1010#include " ze_loopback.h"
11- #include " utils_log.h"
1211
1312#include < cstdlib>
13+ #include < iostream>
1414
1515LevelZero *level_zero_mock = nullptr ;
1616
17- //
18- // libze_ops from src/utils/utils_level_zero.cpp
19- //
20-
21- void check_mock_present () {
17+ static void check_mock_present () {
2218 if (level_zero_mock == nullptr ) {
23- LOG_FATAL ( " level_zero_mock was not set" ) ;
19+ std::cerr << " level_zero_mock was not set\n " ;
2420 abort ();
2521 }
2622}
2723
24+ #define FAIL_NOT_IMPLEMENTED \
25+ std::cerr << __func__ << " not implemented in ze_loopback.cpp\n " ; \
26+ abort ();
27+
28+ //
29+ // libze_ops from src/utils/utils_level_zero.cpp
30+ //
31+
2832ZE_APIEXPORT ze_result_t ZE_APICALL zeInit (ze_init_flags_t flags) {
2933 (void )flags;
3034 return ZE_RESULT_SUCCESS;
@@ -34,8 +38,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeDriverGet(uint32_t *pCount,
3438 ze_driver_handle_t *phDrivers) {
3539 (void )phDrivers;
3640 (void )pCount;
37- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
38- abort ();
41+ FAIL_NOT_IMPLEMENTED
3942}
4043
4144ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGet (ze_driver_handle_t hDriver,
@@ -44,8 +47,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGet(ze_driver_handle_t hDriver,
4447 (void )hDriver;
4548 (void )pCount;
4649 (void )phDevices;
47- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
48- abort ();
50+ FAIL_NOT_IMPLEMENTED
4951}
5052
5153ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetProperties (
@@ -60,15 +62,13 @@ zeContextCreate(ze_driver_handle_t hDriver, const ze_context_desc_t *desc,
6062 (void )hDriver;
6163 (void )desc;
6264 (void )phContext;
63- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
64- abort ();
65+ FAIL_NOT_IMPLEMENTED
6566}
6667
6768ZE_APIEXPORT ze_result_t ZE_APICALL
6869zeContextDestroy (ze_context_handle_t hContext) {
6970 (void )hContext;
70- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
71- abort ();
71+ FAIL_NOT_IMPLEMENTED;
7272}
7373
7474ZE_APIEXPORT ze_result_t ZE_APICALL
@@ -79,15 +79,13 @@ zeCommandQueueCreate(ze_context_handle_t hContext, ze_device_handle_t hDevice,
7979 (void )hDevice;
8080 (void )desc;
8181 (void )phCommandQueue;
82- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
83- abort ();
82+ FAIL_NOT_IMPLEMENTED
8483}
8584
8685ZE_APIEXPORT ze_result_t ZE_APICALL
8786zeCommandQueueDestroy (ze_command_queue_handle_t hCommandQueue) {
8887 (void )hCommandQueue;
89- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
90- abort ();
88+ FAIL_NOT_IMPLEMENTED
9189}
9290
9391ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandQueueExecuteCommandLists (
@@ -97,16 +95,14 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandQueueExecuteCommandLists(
9795 (void )numCommandLists;
9896 (void )phCommandLists;
9997 (void )hFence;
100- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
101- abort ();
98+ FAIL_NOT_IMPLEMENTED
10299}
103100
104101ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandQueueSynchronize (
105102 ze_command_queue_handle_t hCommandQueue, uint64_t timeout) {
106103 (void )hCommandQueue;
107104 (void )timeout;
108- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
109- abort ();
105+ FAIL_NOT_IMPLEMENTED
110106}
111107
112108ZE_APIEXPORT ze_result_t ZE_APICALL
@@ -117,22 +113,19 @@ zeCommandListCreate(ze_context_handle_t hContext, ze_device_handle_t hDevice,
117113 (void )hDevice;
118114 (void )desc;
119115 (void )phCommandList;
120- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
121- abort ();
116+ FAIL_NOT_IMPLEMENTED
122117}
123118
124119ZE_APIEXPORT ze_result_t ZE_APICALL
125120zeCommandListDestroy (ze_command_list_handle_t hCommandList) {
126121 (void )hCommandList;
127- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
128- abort ();
122+ FAIL_NOT_IMPLEMENTED
129123}
130124
131125ZE_APIEXPORT ze_result_t ZE_APICALL
132126zeCommandListClose (ze_command_list_handle_t hCommandList) {
133127 (void )hCommandList;
134- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
135- abort ();
128+ FAIL_NOT_IMPLEMENTED
136129}
137130
138131ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryCopy (
@@ -146,8 +139,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryCopy(
146139 (void )hSignalEvent;
147140 (void )numWaitEvents;
148141 (void )phWaitEvents;
149- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
150- abort ();
142+ FAIL_NOT_IMPLEMENTED
151143}
152144
153145ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryFill (
@@ -162,8 +154,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryFill(
162154 (void )hSignalEvent;
163155 (void )numWaitEvents;
164156 (void )phWaitEvents;
165- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
166- abort ();
157+ FAIL_NOT_IMPLEMENTED
167158}
168159
169160ZE_APIEXPORT ze_result_t ZE_APICALL
@@ -195,8 +186,7 @@ zeDeviceGetMemoryProperties(ze_device_handle_t hDevice, uint32_t *pCount,
195186 (void )hDevice;
196187 (void )pCount;
197188 (void )pMemProperties;
198- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
199- abort ();
189+ FAIL_NOT_IMPLEMENTED
200190}
201191
202192//
@@ -212,8 +202,7 @@ ze_result_t ZE_APICALL zeMemAllocHost(ze_context_handle_t hContext,
212202 (void )size;
213203 (void )alignment;
214204 (void )pptr;
215- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
216- abort ();
205+ FAIL_NOT_IMPLEMENTED
217206}
218207
219208ze_result_t ZE_APICALL zeMemAllocShared (
@@ -227,8 +216,7 @@ ze_result_t ZE_APICALL zeMemAllocShared(
227216 (void )alignment;
228217 (void )hDevice;
229218 (void )pptr;
230- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
231- abort ();
219+ FAIL_NOT_IMPLEMENTED
232220}
233221
234222ze_result_t ZE_APICALL zeMemGetIpcHandle (ze_context_handle_t hContext,
@@ -237,16 +225,14 @@ ze_result_t ZE_APICALL zeMemGetIpcHandle(ze_context_handle_t hContext,
237225 (void )hContext;
238226 (void )ptr;
239227 (void )pIpcHandle;
240- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
241- abort ();
228+ FAIL_NOT_IMPLEMENTED
242229}
243230
244231ze_result_t ZE_APICALL zeMemPutIpcHandle (ze_context_handle_t hContext,
245232 ze_ipc_mem_handle_t handle) {
246233 (void )hContext;
247234 (void )handle;
248- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
249- abort ();
235+ FAIL_NOT_IMPLEMENTED
250236}
251237
252238ze_result_t ZE_APICALL zeMemOpenIpcHandle (ze_context_handle_t hContext,
@@ -259,16 +245,14 @@ ze_result_t ZE_APICALL zeMemOpenIpcHandle(ze_context_handle_t hContext,
259245 (void )handle;
260246 (void )flags;
261247 (void )pptr;
262- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
263- abort ();
248+ FAIL_NOT_IMPLEMENTED
264249}
265250
266251ze_result_t ZE_APICALL zeMemCloseIpcHandle (ze_context_handle_t hContext,
267252 const void *ptr) {
268253 (void )hContext;
269254 (void )ptr;
270- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
271- abort ();
255+ FAIL_NOT_IMPLEMENTED
272256}
273257
274258ze_result_t ZE_APICALL zeContextMakeMemoryResident (ze_context_handle_t hContext,
@@ -285,6 +269,5 @@ zeMemFreeExt(ze_context_handle_t hContext,
285269 (void )hContext;
286270 (void )pMemFreeDesc;
287271 (void )ptr;
288- LOG_FATAL (" not implemented, call in ze_loader_mock not passed to gmock" );
289- abort ();
272+ FAIL_NOT_IMPLEMENTED
290273}
0 commit comments