Generalized OpenCL handling (#15253)
* Squashed commit of the following: commit 62c992f6a0bc3a2f559faac6912be9c5632a359f Author: Ilya Lavrenov <ilya.lavrenov@intel.com> Date: Sun Jan 22 11:38:18 2023 +0400 Generalized OpenCL handling * Updates * Fixes * Update thirdparty/CMakeLists.txt test * Fixed build with CL/cl2.hpp * Fixes * Fixes * Fixed compilation flags * Fixed build with target OpenCL 120 * Don't use cache
This commit is contained in:
@@ -20,36 +20,8 @@ file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/gpu/*.cpp")
|
||||
|
||||
find_package(OpenCL)
|
||||
find_path(OpenCL_HPP_INCLUDE_DIR
|
||||
NAMES
|
||||
CL/opencl.hpp OpenCL/opencl.hpp
|
||||
HINTS
|
||||
${opencl_root_hints}
|
||||
ENV "PROGRAMFILES(X86)"
|
||||
ENV AMDAPPSDKROOT
|
||||
ENV INTELOCLSDKROOT
|
||||
ENV NVSDKCOMPUTE_ROOT
|
||||
ENV CUDA_PATH
|
||||
ENV ATISTREAMSDKROOT
|
||||
ENV OCL_ROOT
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
OpenCL/common/inc
|
||||
"AMD APP/include")
|
||||
|
||||
if(TARGET OpenCL)
|
||||
# Use OpenCL CPP headers from sources if present
|
||||
set(OpenCL_HEADERS ${OPENCL_HEADERS_DIR})
|
||||
set(OpenCL_LIB "OpenCL")
|
||||
elseif(OpenCL_HPP_INCLUDE_DIR)
|
||||
# Append OpenCL CPP headers to C headers and use both
|
||||
set(OpenCL_HEADERS ${OpenCL_INCLUDE_DIR} ${OpenCL_HPP_INCLUDE_DIR})
|
||||
set(OpenCL_LIB "OpenCL::OpenCL")
|
||||
endif()
|
||||
|
||||
# remove GPU remote snippets if OCL hasn't been found
|
||||
if (NOT (OpenCL_FOUND AND OpenCL_HEADERS))
|
||||
# remove GPU remote snippets if OpenCL hasn't been found
|
||||
if (NOT TARGET OpenCL::OpenCL)
|
||||
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/gpu/context_sharing_va.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/gpu/context_sharing.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/gpu/preprocessing.cpp"
|
||||
@@ -98,9 +70,8 @@ target_include_directories(${TARGET_NAME} PRIVATE "${OpenVINO_SOURCE_DIR}/src/in
|
||||
"${OpenVINO_SOURCE_DIR}/src/frontends/common/include"
|
||||
"${OpenVINO_SOURCE_DIR}/src/core/template_extension/new/")
|
||||
|
||||
if(OpenCL_FOUND AND OpenCL_HEADERS)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE ${OpenCL_LIB})
|
||||
target_include_directories(${TARGET_NAME} PRIVATE ${OpenCL_HEADERS})
|
||||
if(TARGET OpenCL::OpenCL)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE OpenCL::OpenCL)
|
||||
|
||||
if(libva_FOUND)
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE ENABLE_LIBVA)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <openvino/runtime/core.hpp>
|
||||
#define OV_GPU_USE_OPENCL_HPP
|
||||
#include <openvino/runtime/intel_gpu/ocl/ocl.hpp>
|
||||
|
||||
cl::Context get_ocl_context(); // a function which returns cl context created on the app side
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifdef ENABLE_LIBVA
|
||||
#include <openvino/runtime/core.hpp>
|
||||
#define OV_GPU_USE_OPENCL_HPP
|
||||
#include <openvino/runtime/intel_gpu/ocl/va.hpp>
|
||||
#include <openvino/runtime/intel_gpu/properties.hpp>
|
||||
#include <openvino/core/preprocess/pre_post_process.hpp>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <openvino/runtime/core.hpp>
|
||||
#define OV_GPU_USE_OPENCL_HPP
|
||||
#include <openvino/runtime/intel_gpu/ocl/ocl.hpp>
|
||||
#include <openvino/runtime/intel_gpu/properties.hpp>
|
||||
#include <openvino/core/preprocess/pre_post_process.hpp>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <openvino/runtime/core.hpp>
|
||||
#define OV_GPU_USE_OPENCL_HPP
|
||||
#include <openvino/runtime/intel_gpu/ocl/ocl.hpp>
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include <openvino/runtime/core.hpp>
|
||||
#include <openvino/runtime/intel_gpu/properties.hpp>
|
||||
|
||||
#define OV_GPU_USE_OPENCL_HPP
|
||||
#include <openvino/runtime/intel_gpu/ocl/ocl.hpp>
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
Reference in New Issue
Block a user