Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[GPU][Level Zero] L0 CI build fixes (#35575)

Mikolaj Roszczyke3d72c22a04c
diff --git a/src/common/zero_loader/CMakeLists.txt b/src/common/zero_loader/CMakeLists.txt
index bc9d2cdc5c4..6362b5bf082 100644
--- a/src/common/zero_loader/CMakeLists.txt
+++ b/src/common/zero_loader/CMakeLists.txt
@@ -10,9 +10,9 @@ file(GLOB_RECURSE PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp)
add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${PUBLIC_HEADERS})
add_library(openvino::zero_loader ALIAS ${TARGET_NAME})
-target_link_libraries(${TARGET_NAME} PUBLIC LevelZero::Headers openvino::runtime::dev PRIVATE openvino::util)
+target_link_libraries(${TARGET_NAME} PUBLIC LevelZero::Headers PRIVATE openvino::runtime openvino::util)
target_include_directories(${TARGET_NAME}
- PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
ov_developer_package_export_targets(TARGET level_zero_headers)
ov_install_static_lib(level_zero_headers ${OV_CPACK_COMP_CORE})
diff --git a/src/common/zero_loader/include/openvino/zero_api.hpp b/src/common/zero_loader/include/openvino/zero_api.hpp
index 01515998f92..78f4728352a 100644
--- a/src/common/zero_loader/include/openvino/zero_api.hpp
+++ b/src/common/zero_loader/include/openvino/zero_api.hpp
@@ -9,8 +9,6 @@
#include <memory>
-#include "openvino/core/except.hpp"
-
namespace ov {
// clang-format off
@@ -138,9 +136,9 @@ private:
#define symbol_statement(symbol) \
template <typename... Args> \
inline typename std::invoke_result<decltype(&::symbol), Args...>::type wrapped_##symbol(Args... args) { \
- const auto& ptr = ZeroApi::get_instance(); \
+ const auto& ptr = ZeroApi::get_instance(); \
if (ptr->symbol == nullptr) { \
- OPENVINO_THROW("Unsupported symbol " #symbol); \
+ return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; \
} \
return ptr->symbol(std::forward<Args>(args)...); \
}
diff --git a/src/common/zero_loader/src/zero.api.cpp b/src/common/zero_loader/src/zero.api.cpp
index 99c71607ebc..06e3c536b3b 100644
--- a/src/common/zero_loader/src/zero.api.cpp
+++ b/src/common/zero_loader/src/zero.api.cpp
@@ -8,6 +8,7 @@
#include "openvino/util/file_util.hpp"
#include "openvino/util/shared_object.hpp"
+#include "openvino/core/except.hpp"
#ifndef _WIN32
# define LIB_ZE_LOADER_SUFFIX ".1"
diff --git a/src/plugins/intel_gpu/src/graph/CMakeLists.txt b/src/plugins/intel_gpu/src/graph/CMakeLists.txt
index 380159c387e..26c3caa82fa 100644
--- a/src/plugins/intel_gpu/src/graph/CMakeLists.txt
+++ b/src/plugins/intel_gpu/src/graph/CMakeLists.txt
@@ -34,8 +34,14 @@ set(COMMON_LINK_LIBRARIES openvino::shape_inference # for tensor accessor
openvino::itt
openvino::runtime::dev
openvino::runtime
+ OpenCL::OpenCL # Onednn needs OCL headers even when running L0
)
+if(GPU_RT_TYPE STREQUAL "L0")
+ # Onednn needs L0 headers
+ list(APPEND COMMON_LINK_LIBRARIES openvino::zero_loader)
+endif()
+
define_property(GLOBAL PROPERTY EXTRA_LINK_LIBRARIES_GLOBAL BRIEF_DOCS "All link libs" FULL_DOCS "Link libraries collection from all backends")
set_property(GLOBAL PROPERTY EXTRA_LINK_LIBRARIES_GLOBAL "")
@@ -84,10 +90,6 @@ macro(ov_gpu_add_backend_target)
target_include_directories(${ARG_NAME} SYSTEM BEFORE PRIVATE $<TARGET_PROPERTY:onednn_gpu_tgt,INTERFACE_INCLUDE_DIRECTORIES>)
add_dependencies(openvino_intel_gpu_${IMPL_TYPE}_obj onednn_gpu_tgt)
endif()
- # Onednn headers use OCL/L0 headers
- ov_gpu_set_runtime_interface_for(openvino_intel_gpu_${IMPL_TYPE}_obj)
- # Onednn needs OCL headers even when running L0
- target_link_libraries(openvino_intel_gpu_${IMPL_TYPE}_obj PRIVATE OpenCL::OpenCL)
endmacro()
set(CODEGEN_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/common_utils/kernels_db_gen.py")
@@ -139,9 +141,6 @@ ov_build_target_faster(${TARGET_NAME} PCH)
target_compile_options(${TARGET_NAME} PRIVATE ${COMMON_COMPILE_OPTIONS})
ov_set_threading_interface_for(${TARGET_NAME})
-ov_gpu_set_runtime_interface_for(${TARGET_NAME})
-# Onednn needs OCL headers even when running L0
-target_link_libraries(${TARGET_NAME} PRIVATE OpenCL::OpenCL)
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
diff --git a/src/plugins/intel_gpu/src/runtime/ze/compute_runtime/ze_intel_gpu.h b/src/plugins/intel_gpu/src/runtime/ze/compute_runtime/ze_intel_gpu.h
index 36c59bf95b4..d97e6f9d45f 100644
--- a/src/plugins/intel_gpu/src/runtime/ze/compute_runtime/ze_intel_gpu.h
+++ b/src/plugins/intel_gpu/src/runtime/ze/compute_runtime/ze_intel_gpu.h
@@ -57,10 +57,10 @@ typedef enum _ze_intel_device_module_dp_exp_flag_t {
/// `pNext` member of ::ze_device_module_properties_t.
/// @brief Device module dot product properties
typedef struct _ze_intel_device_module_dp_exp_properties_t {
- ze_structure_type_ext_t stype = ZE_STRUCTURE_INTEL_DEVICE_MODULE_DP_EXP_PROPERTIES; ///< [in] type of this structure
- void *pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
- ///< structure (i.e. contains sType and pNext).
- ze_intel_device_module_dp_exp_flags_t flags; ///< [out] 0 (none) or a valid combination of ::ze_intel_device_module_dp_flag_t
+ ze_structure_type_ext_t stype; ///< [in] type of this structure
+ void *pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
+ ///< structure (i.e. contains sType and pNext).
+ ze_intel_device_module_dp_exp_flags_t flags; ///< [out] 0 (none) or a valid combination of ::ze_intel_device_module_dp_flag_t
} ze_intel_device_module_dp_exp_properties_t;
#ifndef ZE_INTEL_COMMAND_LIST_MEMORY_SYNC
diff --git a/src/plugins/intel_gpu/src/runtime/ze/ze_device.cpp b/src/plugins/intel_gpu/src/runtime/ze/ze_device.cpp
index 85546de7fd1..82950b8a4aa 100644
--- a/src/plugins/intel_gpu/src/runtime/ze/ze_device.cpp
+++ b/src/plugins/intel_gpu/src/runtime/ze/ze_device.cpp
@@ -198,7 +198,7 @@ device_info init_device_info(ze_driver_handle_t driver, ze_device_handle_t devic
if (mem_properties != device_memory_properties.end()) {
info.max_global_mem_size = mem_properties->totalSize;
- info.device_memory_ordinal = std::distance(device_memory_properties.begin(), mem_properties);
+ info.device_memory_ordinal = static_cast<uint32_t>(std::distance(device_memory_properties.begin(), mem_properties));
} else {
info.max_global_mem_size = 0;
info.device_memory_ordinal = 0;
@@ -249,7 +249,7 @@ device_info init_device_info(ze_driver_handle_t driver, ze_device_handle_t devic
info.kernel_timestamp_valid_bits = device_properties.kernelTimestampValidBits;
info.timer_resolution = device_properties.timerResolution;
- info.compute_queue_group_ordinal = std::distance(queue_properties.begin(), compute_queue_props);
+ info.compute_queue_group_ordinal = static_cast<uint32_t>(std::distance(queue_properties.begin(), compute_queue_props));
static_assert(ZE_MAX_DEVICE_UUID_SIZE == ov::device::UUID::MAX_UUID_SIZE, "");
static_assert(ZE_MAX_DEVICE_LUID_SIZE_EXT == ov::device::LUID::MAX_LUID_SIZE, "");
diff --git a/src/plugins/intel_gpu/src/runtime/ze/ze_device.hpp b/src/plugins/intel_gpu/src/runtime/ze/ze_device.hpp
index b65da38b44a..bbd65c03250 100644
--- a/src/plugins/intel_gpu/src/runtime/ze/ze_device.hpp
+++ b/src/plugins/intel_gpu/src/runtime/ze/ze_device.hpp
@@ -22,9 +22,9 @@ public:
void initialize() override;
bool is_initialized() const override;
- const ze_driver_handle_t get_driver() const { return _driver; }
- const ze_device_handle_t get_device() const { return _device; }
- const ze_context_handle_t get_context() const { return _context; }
+ ze_driver_handle_t get_driver() const { return _driver; }
+ ze_device_handle_t get_device() const { return _device; }
+ ze_context_handle_t get_context() const { return _context; }
bool is_same(const device::ptr other) override;
void set_mem_caps(const memory_capabilities& memory_capabilities) override;
diff --git a/src/plugins/intel_gpu/src/runtime/ze/ze_engine.cpp b/src/plugins/intel_gpu/src/runtime/ze/ze_engine.cpp
index e2838f46fcb..6619fcd15fe 100644
--- a/src/plugins/intel_gpu/src/runtime/ze/ze_engine.cpp
+++ b/src/plugins/intel_gpu/src/runtime/ze/ze_engine.cpp
@@ -47,19 +47,19 @@ void ze_engine::create_onednn_engine(const ExecutionConfig& config) {
}
#endif
-const ze_driver_handle_t ze_engine::get_driver() const {
+ze_driver_handle_t ze_engine::get_driver() const {
auto casted = std::dynamic_pointer_cast<ze_device>(_device);
OPENVINO_ASSERT(casted, "[GPU] Invalid device type for ze_engine");
return casted->get_driver();
}
-const ze_context_handle_t ze_engine::get_context() const {
+ze_context_handle_t ze_engine::get_context() const {
auto casted = std::dynamic_pointer_cast<ze_device>(_device);
OPENVINO_ASSERT(casted, "[GPU] Invalid device type for ze_engine");
return casted->get_context();
}
-const ze_device_handle_t ze_engine::get_device() const {
+ze_device_handle_t ze_engine::get_device() const {
auto casted = std::dynamic_pointer_cast<ze_device>(_device);
OPENVINO_ASSERT(casted, "[GPU] Invalid device type for ze_engine");
return casted->get_device();
diff --git a/src/plugins/intel_gpu/src/runtime/ze/ze_engine.hpp b/src/plugins/intel_gpu/src/runtime/ze/ze_engine.hpp
index 75d34544328..0af7a2aac12 100644
--- a/src/plugins/intel_gpu/src/runtime/ze/ze_engine.hpp
+++ b/src/plugins/intel_gpu/src/runtime/ze/ze_engine.hpp
@@ -32,9 +32,9 @@ public:
allocation_type get_default_allocation_type() const override { return allocation_type::usm_device; }
allocation_type detect_usm_allocation_type(const void* memory) const override;
- const ze_context_handle_t get_context() const;
- const ze_driver_handle_t get_driver() const;
- const ze_device_handle_t get_device() const;
+ ze_context_handle_t get_context() const;
+ ze_driver_handle_t get_driver() const;
+ ze_device_handle_t get_device() const;
stream_ptr create_stream(const ExecutionConfig& config) const override;
stream_ptr create_stream(const ExecutionConfig& config, void *handle) const override;
diff --git a/src/plugins/intel_gpu/src/runtime/ze/ze_kernel_builder.hpp b/src/plugins/intel_gpu/src/runtime/ze/ze_kernel_builder.hpp
index 9b0b2b93105..4d128ec5e07 100644
--- a/src/plugins/intel_gpu/src/runtime/ze/ze_kernel_builder.hpp
+++ b/src/plugins/intel_gpu/src/runtime/ze/ze_kernel_builder.hpp
@@ -14,7 +14,7 @@
#include <mutex>
namespace cldnn {
namespace ocl {
-struct ocl_kernel_builder;
+class ocl_kernel_builder;
struct ocl_device;
} // namespace ocl
namespace ze {
diff --git a/src/plugins/intel_gpu/src/runtime/ze/ze_memory.cpp b/src/plugins/intel_gpu/src/runtime/ze/ze_memory.cpp
index 4231bb1a692..b037aeca88f 100644
--- a/src/plugins/intel_gpu/src/runtime/ze/ze_memory.cpp
+++ b/src/plugins/intel_gpu/src/runtime/ze/ze_memory.cpp
@@ -211,13 +211,14 @@ event::ptr gpu_usm::fill(stream& stream, unsigned char pattern, const std::vecto
auto ev = _ze_stream.create_base_event();
auto ev_ze = downcast<ze::ze_base_event>(ev.get())->get_handle();
auto ze_dep_events = get_ze_events(dep_events);
+ const auto num_ze_dep_events = static_cast<uint32_t>(ze_dep_events.size());
OV_ZE_EXPECT(ze::zeCommandListAppendMemoryFill(_ze_stream.get_queue(),
_buffer.get(),
&pattern,
sizeof(unsigned char),
_bytes_count,
ev_ze,
- ze_dep_events.size(),
+ num_ze_dep_events,
ze_dep_events.data()));
if (blocking) {
ev->wait();
diff --git a/src/plugins/intel_gpu/thirdparty/CMakeLists.txt b/src/plugins/intel_gpu/thirdparty/CMakeLists.txt
index 225ef95d69d..bffbf511a53 100644
--- a/src/plugins/intel_gpu/thirdparty/CMakeLists.txt
+++ b/src/plugins/intel_gpu/thirdparty/CMakeLists.txt
@@ -36,6 +36,7 @@ if(ENABLE_ONEDNN_FOR_GPU)
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG OR (OV_COMPILER_IS_INTEL_LLVM AND UNIX))
ov_add_compiler_flags(-Wno-undef)
ov_add_compiler_flags(-Wno-missing-declarations)
+ ov_add_compiler_flags(-Wno-ignored-attributes)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11 AND CMAKE_COMPILER_IS_GNUCXX)
ov_add_compiler_flags(-Wno-array-bounds)
ov_add_compiler_flags(-Wno-stringop-overflow)
@@ -104,6 +105,12 @@ if(ENABLE_ONEDNN_FOR_GPU)
endif()
if(OpenCL_INCLUDE_DIR)
list(APPEND cmake_extra_args "-DOpenCL_INCLUDE_DIR=${OpenCL_INCLUDE_DIR}")
+ elseif(TARGET OpenCL::OpenCL)
+ # If OpenCL target exists but OpenCL_INCLUDE_DIR is not set, extract from target
+ get_target_property(opencl_include_dirs OpenCL::OpenCL INTERFACE_INCLUDE_DIRECTORIES)
+ if(opencl_include_dirs)
+ list(APPEND cmake_extra_args "-DOpenCL_INCLUDE_DIRS=${opencl_include_dirs}")
+ endif()
endif()
set(onednn_gpu_lib "${CMAKE_STATIC_LIBRARY_PREFIX}${DNNL_GPU_LIBRARY_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}")
@@ -111,8 +118,13 @@ if(ENABLE_ONEDNN_FOR_GPU)
set(ONEDNN_GPU_DIR ${CMAKE_CURRENT_SOURCE_DIR}/onednn_gpu CACHE FILEPATH "Path to oneDNN GPU repository")
if(GPU_RUNTIME STREQUAL "L0")
set(ONEDNN_GPU_RT "ZE")
+ # OneDNN is using different version of L0 headers
+ # Disable LTO to avoid build issues
+ # Enable once headers are unified MFDNN-14973
+ set(ONEDNN_ENABLE_LTO OFF)
elseif(GPU_RUNTIME STREQUAL "OCL")
set(ONEDNN_GPU_RT "OCL")
+ set(ONEDNN_ENABLE_LTO ${ENABLE_LTO})
endif()
ExternalProject_Add(onednn_gpu_build
@@ -124,7 +136,7 @@ if(ENABLE_ONEDNN_FOR_GPU)
# Configure Step Options:
CMAKE_ARGS
${cmake_extra_args}
- "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=${ENABLE_LTO}"
+ "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=${ONEDNN_ENABLE_LTO}"
"-DCMAKE_POLICY_DEFAULT_CMP0069=NEW"
"-DDNNL_TARGET_ARCH=${ONEDNN_TARGET_ARCH}"
"-DDNNL_CPU_RUNTIME=NONE"
@@ -143,9 +155,6 @@ if(ENABLE_ONEDNN_FOR_GPU)
"-DDNNL_EXPERIMENTAL_PROFILING=ON"
"-DONEDNN_BUILD_GRAPH=OFF"
"-DDNNL_EXPERIMENTAL_GROUPED_MEMORY=ON"
- # specifically for Conan, because it overrides CMAKE_PREFIX_PATH and oneDNN's FindOpenCL.cmake is ignored
- # Conan's FindOpenCL.cmake module does not set OpenCL_INCLUDE_DIRS, so we need to set it manually
- "-DOpenCL_INCLUDE_DIRS=$<TARGET_PROPERTY:OpenCL::OpenCL,INTERFACE_INCLUDE_DIRECTORIES>"
# Conan calls cmake with default value for CMP0091, so we have to bypass it to oneDNN build
# because we bypass conan_toolchain.cmake via CMAKE_TOOLCHAIN_FILE
"-DCMAKE_POLICY_DEFAULT_CMP0091=NEW"