Skip to content

Commit 680a2f3

Browse files
committed
Copy L0 headers to level_zero directory to handle includes in compute-runtime headers
Headers that we bring from compute-runtime assume that headers are in the level_zero directory.
1 parent 45ff924 commit 680a2f3

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

cmake/FetchLevelZero.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ target_link_libraries(LevelZeroLoader
8989
INTERFACE "${LEVEL_ZERO_LIB_NAME}"
9090
)
9191

92+
file(GLOB LEVEL_ZERO_LOADER_API_HEADERS "${LEVEL_ZERO_INCLUDE_DIR}/*.h")
93+
file(COPY ${LEVEL_ZERO_LOADER_API_HEADERS} DESTINATION ${LEVEL_ZERO_INCLUDE_DIR}/level_zero)
9294
add_library(LevelZeroLoader-Headers INTERFACE)
9395
target_include_directories(LevelZeroLoader-Headers
94-
INTERFACE "$<BUILD_INTERFACE:${LEVEL_ZERO_INCLUDE_DIR}>"
96+
INTERFACE "$<BUILD_INTERFACE:${LEVEL_ZERO_INCLUDE_DIR};${LEVEL_ZERO_INCLUDE_DIR}/level_zero>"
9597
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
9698
)
9799

source/adapters/level_zero/device.hpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,12 @@
1818
#include <unordered_map>
1919
#include <vector>
2020

21+
#include "adapters/level_zero/platform.hpp"
22+
#include "common.hpp"
23+
#include <level_zero/include/ze_intel_gpu.h>
2124
#include <ur/ur.hpp>
2225
#include <ur_ddi.h>
23-
// Make sure that we don't reorder these includes during formatting. Across the
24-
// codebase we include <ze_api.h> (not <level_zero/ze_api.h>) which guarantees
25-
// that we use up-to-date fetched Level Zero headers and not some headers from
26-
// the system (which might be out-of-date). ze_intel_gpu.h includes
27-
// <level_zero/ze_api.h>, so if we include it first then it is possible that we
28-
// mistakenly use the headers insalled in the system.
29-
// clang-format off
3026
#include <ze_api.h>
31-
#include <level_zero/include/ze_intel_gpu.h>
32-
// clang-format on
33-
#include "adapters/level_zero/platform.hpp"
34-
#include "common.hpp"
3527
#include <zes_api.h>
3628

3729
enum EventsScope {

0 commit comments

Comments
 (0)