Skip to content

Commit 4083c74

Browse files
author
Diptorup Deb
committed
Changes to build files to use the new FindLevelZero.cmake module.
- Bumps Cmake requirement to 3.20 as we use cmake_path in the FindLevelZero module. - Adds a new environment variable to turn off level zero version checking as needed. - Updates CMakeLists.txt inside dpcomp_gpu_runtime. - Update azurepipeline to not use Level Zero version checks.
1 parent b63147e commit 4083c74

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
cmake_minimum_required(VERSION 3.5)
15+
cmake_minimum_required(VERSION 3.20)
1616

1717
project(mlir-extensions)
1818

@@ -30,6 +30,8 @@ if(POLICY CMP0116)
3030
cmake_policy(SET CMP0116 OLD)
3131
endif()
3232

33+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
34+
3335
# SDL
3436
# set(CMAKE_VERBOSE_MAKEFILE on) # enable for debug
3537
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
@@ -66,11 +68,15 @@ macro(apply_llvm_compile_flags target)
6668
if (MSVC)
6769
target_compile_options(${target} PRIVATE /EHsc)
6870
endif ()
69-
7071
target_compile_definitions(${target} PRIVATE ${LLVM_DEFINITIONS})
7172
endmacro()
7273

7374
if(GPU_ENABLE)
75+
if(DEFINED ENV{LEVEL_ZERO_VERSION_CHECK_OFF})
76+
find_package(LevelZero REQUIRED)
77+
else()
78+
find_package(LevelZero 1.6 REQUIRED)
79+
endif()
7480
add_subdirectory(dpcomp_gpu_runtime)
7581
endif()
7682

azure-pipelines.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
- script: |
9090
git clone https://github.com/oneapi-src/level-zero.git
9191
cd level-zero
92-
git checkout v1.5.0
92+
git checkout v1.6.2
9393
mkdir level_zero_install
9494
mkdir build
9595
cd build
@@ -111,6 +111,7 @@ jobs:
111111
export LLVM_PATH=$(System.DefaultWorkingDirectory)/llvm_cache
112112
export TBB_PATH=$(System.DefaultWorkingDirectory)/tbb
113113
export LEVEL_ZERO_DIR=$(System.DefaultWorkingDirectory)/level-zero/level_zero_install
114+
export LEVEL_ZERO_VERSION_CHECK_OFF=1
114115
export OCL_ICD_FILENAMES_RESET=1
115116
export OCL_ICD_FILENAMES=libintelocl.so
116117
export SYCL_DEVICE_FILTER=opencl:cpu

dpcomp_gpu_runtime/CMakeLists.txt

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,24 @@ project(dpcomp-gpu-runtime LANGUAGES CXX C)
1616

1717
include(GenerateExportHeader)
1818

19-
if(NOT LEVEL_ZERO_DIR)
20-
message(FATAL_ERROR "LEVEL_ZERO_DIR is not set")
21-
endif()
22-
2319
set(SOURCES_LIST
2420
lib/gpu_runtime.cpp
25-
)
21+
)
2622
set(HEADERS_LIST
2723
lib/level_zero_printing.hpp
2824
lib/level_zero_wrapper.hpp
29-
)
25+
)
3026

3127
add_library(${PROJECT_NAME} SHARED ${SOURCES_LIST} ${HEADERS_LIST})
3228
generate_export_header(${PROJECT_NAME})
3329

3430
target_include_directories(${PROJECT_NAME} PRIVATE
3531
${PROJECT_BINARY_DIR}
36-
${LEVEL_ZERO_DIR}/include
37-
)
32+
${LevelZero_INCLUDE_DIR}
33+
)
3834

3935
target_link_directories(${PROJECT_NAME} PRIVATE
40-
${LEVEL_ZERO_DIR}/lib
41-
)
36+
${LevelZero_LIBRARIES_DIR}
37+
)
4238

43-
target_link_libraries(${PROJECT_NAME} PRIVATE ze_loader)
39+
target_link_libraries(${PROJECT_NAME} PRIVATE ${LevelZero_LIBRARY})

numba_dpcomp/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
else:
9090
print("LEVEL_ZERO_DIR is", LEVEL_ZERO_DIR)
9191
cmake_cmd += [
92-
"-DLEVEL_ZERO_DIR=" + LEVEL_ZERO_DIR,
9392
"-DGPU_ENABLE=ON",
9493
]
9594

0 commit comments

Comments
 (0)