diff --git a/.gitmodules b/.gitmodules index df0401a04ca44f..a9cad1dee5f494 100644 --- a/.gitmodules +++ b/.gitmodules @@ -72,8 +72,8 @@ [submodule "src/plugins/intel_cpu/thirdparty/mlas"] path = src/plugins/intel_cpu/thirdparty/mlas url = https://github.com/openvinotoolkit/mlas.git -[submodule "src/plugins/intel_npu/thirdparty/level-zero"] - path = src/plugins/intel_npu/thirdparty/level-zero +[submodule "thirdparty/level_zero/level-zero"] + path = thirdparty/level_zero/level-zero url = https://github.com/oneapi-src/level-zero.git [submodule "src/plugins/intel_npu/thirdparty/level-zero-ext"] path = src/plugins/intel_npu/thirdparty/level-zero-ext diff --git a/src/plugins/intel_npu/src/plugin/CMakeLists.txt b/src/plugins/intel_npu/src/plugin/CMakeLists.txt index 5287e487bf96c8..4b91e6d594cc20 100644 --- a/src/plugins/intel_npu/src/plugin/CMakeLists.txt +++ b/src/plugins/intel_npu/src/plugin/CMakeLists.txt @@ -62,8 +62,8 @@ target_include_directories(${TARGET_NAME} ) target_include_directories(${TARGET_NAME} SYSTEM PRIVATE - ${NPU_PLUGIN_SOURCE_DIR}/thirdparty/level-zero/include - ${NPU_PLUGIN_SOURCE_DIR}/thirdparty/level-zero-ext + $ + $ ) if(ENABLE_AVX2) diff --git a/src/plugins/intel_npu/src/utils/src/zero/CMakeLists.txt b/src/plugins/intel_npu/src/utils/src/zero/CMakeLists.txt index 3b1786bd92a70d..74072d21581445 100644 --- a/src/plugins/intel_npu/src/utils/src/zero/CMakeLists.txt +++ b/src/plugins/intel_npu/src/utils/src/zero/CMakeLists.txt @@ -14,8 +14,8 @@ ov_add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}) target_include_directories( ${TARGET_NAME} PUBLIC - $ - $ + $ + $ $) target_link_libraries( diff --git a/src/plugins/intel_npu/thirdparty/CMakeLists.txt b/src/plugins/intel_npu/thirdparty/CMakeLists.txt index c2edf548c2917e..4d0c66beeb7520 100644 --- a/src/plugins/intel_npu/thirdparty/CMakeLists.txt +++ b/src/plugins/intel_npu/thirdparty/CMakeLists.txt @@ -2,36 +2,13 @@ # SPDX-License-Identifier: Apache-2.0 # -set(BUILD_SHARED_LIBS OFF) - # # zeroApi # if(ENABLE_ZEROAPI_BACKEND) - # We have to avoid linking against loader with debug postfix due it's a part of driver - # and the name will be the same for release and debug configurations - set(CMAKE_DEBUG_POSTFIX "") - - # Skip warnings as errors for thirdparty - if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - ov_add_compiler_flags(/WX-) - # solve pdb access issue - set(USE_Z7 ON) - # Close spectre for ze loader - add_compile_options("/Qspectre-") - elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) - ov_add_compiler_flags(-Wno-error) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ - -Wno-undef \ - -Wno-missing-declarations") - if(UNUSED_BUT_SET_VARIABLE_SUPPORTED) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable") - endif() - endif() - set(CMAKE_COMPILE_WARNING_AS_ERROR OFF) - add_subdirectory(level-zero EXCLUDE_FROM_ALL) - - # This VERSION file created by L0 may cause compilation issue of oneTBB headers, so remove it - file(REMOVE "${CMAKE_BINARY_DIR}/VERSION") + add_library(level-zero-ext INTERFACE) + set_property(TARGET level-zero-ext APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $) + add_library(LevelZero::NPUExt ALIAS level-zero-ext) + install(TARGETS level-zero-ext EXPORT "${PROJECT_NAME}Targets") endif() diff --git a/thirdparty/dependencies.cmake b/thirdparty/dependencies.cmake index e8f28deb539efb..8313ca73178283 100644 --- a/thirdparty/dependencies.cmake +++ b/thirdparty/dependencies.cmake @@ -64,6 +64,16 @@ if(X86_64 OR X86 OR UNIVERSAL2) endif() endif() +# +# LevelZero +# + +if(ENABLE_INTEL_NPU) + add_subdirectory(thirdparty/level_zero EXCLUDE_FROM_ALL) + + add_library(LevelZero::LevelZero ALIAS ze_loader) +endif() + # # OpenCL # diff --git a/thirdparty/level_zero/CMakeLists.txt b/thirdparty/level_zero/CMakeLists.txt new file mode 100644 index 00000000000000..4bd953e812f07f --- /dev/null +++ b/thirdparty/level_zero/CMakeLists.txt @@ -0,0 +1,34 @@ +# Copyright (C) 2018-2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +set(BUILD_SHARED_LIBS OFF) + + +# We have to avoid linking against loader with debug postfix due it's a part of driver +# and the name will be the same for release and debug configurations +set(CMAKE_DEBUG_POSTFIX "") + +# Skip warnings as errors for thirdparty +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ov_add_compiler_flags(/WX-) + # solve pdb access issue + set(USE_Z7 ON) + # Close spectre for ze loader + add_compile_options("/Qspectre-") +elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) + ov_add_compiler_flags(-Wno-error) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + -Wno-undef \ + -Wno-missing-declarations") + if(UNUSED_BUT_SET_VARIABLE_SUPPORTED) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable") + endif() +endif() +set(CMAKE_COMPILE_WARNING_AS_ERROR OFF) +add_subdirectory(level-zero EXCLUDE_FROM_ALL) + +set_property(TARGET ze_loader APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $) + +# This VERSION file created by L0 may cause compilation issue of oneTBB headers, so remove it +file(REMOVE "${CMAKE_BINARY_DIR}/VERSION") diff --git a/src/plugins/intel_npu/thirdparty/level-zero b/thirdparty/level_zero/level-zero similarity index 100% rename from src/plugins/intel_npu/thirdparty/level-zero rename to thirdparty/level_zero/level-zero