Skip to content

Commit 889d7cf

Browse files
committed
Added WA for multiple export sets
1 parent 695afdd commit 889d7cf

File tree

5 files changed

+59
-6
lines changed

5 files changed

+59
-6
lines changed

cmake/features.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ endif()
4343

4444
ov_dependent_option (ENABLE_ONEDNN_FOR_GPU "Enable oneDNN with GPU support" ${ENABLE_ONEDNN_FOR_GPU_DEFAULT} "ENABLE_INTEL_GPU" OFF)
4545

46+
if(BUILD_SHARED_LIBS OR NOT ENABLE_INTEL_CPU)
47+
set(ENABLE_GPU_USE_CPUS_ONEDNN_DEFAULT OFF)
48+
else()
49+
set(ENABLE_GPU_USE_CPUS_ONEDNN_DEFAULT ON)
50+
endif()
51+
52+
# TODO: remove
53+
set(ENABLE_GPU_USE_CPUS_ONEDNN_DEFAULT ON)
54+
55+
ov_dependent_option (ENABLE_GPU_USE_CPUS_ONEDNN "Enable GPU to use oneDNN from CPU" ${ENABLE_GPU_USE_CPUS_ONEDNN_DEFAULT} "ENABLE_ONEDNN_FOR_GPU;ENABLE_INTEL_CPU" OFF)
56+
4657
ov_option (ENABLE_DEBUG_CAPS "enable OpenVINO debug capabilities at runtime" OFF)
4758
ov_dependent_option (ENABLE_GPU_DEBUG_CAPS "enable GPU debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS;ENABLE_INTEL_GPU" OFF)
4859
ov_dependent_option (ENABLE_CPU_DEBUG_CAPS "enable CPU debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS;ENABLE_INTEL_CPU" OFF)

src/plugins/intel_cpu/thirdparty/CMakeLists.txt

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,32 @@ function(ov_add_onednn_common)
6363
# GPU specific options
6464
#
6565

66-
if(NOT BUILD_SHARED_LIBS AND ENABLE_ONEDNN_FOR_GPU)
66+
if(NOT BUILD_SHARED_LIBS AND ENABLE_ONEDNN_FOR_GPU OR ENABLE_GPU_USE_CPUS_ONEDNN)
6767
# build oneDNN to be compatible with Intel GPU plugin
6868
set(DNNL_ENABLE_PRIMITIVE_GPU_ISA "XEHP;XEHPG;XEHPC" CACHE STRING "" FORCE)
6969
set(DNNL_GPU_RUNTIME "OCL" CACHE STRING "" FORCE)
70+
71+
# Keep in sync with https://github.com/openvinotoolkit/openvino/blob/releases/2024/0/src/plugins/intel_gpu/CMakeLists.txt#L30
72+
set(INTEL_GPU_TARGET_OCL_VERSION "200" CACHE STRING "Target version of OpenCL which should be used by GPU plugin")
73+
add_definitions(-DCL_TARGET_OPENCL_VERSION=${INTEL_GPU_TARGET_OCL_VERSION})
74+
75+
if(INTEL_GPU_TARGET_OCL_VERSION STREQUAL "300")
76+
set(ONEDNN_CL_VERSION "3_0")
77+
elseif(INTEL_GPU_TARGET_OCL_VERSION STREQUAL "220")
78+
set(ONEDNN_CL_VERSION "2_2")
79+
elseif(INTEL_GPU_TARGET_OCL_VERSION STREQUAL "210")
80+
set(ONEDNN_CL_VERSION "2_1")
81+
elseif(INTEL_GPU_TARGET_OCL_VERSION STREQUAL "200")
82+
set(ONEDNN_CL_VERSION "2_0")
83+
elseif(INTEL_GPU_TARGET_OCL_VERSION STREQUAL "120")
84+
set(ONEDNN_CL_VERSION "1_2")
85+
elseif(INTEL_GPU_TARGET_OCL_VERSION STREQUAL "100")
86+
set(ONEDNN_CL_VERSION "1_0")
87+
else()
88+
message(FATAL_ERROR "Unsupported version of OpenCL: ${INTEL_GPU_TARGET_OCL_VERSION}")
89+
endif()
90+
91+
set(OPENCL_VERSION_${ONEDNN_CL_VERSION} ON)
7092
else()
7193
set(DNNL_GPU_RUNTIME "NONE" CACHE STRING "" FORCE)
7294
endif()

