|
7 | 7 | * |
8 | 8 | */ |
9 | 9 |
|
10 | | -#ifndef UMF_EXAMPLE_UTILS_LEVEL_ZERO_H |
11 | | -#define UMF_EXAMPLE_UTILS_LEVEL_ZERO_H |
12 | | - |
13 | 10 | #include <stdio.h> |
14 | 11 | #include <stdlib.h> |
15 | 12 |
|
16 | | -// To use the Level Zero API, the Level Zero SDK has to be installed |
17 | | -// on the system |
18 | | -#ifdef _WIN32 |
19 | | -#include <ze_api.h> |
20 | | -#else |
21 | | -#include <level_zero/ze_api.h> |
22 | | -#endif |
| 13 | +#include "examples_level_zero_helpers.h" |
23 | 14 |
|
24 | | -static int init_level_zero(void) { |
| 15 | +int init_level_zero(void) { |
25 | 16 | ze_init_flag_t flags = ZE_INIT_FLAG_GPU_ONLY; |
26 | 17 | ze_result_t result = zeInit(flags); |
27 | 18 | if (result != ZE_RESULT_SUCCESS) { |
@@ -118,8 +109,7 @@ static inline int get_devices(ze_driver_handle_t driver, uint32_t *devices_num_, |
118 | 109 | return ret; |
119 | 110 | } |
120 | 111 |
|
121 | | -static inline int find_driver_with_gpu(uint32_t *driver_idx, |
122 | | - ze_driver_handle_t *driver_) { |
| 112 | +int find_driver_with_gpu(uint32_t *driver_idx, ze_driver_handle_t *driver_) { |
123 | 113 | int ret = 0; |
124 | 114 | ze_result_t ze_result; |
125 | 115 | uint32_t drivers_num = 0; |
@@ -184,8 +174,7 @@ static inline int find_driver_with_gpu(uint32_t *driver_idx, |
184 | 174 | return ret; |
185 | 175 | } |
186 | 176 |
|
187 | | -static inline int find_gpu_device(ze_driver_handle_t driver, |
188 | | - ze_device_handle_t *device_) { |
| 177 | +int find_gpu_device(ze_driver_handle_t driver, ze_device_handle_t *device_) { |
189 | 178 | int ret = -1; |
190 | 179 | uint32_t devices_num = 0; |
191 | 180 | ze_device_handle_t *devices = NULL; |
@@ -415,5 +404,3 @@ int destroy_context(ze_context_handle_t context) { |
415 | 404 |
|
416 | 405 | return 0; |
417 | 406 | } |
418 | | - |
419 | | -#endif // UMF_EXAMPLE_UTILS_LEVEL_ZERO_H |
0 commit comments