Skip to content

Commit 9cc13a9

Browse files
authored
Make ONEAPI_ROOT customizable for SPIRVRunner (#2559)
Closes #2558 Signed-off-by: Anatoly Myachev <[email protected]>
1 parent 90bf600 commit 9cc13a9

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

utils/SPIRVRunner/CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@ project(reproducer)
33
set(CMAKE_CXX_COMPILER icpx)
44
set(BUILD_SHARED_LIBS OFF)
55

6-
list(APPEND CMAKE_PREFIX_PATH "/opt/intel/oneapi/tbb/latest/lib/cmake/tbb/")
6+
if(DEFINED ENV{ONEAPI_ROOT})
7+
set(ONEAPI_ROOT "$ENV{ONEAPI_ROOT}")
8+
endif()
9+
if(NOT ONEAPI_ROOT)
10+
set(ONEAPI_ROOT "/opt/intel/oneapi")
11+
endif()
12+
13+
message(STATUS "ONEAPI_ROOT: ${ONEAPI_ROOT}")
14+
15+
list(APPEND CMAKE_PREFIX_PATH "${ONEAPI_ROOT}/tbb/latest/lib/cmake/tbb/")
716

817
find_package(Torch REQUIRED)
918

@@ -19,15 +28,17 @@ ExternalProject_Add(
1928
)
2029
set(JSON_INCLUDE_DIR ${CMAKE_BINARY_DIR}/nlohmann_json/src/json/include/)
2130

22-
# Add preview-breaking-changes for ABI compatibility with SYCL library linked by PyTorch: https://github.com/pytorch/pytorch/commit/92bebb46fa9fd60523d8aeb7b5f1a3f488c4cd93
31+
# Add preview-breaking-changes for ABI compatibility with SYCL library linked by PyTorch:
32+
# https://github.com/pytorch/pytorch/commit/92bebb46fa9fd60523d8aeb7b5f1a3f488c4cd93
2333
set(COMPILE_FLAGS "-fsycl -Wall -fpreview-breaking-changes")
2434
set(LINK_FLAGS "-fsycl -lze_loader")
2535

2636
set(SYCL_FUNCTIONS_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/intel/backend/include")
2737

2838
set(TARGET_NAME SPIRVRunner)
2939
add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp)
30-
target_include_directories(${TARGET_NAME} PRIVATE "/opt/intel/oneapi/compiler/latest/include" ${SYCL_FUNCTIONS_INCLUDE_DIR} ${JSON_INCLUDE_DIR})
40+
target_include_directories(${TARGET_NAME} PRIVATE
41+
"${ONEAPI_ROOT}/compiler/latest/include" ${SYCL_FUNCTIONS_INCLUDE_DIR} ${JSON_INCLUDE_DIR})
3142
set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
3243
set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
3344
add_dependencies(${TARGET_NAME} json)

0 commit comments

Comments
 (0)