src/plugins/intel_gpu/thirdparty/CMakeLists.txt

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@ function(ov_build_onednn_gpu)
3333
message(WARNING "Intel GPU plugin unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}")
3434
endif()
3535

36+
if(INTEL_GPU_TARGET_OCL_VERSION STREQUAL "300")
37+
set(ONEDNN_CL_VERSION "3_0")
38+
elseif(INTEL_GPU_TARGET_OCL_VERSION STREQUAL "220")
39+
set(ONEDNN_CL_VERSION "2_2")
40+
elseif(INTEL_GPU_TARGET_OCL_VERSION STREQUAL "210")
41+
set(ONEDNN_CL_VERSION "2_1")
42+
elseif(INTEL_GPU_TARGET_OCL_VERSION STREQUAL "200")
43+
set(ONEDNN_CL_VERSION "2_0")
44+
elseif(INTEL_GPU_TARGET_OCL_VERSION STREQUAL "120")
45+
set(ONEDNN_CL_VERSION "1_2")
46+
elseif(INTEL_GPU_TARGET_OCL_VERSION STREQUAL "100")
47+
set(ONEDNN_CL_VERSION "1_0")
48+
else()
49+
message(FATAL_ERROR "Unsupported version of OpenCL: ${INTEL_GPU_TARGET_OCL_VERSION}")
50+
endif()
51+
3652
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
3753
ov_add_compiler_flags(-Wno-undef)
3854
ov_add_compiler_flags(-Wno-missing-declarations)
@@ -119,6 +135,7 @@ function(ov_build_onednn_gpu)
119135
"-DDNNL_LIBRARY_TYPE=STATIC"
120136
"-DDNNL_EXPERIMENTAL_PROFILING=ON"
121137
"-DONEDNN_BUILD_GRAPH=OFF"
138+
"-DOPENCL_VERSION_${ONEDNN_CL_VERSION}=ON"
122139
# specifically for Conan, because it overrides CMAKE_PREFIX_PATH and oneDNN's FindOpenCL.cmake is ignored
123140
# Conan's FindOpenCL.cmake module does not set OpenCL_INCLUDE_DIRS, so we need to set it manually
124141
"-DOpenCL_INCLUDE_DIRS=$<TARGET_PROPERTY:OpenCL::OpenCL,INTERFACE_INCLUDE_DIRECTORIES>"
@@ -156,9 +173,7 @@ function(ov_build_onednn_gpu)
156173
endfunction()
157174

158175
if(ENABLE_ONEDNN_FOR_GPU)
159-
# if(BUILD_SHARED_LIBS OR NOT ENABLE_INTEL_CPU)
160-
# ov_build_onednn_gpu()
161-
# else()
176+
if(ENABLE_GPU_USE_CPUS_ONEDNN)
162177
# in case of static libraries, Intel GPU shares oneDNN with CPU plugin
163178
set(DNNL_GPU_LIBRARY_NAME "openvino_onednn_cpu" CACHE STRING "Name of oneDNN library for Intel GPU Plugin")
164179

@@ -172,5 +187,7 @@ if(ENABLE_ONEDNN_FOR_GPU)
172187
INTERFACE_COMPILE_DEFINITIONS ENABLE_ONEDNN_FOR_GPU)
173188

174189
ov_install_static_lib(onednn_gpu_tgt ${OV_CPACK_COMP_CORE})
175-
# endif()
190+
else()
191+
ov_build_onednn_gpu()
192+
endif()
176193
endif()

thirdparty/ocl/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ set(opencl_root_hints "${OpenCL_INCLUDE_DIR}" PARENT_SCOPE)
5959
# installation
6060

6161
ov_install_static_lib(OpenCL ${OV_CPACK_COMP_CORE})
62+
63+
install(TARGETS OpenCL EXPORT dnnl-targets
64+
ARCHIVE DESTINATION ${OV_CPACK_ARCHIVEDIR} COMPONENT ${OV_CPACK_COMP_CORE})

0 commit comments

Comments
 (0)