Skip to content

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

[GPU] CMake guard to check all cl kernel sources added (#39025)

Pawel Raaszb03c0018961c
diff --git a/src/plugins/intel_gpu/src/kernel_selector/CMakeLists.txt b/src/plugins/intel_gpu/src/kernel_selector/CMakeLists.txt
index 305659e51f6..35fbdd67470 100644
--- a/src/plugins/intel_gpu/src/kernel_selector/CMakeLists.txt
+++ b/src/plugins/intel_gpu/src/kernel_selector/CMakeLists.txt
@@ -57,6 +57,20 @@ add_custom_command(OUTPUT "${CODEGEN_INCDIR}/${PRIM_DB}"
add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${CODEGEN_CACHE_SOURCES})
+# .cl files aren't compiled, so a missing list entry won't fail the build - only silently skip
+# incremental regeneration of the primitive DB.
+file(GLOB_RECURSE _ov_gpu_cl_kernels_on_disk CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cl_kernels/*.cl")
+
+foreach(_ov_gpu_cl_kernel IN LISTS _ov_gpu_cl_kernels_on_disk)
+ if(NOT _ov_gpu_cl_kernel IN_LIST KERNELS)
+ message(SEND_ERROR "[${TARGET_NAME}] '${_ov_gpu_cl_kernel}' is missing from GPU_KERNEL_SELECTOR_CL_KERNELS "
+ "(kernel_selector/sources.cmake).")
+ endif()
+endforeach()
+
+unset(_ov_gpu_cl_kernel)
+unset(_ov_gpu_cl_kernels_on_disk)
+
if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(${TARGET_NAME} PUBLIC OPENVINO_STATIC_LIBRARY)
endif()
diff --git a/src/plugins/intel_gpu/src/kernel_selector/sources.cmake b/src/plugins/intel_gpu/src/kernel_selector/sources.cmake
index 9c6fddd3601..ef225a836ae 100644
--- a/src/plugins/intel_gpu/src/kernel_selector/sources.cmake
+++ b/src/plugins/intel_gpu/src/kernel_selector/sources.cmake
@@ -904,6 +904,7 @@ set(GPU_KERNEL_SELECTOR_CL_KERNELS
${CMAKE_CURRENT_LIST_DIR}/cl_kernels/include/gemm_common.cl
${CMAKE_CURRENT_LIST_DIR}/cl_kernels/include/image_data.cl
${CMAKE_CURRENT_LIST_DIR}/cl_kernels/include/mmad.cl
+ ${CMAKE_CURRENT_LIST_DIR}/cl_kernels/include/resample_utils.cl
${CMAKE_CURRENT_LIST_DIR}/cl_kernels/include/reshape_dims.cl
${CMAKE_CURRENT_LIST_DIR}/cl_kernels/include/sub_group.cl
${CMAKE_CURRENT_LIST_DIR}/cl_kernels/include/unit_type.cl