From 928edf57c709a2965942072a572320f433017a82 Mon Sep 17 00:00:00 2001 From: liuruilong Date: Fri, 28 Sep 2018 17:47:48 +0800 Subject: [PATCH] move opencl to third party --- CMakeLists.txt | 3 ++ src/framework/cl/cl_deleter.h | 2 +- src/framework/cl/cl_engine.cpp | 2 +- src/framework/cl/cl_engine.h | 2 +- src/framework/cl/cl_image.h | 2 +- src/framework/cl/cl_scope.h | 2 +- src/framework/cl/cl_tensor.h | 2 +- src/framework/cl/cl_tool.h | 2 +- .../opecl/OpenCL-Headers}/CL/cl.h | 2 +- .../opecl/OpenCL-Headers}/CL/cl_d3d10.h | 0 .../opecl/OpenCL-Headers}/CL/cl_d3d11.h | 0 .../OpenCL-Headers}/CL/cl_dx9_media_sharing.h | 0 .../CL/cl_dx9_media_sharing_intel.h | 0 .../opecl/OpenCL-Headers}/CL/cl_egl.h | 0 .../opecl/OpenCL-Headers}/CL/cl_ext.h | 2 +- .../opecl/OpenCL-Headers}/CL/cl_ext_intel.h | 4 +- .../opecl/OpenCL-Headers}/CL/cl_gl.h | 2 +- .../opecl/OpenCL-Headers}/CL/cl_gl_ext.h | 2 +- .../opecl/OpenCL-Headers}/CL/cl_platform.h | 0 .../CL/cl_va_api_media_sharing_intel.h | 0 .../opecl/OpenCL-Headers}/CL/cl_version.h | 0 .../opecl/OpenCL-Headers}/CL/opencl.h | 8 +-- third_party/opecl/OpenCL-Headers/LICENSE | 25 ++++++++++ third_party/opecl/OpenCL-Headers/README.md | 50 +++++++++++++++++++ 24 files changed, 95 insertions(+), 17 deletions(-) rename {src/framework/cl => third_party/opecl/OpenCL-Headers}/CL/cl.h (99%) rename {src/framework/cl => third_party/opecl/OpenCL-Headers}/CL/cl_d3d10.h (100%) rename {src/framework/cl => third_party/opecl/OpenCL-Headers}/CL/cl_d3d11.h (100%) rename {src/framework/cl => third_party/opecl/OpenCL-Headers}/CL/cl_dx9_media_sharing.h (100%) rename {src/framework/cl => third_party/opecl/OpenCL-Headers}/CL/cl_dx9_media_sharing_intel.h (100%) rename {src/framework/cl => third_party/opecl/OpenCL-Headers}/CL/cl_egl.h (100%) rename {src/framework/cl => third_party/opecl/OpenCL-Headers}/CL/cl_ext.h (99%) rename {src/framework/cl => third_party/opecl/OpenCL-Headers}/CL/cl_ext_intel.h (99%) rename {src/framework/cl => third_party/opecl/OpenCL-Headers}/CL/cl_gl.h (99%) rename {src/framework/cl => third_party/opecl/OpenCL-Headers}/CL/cl_gl_ext.h (98%) rename {src/framework/cl => third_party/opecl/OpenCL-Headers}/CL/cl_platform.h (100%) rename {src/framework/cl => third_party/opecl/OpenCL-Headers}/CL/cl_va_api_media_sharing_intel.h (100%) rename {src/framework/cl => third_party/opecl/OpenCL-Headers}/CL/cl_version.h (100%) rename {src/framework/cl => third_party/opecl/OpenCL-Headers}/CL/opencl.h (94%) create mode 100644 third_party/opecl/OpenCL-Headers/LICENSE create mode 100644 third_party/opecl/OpenCL-Headers/README.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b3e6227ac..7b63f25001 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,9 @@ file(GLOB_RECURSE PADDLE_MOBILE_CC src/*.cc src/*.cpp src/*.c src/*.mm) file(GLOB_RECURSE PADDLE_MOBILE_H src/*.h) include_directories(src/) +include_directories(third_party/opecl/OpenCL-Headers) + + if(IS_IOS) set(CMAKE_CXX_FLAGS "-mfpu=neon -marm -fobjc-abi-version=2 -fobjc-arc -std=gnu++11 -stdlib=libc++ -O3 -s -isysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS}") else() diff --git a/src/framework/cl/cl_deleter.h b/src/framework/cl/cl_deleter.h index ce8bf5ac00..f475997a75 100644 --- a/src/framework/cl/cl_deleter.h +++ b/src/framework/cl/cl_deleter.h @@ -14,7 +14,7 @@ limitations under the License. */ #pragma once -#include "framework/cl/CL/cl.h" +#include "CL/cl.h" struct CLKernelDeleter { template diff --git a/src/framework/cl/cl_engine.cpp b/src/framework/cl/cl_engine.cpp index 9aae49d216..b98b8ed8a3 100644 --- a/src/framework/cl/cl_engine.cpp +++ b/src/framework/cl/cl_engine.cpp @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "framework/cl/CL/cl.h" +#include "CL/cl.h" #include "framework/cl/cl_tool.h" #include "framework/cl/cl_engine.h" diff --git a/src/framework/cl/cl_engine.h b/src/framework/cl/cl_engine.h index 14167f0edf..7e18f61224 100644 --- a/src/framework/cl/cl_engine.h +++ b/src/framework/cl/cl_engine.h @@ -19,7 +19,7 @@ limitations under the License. */ #include "common/enforce.h" #include "framework/cl/cl_deleter.h" -#include "framework/cl/CL/cl.h" +#include "CL/cl.h" namespace paddle_mobile { namespace framework { diff --git a/src/framework/cl/cl_image.h b/src/framework/cl/cl_image.h index eab4bd87e3..c1f1cd6422 100644 --- a/src/framework/cl/cl_image.h +++ b/src/framework/cl/cl_image.h @@ -16,7 +16,7 @@ limitations under the License. */ #include "framework/ddim.h" #include "framework/tensor.h" -#include "framework/cl/CL/cl.h" +#include "CL/cl.h" namespace paddle_mobile { namespace framework { diff --git a/src/framework/cl/cl_scope.h b/src/framework/cl/cl_scope.h index dccf28a2e4..e7f961d058 100644 --- a/src/framework/cl/cl_scope.h +++ b/src/framework/cl/cl_scope.h @@ -21,7 +21,7 @@ limitations under the License. */ #include "framework/cl/cl_tool.h" #include "framework/cl/cl_engine.h" #include "framework/cl/cl_deleter.h" -#include "framework/cl/CL/cl.h" +#include "CL/cl.h" namespace paddle_mobile { namespace framework { diff --git a/src/framework/cl/cl_tensor.h b/src/framework/cl/cl_tensor.h index b31c3fce0a..e4d12494b2 100644 --- a/src/framework/cl/cl_tensor.h +++ b/src/framework/cl/cl_tensor.h @@ -21,7 +21,7 @@ limitations under the License. */ #include "framework/tensor_base.h" #include "framework/cl/cl_engine.h" #include "framework/cl/cl_deleter.h" -#include "framework/cl/CL/cl.h" +#include "CL/cl.h" namespace paddle_mobile { namespace framework { diff --git a/src/framework/cl/cl_tool.h b/src/framework/cl/cl_tool.h index aceee00173..3244c796e5 100644 --- a/src/framework/cl/cl_tool.h +++ b/src/framework/cl/cl_tool.h @@ -14,7 +14,7 @@ limitations under the License. */ #pragma once -#include "framework/cl/CL/cl.h" +#include "CL/cl.h" namespace paddle_mobile { namespace framework { diff --git a/src/framework/cl/CL/cl.h b/third_party/opecl/OpenCL-Headers/CL/cl.h similarity index 99% rename from src/framework/cl/CL/cl.h rename to third_party/opecl/OpenCL-Headers/CL/cl.h index 2cb2bf299b..7224ed38fa 100644 --- a/src/framework/cl/CL/cl.h +++ b/third_party/opecl/OpenCL-Headers/CL/cl.h @@ -31,7 +31,7 @@ #ifdef __APPLE__ #include -#include +#include #else #include #include diff --git a/src/framework/cl/CL/cl_d3d10.h b/third_party/opecl/OpenCL-Headers/CL/cl_d3d10.h similarity index 100% rename from src/framework/cl/CL/cl_d3d10.h rename to third_party/opecl/OpenCL-Headers/CL/cl_d3d10.h diff --git a/src/framework/cl/CL/cl_d3d11.h b/third_party/opecl/OpenCL-Headers/CL/cl_d3d11.h similarity index 100% rename from src/framework/cl/CL/cl_d3d11.h rename to third_party/opecl/OpenCL-Headers/CL/cl_d3d11.h diff --git a/src/framework/cl/CL/cl_dx9_media_sharing.h b/third_party/opecl/OpenCL-Headers/CL/cl_dx9_media_sharing.h similarity index 100% rename from src/framework/cl/CL/cl_dx9_media_sharing.h rename to third_party/opecl/OpenCL-Headers/CL/cl_dx9_media_sharing.h diff --git a/src/framework/cl/CL/cl_dx9_media_sharing_intel.h b/third_party/opecl/OpenCL-Headers/CL/cl_dx9_media_sharing_intel.h similarity index 100% rename from src/framework/cl/CL/cl_dx9_media_sharing_intel.h rename to third_party/opecl/OpenCL-Headers/CL/cl_dx9_media_sharing_intel.h diff --git a/src/framework/cl/CL/cl_egl.h b/third_party/opecl/OpenCL-Headers/CL/cl_egl.h similarity index 100% rename from src/framework/cl/CL/cl_egl.h rename to third_party/opecl/OpenCL-Headers/CL/cl_egl.h diff --git a/src/framework/cl/CL/cl_ext.h b/third_party/opecl/OpenCL-Headers/CL/cl_ext.h similarity index 99% rename from src/framework/cl/CL/cl_ext.h rename to third_party/opecl/OpenCL-Headers/CL/cl_ext.h index 288715b1fb..af3ce461f3 100644 --- a/src/framework/cl/CL/cl_ext.h +++ b/third_party/opecl/OpenCL-Headers/CL/cl_ext.h @@ -37,7 +37,7 @@ extern "C" { #endif #ifdef __APPLE__ - #include + #include #include #else #include diff --git a/src/framework/cl/CL/cl_ext_intel.h b/third_party/opecl/OpenCL-Headers/CL/cl_ext_intel.h similarity index 99% rename from src/framework/cl/CL/cl_ext_intel.h rename to third_party/opecl/OpenCL-Headers/CL/cl_ext_intel.h index 6d96d1d93d..1c358cfc10 100644 --- a/src/framework/cl/CL/cl_ext_intel.h +++ b/third_party/opecl/OpenCL-Headers/CL/cl_ext_intel.h @@ -53,8 +53,8 @@ Notes: #define __CL_EXT_INTEL_H #ifdef __APPLE__ - #include - #include + #include + #include #else #include #include diff --git a/src/framework/cl/CL/cl_gl.h b/third_party/opecl/OpenCL-Headers/CL/cl_gl.h similarity index 99% rename from src/framework/cl/CL/cl_gl.h rename to third_party/opecl/OpenCL-Headers/CL/cl_gl.h index 2e3183cd6b..58b6449f9b 100644 --- a/src/framework/cl/CL/cl_gl.h +++ b/third_party/opecl/OpenCL-Headers/CL/cl_gl.h @@ -30,7 +30,7 @@ #define __OPENCL_CL_GL_H #ifdef __APPLE__ -#include +#include #else #include #endif diff --git a/src/framework/cl/CL/cl_gl_ext.h b/third_party/opecl/OpenCL-Headers/CL/cl_gl_ext.h similarity index 98% rename from src/framework/cl/CL/cl_gl_ext.h rename to third_party/opecl/OpenCL-Headers/CL/cl_gl_ext.h index 60346b7779..e3c14c6408 100644 --- a/src/framework/cl/CL/cl_gl_ext.h +++ b/third_party/opecl/OpenCL-Headers/CL/cl_gl_ext.h @@ -39,7 +39,7 @@ extern "C" { #endif #ifdef __APPLE__ - #include + #include #else #include #endif diff --git a/src/framework/cl/CL/cl_platform.h b/third_party/opecl/OpenCL-Headers/CL/cl_platform.h similarity index 100% rename from src/framework/cl/CL/cl_platform.h rename to third_party/opecl/OpenCL-Headers/CL/cl_platform.h diff --git a/src/framework/cl/CL/cl_va_api_media_sharing_intel.h b/third_party/opecl/OpenCL-Headers/CL/cl_va_api_media_sharing_intel.h similarity index 100% rename from src/framework/cl/CL/cl_va_api_media_sharing_intel.h rename to third_party/opecl/OpenCL-Headers/CL/cl_va_api_media_sharing_intel.h diff --git a/src/framework/cl/CL/cl_version.h b/third_party/opecl/OpenCL-Headers/CL/cl_version.h similarity index 100% rename from src/framework/cl/CL/cl_version.h rename to third_party/opecl/OpenCL-Headers/CL/cl_version.h diff --git a/src/framework/cl/CL/opencl.h b/third_party/opecl/OpenCL-Headers/CL/opencl.h similarity index 94% rename from src/framework/cl/CL/opencl.h rename to third_party/opecl/OpenCL-Headers/CL/opencl.h index 36816d73fa..9855cd75e7 100644 --- a/src/framework/cl/CL/opencl.h +++ b/third_party/opecl/OpenCL-Headers/CL/opencl.h @@ -37,10 +37,10 @@ extern "C" { #ifdef __APPLE__ -#include -#include -#include -#include +#include +#include +#include +#include #else diff --git a/third_party/opecl/OpenCL-Headers/LICENSE b/third_party/opecl/OpenCL-Headers/LICENSE new file mode 100644 index 0000000000..020ce65fca --- /dev/null +++ b/third_party/opecl/OpenCL-Headers/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2008-2015 The Khronos Group Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and/or associated documentation files (the +"Materials"), to deal in the Materials without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Materials, and to +permit persons to whom the Materials are furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Materials. + +MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS +KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS +SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT + https://www.khronos.org/registry/ + +THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. diff --git a/third_party/opecl/OpenCL-Headers/README.md b/third_party/opecl/OpenCL-Headers/README.md new file mode 100644 index 0000000000..757e56e152 --- /dev/null +++ b/third_party/opecl/OpenCL-Headers/README.md @@ -0,0 +1,50 @@ +# OpenCLTM API Headers + +This repository contains C language headers for the OpenCL API. + +The authoritative public repository for these headers is located at: + +https://github.com/KhronosGroup/OpenCL-Headers + +Issues, proposed fixes for issues, and other suggested changes should be +created using Github. + +## Branch Structure + +The OpenCL API headers in this repository are Unified headers and are designed +to work with all released OpenCL versions. This differs from previous OpenCL +API headers, where version-specific API headers either existed in separate +branches, or in separate folders in a branch. + +## Compiling for a Specific OpenCL Version + +By default, the OpenCL API headers in this repository are for the latest +OpenCL version (currently OpenCL 2.2). To use these API headers to target +a different OpenCL version, an application may `#define` the preprocessor +value `CL_TARGET_OPENCL_VERSION` before including the OpenCL API headers. +The `CL_TARGET_OPENCL_VERSION` is a three digit decimal value representing +the OpenCL API version. + +For example, to enforce usage of no more than the OpenCL 1.2 APIs, you may +include the OpenCL API headers as follows: + +``` +#define CL_TARGET_OPENCL_VERSION 120 +#include +``` + +## Directory Structure + +``` +README.md This file +LICENSE Source license for the OpenCL API headers +CL/ Unified OpenCL API headers tree +``` + +## License + +See [LICENSE](LICENSE). + +--- + +OpenCL and the OpenCL logo are trademarks of Apple Inc. used by permission by Khronos. -- GitLab