Skip to content

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

[GPU] Split graph backend archives for large debug builds (#39780)

Mikhail Ryzhov58b4a712a51e
diff --git a/src/plugins/intel_gpu/src/graph/CMakeLists.txt b/src/plugins/intel_gpu/src/graph/CMakeLists.txt
index 12b57738356..aa3041943b4 100644
--- a/src/plugins/intel_gpu/src/graph/CMakeLists.txt
+++ b/src/plugins/intel_gpu/src/graph/CMakeLists.txt
@@ -82,7 +82,7 @@ macro(ov_gpu_add_backend_target)
ov_add_target(
NAME ${ARG_NAME}
SOURCES ${ARG_SOURCES}
- TYPE OBJECT
+ TYPE STATIC
INCLUDES
PRIVATE
${TARGET_INCLUDES}
@@ -101,10 +101,10 @@ macro(ov_gpu_add_backend_target)
# We use onednn headers all over the graph module, so we have to append includes to all backends and add a dependency between targets
if (ENABLE_ONEDNN_FOR_GPU)
target_include_directories(${ARG_NAME} SYSTEM BEFORE PRIVATE $<TARGET_PROPERTY:onednn_gpu_tgt${OV_GPU_SUFFIX},INTERFACE_INCLUDE_DIRECTORIES>)
- add_dependencies(openvino_intel_gpu_${IMPL_TYPE}_obj${OV_GPU_SUFFIX} onednn_gpu_tgt${OV_GPU_SUFFIX})
+ add_dependencies(${ARG_NAME} onednn_gpu_tgt${OV_GPU_SUFFIX})
endif()
- # The graph backend implementations are compiled in these per-backend OBJECT
+ # The graph backend implementations are compiled in these per-backend STATIC
# libraries, which the openvino_intel_gpu_graph STATIC lib links but excludes
# from its own sources, so clang-tidy must be applied here to cover them too.
ov_apply_clang_tidy(TARGET ${ARG_NAME})
@@ -130,8 +130,9 @@ foreach(IMPL_TYPE IN LISTS AVAILABLE_IMPL_TYPES)
continue()
endif()
add_subdirectory(impls/${IMPL_TYPE} impls/${IMPL_TYPE}${OV_GPU_SUFFIX})
- if (TARGET openvino_intel_gpu_${IMPL_TYPE}_obj${OV_GPU_SUFFIX})
- list(APPEND OBJ_FILES $<TARGET_OBJECTS:openvino_intel_gpu_${IMPL_TYPE}_obj${OV_GPU_SUFFIX}>)
+ set(BACKEND_TARGET openvino_intel_gpu_${IMPL_TYPE}_backend${OV_GPU_SUFFIX})
+ if (TARGET ${BACKEND_TARGET})
+ list(APPEND BACKEND_LIBS ${BACKEND_TARGET})
endif()
endforeach()
@@ -141,8 +142,6 @@ ov_add_target(
NAME ${TARGET_NAME}
TYPE STATIC
SOURCES ${GPU_GRAPH_SOURCES}
- OBJECT_FILES
- ${OBJ_FILES}
INCLUDES
PUBLIC
${COMMON_INCLUDE_DIRS}
@@ -157,6 +156,15 @@ ov_add_target(
ov_build_target_faster(${TARGET_NAME} PCH)
+# Backends are kept out of the graph archive, so that no single archive grows past MSVC's
+# 4 GB limit when debug information is embedded into objects. Graph and backends reference
+# each other, so both directions are link-only dependencies and form a static library cycle.
+foreach(backend IN LISTS BACKEND_LIBS)
+ target_link_libraries(${TARGET_NAME} INTERFACE $<LINK_ONLY:${backend}>)
+ target_link_libraries(${backend} INTERFACE $<LINK_ONLY:${TARGET_NAME}>)
+ ov_install_static_lib(${backend} ${OV_CPACK_COMP_CORE})
+endforeach()
+
target_compile_options(${TARGET_NAME} PRIVATE ${COMMON_COMPILE_OPTIONS})
ov_set_threading_interface_for(${TARGET_NAME})
diff --git a/src/plugins/intel_gpu/src/graph/impls/cm/CMakeLists.txt b/src/plugins/intel_gpu/src/graph/impls/cm/CMakeLists.txt
index b423ffb3aac..9d15decbfb3 100644
--- a/src/plugins/intel_gpu/src/graph/impls/cm/CMakeLists.txt
+++ b/src/plugins/intel_gpu/src/graph/impls/cm/CMakeLists.txt
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
#
-set(TARGET_NAME "openvino_intel_gpu_cm_obj${OV_GPU_SUFFIX}")
+set(TARGET_NAME "openvino_intel_gpu_cm_backend${OV_GPU_SUFFIX}")
# Path which points to root directory where code generated elements are created
# (specific to build configuration).
diff --git a/src/plugins/intel_gpu/src/graph/impls/common/CMakeLists.txt b/src/plugins/intel_gpu/src/graph/impls/common/CMakeLists.txt
index ced2aa4eed4..1d61eadb438 100644
--- a/src/plugins/intel_gpu/src/graph/impls/common/CMakeLists.txt
+++ b/src/plugins/intel_gpu/src/graph/impls/common/CMakeLists.txt
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
#
-set(TARGET_NAME "openvino_intel_gpu_common_obj${OV_GPU_SUFFIX}")
+set(TARGET_NAME "openvino_intel_gpu_common_backend${OV_GPU_SUFFIX}")
include(${CMAKE_CURRENT_LIST_DIR}/sources.cmake)
diff --git a/src/plugins/intel_gpu/src/graph/impls/cpu/CMakeLists.txt b/src/plugins/intel_gpu/src/graph/impls/cpu/CMakeLists.txt
index e7e21807d9b..5276edd976a 100644
--- a/src/plugins/intel_gpu/src/graph/impls/cpu/CMakeLists.txt
+++ b/src/plugins/intel_gpu/src/graph/impls/cpu/CMakeLists.txt
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
#
-set(TARGET_NAME "openvino_intel_gpu_cpu_obj${OV_GPU_SUFFIX}")
+set(TARGET_NAME "openvino_intel_gpu_cpu_backend${OV_GPU_SUFFIX}")
include(${CMAKE_CURRENT_LIST_DIR}/sources.cmake)
diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/CMakeLists.txt b/src/plugins/intel_gpu/src/graph/impls/ocl/CMakeLists.txt
index ea8a1fc140c..38d1f70b206 100644
--- a/src/plugins/intel_gpu/src/graph/impls/ocl/CMakeLists.txt
+++ b/src/plugins/intel_gpu/src/graph/impls/ocl/CMakeLists.txt
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
#
-set(TARGET_NAME "openvino_intel_gpu_ocl_obj${OV_GPU_SUFFIX}")
+set(TARGET_NAME "openvino_intel_gpu_ocl_backend${OV_GPU_SUFFIX}")
include(${CMAKE_CURRENT_LIST_DIR}/sources.cmake)
diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/CMakeLists.txt b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/CMakeLists.txt
index d933c9fb84f..e4003520c6d 100644
--- a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/CMakeLists.txt
+++ b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/CMakeLists.txt
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
#
-set(TARGET_NAME "openvino_intel_gpu_ocl_v2_obj${OV_GPU_SUFFIX}")
+set(TARGET_NAME "openvino_intel_gpu_ocl_v2_backend${OV_GPU_SUFFIX}")
# Path which points to root directory where code generated elements are created
# (specific to build configuration).
diff --git a/src/plugins/intel_gpu/src/graph/impls/onednn/CMakeLists.txt b/src/plugins/intel_gpu/src/graph/impls/onednn/CMakeLists.txt
index 9a84304a12c..473df6572e0 100644
--- a/src/plugins/intel_gpu/src/graph/impls/onednn/CMakeLists.txt
+++ b/src/plugins/intel_gpu/src/graph/impls/onednn/CMakeLists.txt
@@ -6,7 +6,7 @@ if (NOT ENABLE_ONEDNN_FOR_GPU)
return()
endif()
-set(TARGET_NAME "openvino_intel_gpu_onednn_obj${OV_GPU_SUFFIX}")
+set(TARGET_NAME "openvino_intel_gpu_onednn_backend${OV_GPU_SUFFIX}")
include(${CMAKE_CURRENT_LIST_DIR}/sources.cmake)
diff --git a/src/plugins/intel_gpu/src/graph/impls/sycl/CMakeLists.txt b/src/plugins/intel_gpu/src/graph/impls/sycl/CMakeLists.txt
index c8236ae2b48..600413286f2 100644
--- a/src/plugins/intel_gpu/src/graph/impls/sycl/CMakeLists.txt
+++ b/src/plugins/intel_gpu/src/graph/impls/sycl/CMakeLists.txt
@@ -6,7 +6,7 @@ if(NOT OV_GPU_WITH_SYCL)
return()
endif()
-set(TARGET_NAME "openvino_intel_gpu_sycl_obj${OV_GPU_SUFFIX}")
+set(TARGET_NAME "openvino_intel_gpu_sycl_backend${OV_GPU_SUFFIX}")
include(${CMAKE_CURRENT_LIST_DIR}/sources.cmake)