Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
26ad229b
Commit
26ad229b
authored
Sep 09, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9590 from alalek:ocl_runtime_fix
parents
9c973144
44b75eb1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
92 additions
and
38 deletions
+92
-38
opencl_core.hpp
...opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp
+4
-0
opencl_gl.hpp
...e/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp
+4
-0
opencl_core.hpp
.../core/include/opencv2/core/opencl/runtime/opencl_core.hpp
+0
-12
opencl_gl.hpp
...es/core/include/opencv2/core/opencl/runtime/opencl_gl.hpp
+0
-12
opencl_svm_20.hpp
...ore/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp
+0
-4
opencl_core_static_impl.hpp
.../opencl/runtime/autogenerated/opencl_core_static_impl.hpp
+0
-0
opencl_gl_static_impl.hpp
...rc/opencl/runtime/autogenerated/opencl_gl_static_impl.hpp
+14
-0
common.py
modules/core/src/opencl/runtime/generator/common.py
+17
-7
generate.sh
modules/core/src/opencl/runtime/generator/generate.sh
+2
-1
parser_cl.py
modules/core/src/opencl/runtime/generator/parser_cl.py
+4
-0
opencl_core.hpp.in
.../src/opencl/runtime/generator/template/opencl_core.hpp.in
+4
-0
opencl_gl.hpp.in
...re/src/opencl/runtime/generator/template/opencl_gl.hpp.in
+4
-0
static_impl.hpp.in
.../src/opencl/runtime/generator/template/static_impl.hpp.in
+1
-0
opencl_core.cpp
modules/core/src/opencl/runtime/opencl_core.cpp
+38
-2
No files found.
modules/core/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp
View file @
26ad229b
...
...
@@ -95,7 +95,11 @@
#define clUnloadPlatformCompiler clUnloadPlatformCompiler_
#define clWaitForEvents clWaitForEvents_
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
// generated by parser_cl.py
#undef clBuildProgram
...
...
modules/core/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp
View file @
26ad229b
...
...
@@ -17,7 +17,11 @@
#define clGetGLObjectInfo clGetGLObjectInfo_
#define clGetGLTextureInfo clGetGLTextureInfo_
#if defined __APPLE__
#include <OpenCL/cl_gl.h>
#else
#include <CL/cl_gl.h>
#endif
// generated by parser_cl.py
#undef clCreateFromGLBuffer
...
...
modules/core/include/opencv2/core/opencl/runtime/opencl_core.hpp
View file @
26ad229b
...
...
@@ -44,16 +44,6 @@
#ifdef HAVE_OPENCL
#if defined(HAVE_OPENCL_STATIC)
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
#else // HAVE_OPENCL_STATIC
#ifndef CL_RUNTIME_EXPORT
#if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_CORE_SHARED)) && (defined _WIN32 || defined WINCE)
#define CL_RUNTIME_EXPORT __declspec(dllimport)
...
...
@@ -76,8 +66,6 @@
#include "autogenerated/opencl_core.hpp"
#endif // HAVE_OPENCL_STATIC
#ifndef CL_DEVICE_DOUBLE_FP_CONFIG
#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032
#endif
...
...
modules/core/include/opencv2/core/opencl/runtime/opencl_gl.hpp
View file @
26ad229b
...
...
@@ -46,20 +46,8 @@
#include "opencl_core.hpp"
#if defined(HAVE_OPENCL_STATIC)
#if defined __APPLE__
#include <OpenCL/cl_gl.h>
#else
#include <CL/cl_gl.h>
#endif
#else // HAVE_OPENCL_STATIC
#include "autogenerated/opencl_gl.hpp"
#endif // HAVE_OPENCL_STATIC
#endif // defined HAVE_OPENCL && defined HAVE_OPENGL
#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP
modules/core/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp
View file @
26ad229b
...
...
@@ -8,8 +8,6 @@
#include "opencl_svm_definitions.hpp"
#ifndef HAVE_OPENCL_STATIC
#undef clSVMAlloc
#define clSVMAlloc clSVMAlloc_pfn
#undef clSVMFree
...
...
@@ -45,8 +43,6 @@ extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMap)(cl_command_queue
extern
CL_RUNTIME_EXPORT
cl_int
(
CL_API_CALL
*
clEnqueueSVMUnmap
)(
cl_command_queue
command_queue
,
void
*
svm_ptr
,
cl_uint
num_events_in_wait_list
,
const
cl_event
*
event_wait_list
,
cl_event
*
event
);
#endif // HAVE_OPENCL_STATIC
#endif // HAVE_OPENCL_SVM
#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP
modules/core/src/opencl/runtime/autogenerated/opencl_core_static_impl.hpp
0 → 100644
View file @
26ad229b
This diff is collapsed.
Click to expand it.
modules/core/src/opencl/runtime/autogenerated/opencl_gl_static_impl.hpp
0 → 100644
View file @
26ad229b
//
// AUTOGENERATED, DO NOT EDIT
//
// generated by parser_cl.py
CL_RUNTIME_EXPORT
cl_mem
(
CL_API_CALL
*
clCreateFromGLBuffer_pfn
)(
cl_context
,
cl_mem_flags
,
cl_GLuint
,
int
*
)
=
clCreateFromGLBuffer
;
CL_RUNTIME_EXPORT
cl_mem
(
CL_API_CALL
*
clCreateFromGLRenderbuffer_pfn
)(
cl_context
,
cl_mem_flags
,
cl_GLuint
,
cl_int
*
)
=
clCreateFromGLRenderbuffer
;
CL_RUNTIME_EXPORT
cl_mem
(
CL_API_CALL
*
clCreateFromGLTexture_pfn
)(
cl_context
,
cl_mem_flags
,
cl_GLenum
,
cl_GLint
,
cl_GLuint
,
cl_int
*
)
=
clCreateFromGLTexture
;
CL_RUNTIME_EXPORT
cl_mem
(
CL_API_CALL
*
clCreateFromGLTexture2D_pfn
)(
cl_context
,
cl_mem_flags
,
cl_GLenum
,
cl_GLint
,
cl_GLuint
,
cl_int
*
)
=
clCreateFromGLTexture2D
;
CL_RUNTIME_EXPORT
cl_mem
(
CL_API_CALL
*
clCreateFromGLTexture3D_pfn
)(
cl_context
,
cl_mem_flags
,
cl_GLenum
,
cl_GLint
,
cl_GLuint
,
cl_int
*
)
=
clCreateFromGLTexture3D
;
CL_RUNTIME_EXPORT
cl_int
(
CL_API_CALL
*
clEnqueueAcquireGLObjects_pfn
)(
cl_command_queue
,
cl_uint
,
const
cl_mem
*
,
cl_uint
,
const
cl_event
*
,
cl_event
*
)
=
clEnqueueAcquireGLObjects
;
CL_RUNTIME_EXPORT
cl_int
(
CL_API_CALL
*
clEnqueueReleaseGLObjects_pfn
)(
cl_command_queue
,
cl_uint
,
const
cl_mem
*
,
cl_uint
,
const
cl_event
*
,
cl_event
*
)
=
clEnqueueReleaseGLObjects
;
CL_RUNTIME_EXPORT
cl_int
(
CL_API_CALL
*
clGetGLContextInfoKHR_pfn
)(
const
cl_context_properties
*
,
cl_gl_context_info
,
size_t
,
void
*
,
size_t
*
)
=
clGetGLContextInfoKHR
;
CL_RUNTIME_EXPORT
cl_int
(
CL_API_CALL
*
clGetGLObjectInfo_pfn
)(
cl_mem
,
cl_gl_object_type
*
,
cl_GLuint
*
)
=
clGetGLObjectInfo
;
CL_RUNTIME_EXPORT
cl_int
(
CL_API_CALL
*
clGetGLTextureInfo_pfn
)(
cl_mem
,
cl_gl_texture_info
,
size_t
,
void
*
,
size_t
*
)
=
clGetGLTextureInfo
;
modules/core/src/opencl/runtime/generator/common.py
View file @
26ad229b
...
...
@@ -146,7 +146,6 @@ def getTypeWithParam(t, p):
@outputToString
def
generateStructDefinitions
(
fns
,
lprefix
=
'opencl_fn'
,
enumprefix
=
'OPENCL_FN'
):
print
'// generated by
%
s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
])
first
=
True
for
fn
in
fns
:
commentStr
=
''
if
fn
.
has_key
(
'enabled'
)
else
'//'
decl_args
=
[]
...
...
@@ -162,7 +161,20 @@ def generateStructDefinitions(fns, lprefix='opencl_fn', enumprefix='OPENCL_FN'):
commentStr
,
enumprefix
,
fn
[
'name'
]))
print
commentStr
+
(
'static const struct DynamicFnEntry
%
s_definition = { "
%
s", (void**)&
%
s};'
%
(
fn
[
'name'
],
fn
[
'name'
],
fn
[
'name'
]))
print
first
=
False
@outputToString
def
generateStaticDefinitions
(
fns
):
print
'// generated by
%
s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
])
for
fn
in
fns
:
commentStr
=
''
if
fn
.
has_key
(
'enabled'
)
else
'//'
decl_args
=
[]
for
(
i
,
t
)
in
enumerate
(
fn
[
'params'
]):
decl_args
.
append
(
getTypeWithParam
(
t
,
'p
%
d'
%
(
i
+
1
)))
decl_args_str
=
'('
+
(
', '
.
join
(
decl_args
))
+
')'
print
commentStr
+
(
'CL_RUNTIME_EXPORT
%
s
%
s (
%
s *
%
s_pfn)(
%
s) =
%
s;'
%
\
((
' '
.
join
(
fn
[
'modifiers'
]
+
' '
)
if
len
(
fn
[
'modifiers'
])
>
0
else
''
),
' '
.
join
(
fn
[
'ret'
]),
' '
.
join
(
fn
[
'calling'
]),
fn
[
'name'
],
', '
.
join
(
fn
[
'params'
]),
\
fn
[
'name'
]))
@outputToString
def
generateListOfDefinitions
(
fns
,
name
=
'opencl_fn_list'
):
...
...
@@ -181,9 +193,7 @@ def generateListOfDefinitions(fns, name='opencl_fn_list'):
def
generateEnums
(
fns
,
prefix
=
'OPENCL_FN'
):
print
'// generated by
%
s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
])
print
'enum
%
s_ID {'
%
prefix
i
=
-
1
for
fn
in
fns
:
i
=
i
+
1
for
(
i
,
fn
)
in
enumerate
(
fns
):
commentStr
=
''
if
fn
.
has_key
(
'enabled'
)
else
'//'
print
commentStr
+
(
'
%
s_
%
s =
%
d,'
%
(
prefix
,
fn
[
'name'
],
i
))
print
'};'
...
...
@@ -211,9 +221,9 @@ def generateFnDeclaration(fns):
fn
[
'name'
],
', '
.
join
(
fn
[
'params'
]
if
not
fn
.
has_key
(
'params_full'
)
else
fn
[
'params_full'
])))
@outputToString
def
generateTemplates
(
sz
,
lprefix
,
switch_name
,
calling_convention
=
''
):
def
generateTemplates
(
total
,
lprefix
,
switch_name
,
calling_convention
=
''
):
print
'// generated by
%
s'
%
os
.
path
.
basename
(
sys
.
argv
[
0
])
for
sz
in
range
(
sz
):
for
sz
in
range
(
total
):
template_params
=
[
'ID'
,
'_R'
,
'decl_args'
]
params
=
[
'p
%
d'
%
(
i
+
1
)
for
i
in
range
(
0
,
sz
)]
print
'#define
%
s
%
d(
%
s)
\\
'
%
(
lprefix
,
sz
,
', '
.
join
(
template_params
))
...
...
modules/core/src/opencl/runtime/generator/generate.sh
View file @
26ad229b
#!/bin/bash -e
echo
"Generate files for CL runtime..."
python parser_cl.py opencl_core < sources/cl.h
python parser_cl.py opencl_gl < sources/cl_gl.h
python parser_clamdblas.py < sources/clAmdBlas.h
python parser_clamdfft.py < sources/clAmdFft.h
python parser_cl.py opencl_gl < sources/cl_gl.h
echo
"Generate files for CL runtime... Done"
modules/core/src/opencl/runtime/generator/parser_cl.py
View file @
26ad229b
...
...
@@ -11,6 +11,7 @@ try:
module_name
=
sys
.
argv
[
1
]
outfile
=
open
(
'../../../../include/opencv2/core/opencl/runtime/autogenerated/
%
s.hpp'
%
module_name
,
'wb'
)
outfile_impl
=
open
(
'../autogenerated/
%
s_impl.hpp'
%
module_name
,
'wb'
)
outfile_static_impl
=
open
(
'../autogenerated/
%
s_static_impl.hpp'
%
module_name
,
'wb'
)
outfile_wrappers
=
open
(
'../../../../include/opencv2/core/opencl/runtime/autogenerated/
%
s_wrappers.hpp'
%
module_name
,
'wb'
)
if
len
(
sys
.
argv
)
>
2
:
f
=
open
(
sys
.
argv
[
2
],
"r"
)
...
...
@@ -133,3 +134,6 @@ ctx['CL_NUMBER_OF_ENABLED_FUNCTIONS'] = '// number of enabled functions: %d' % (
sys
.
stdout
=
outfile_impl
ProcessTemplate
(
'template/
%
s_impl.hpp.in'
%
module_name
,
ctx
)
sys
.
stdout
=
outfile_static_impl
ProcessTemplate
(
'template/static_impl.hpp.in'
,
dict
(
CL_STATIC_DEFINITIONS
=
generateStaticDefinitions
(
fns
)))
modules/core/src/opencl/runtime/generator/template/opencl_core.hpp.in
View file @
26ad229b
...
...
@@ -4,7 +4,11 @@
@CL_REMAP_ORIGIN@
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
@CL_REMAP_DYNAMIC@
...
...
modules/core/src/opencl/runtime/generator/template/opencl_gl.hpp.in
View file @
26ad229b
...
...
@@ -4,7 +4,11 @@
@CL_REMAP_ORIGIN@
#if defined __APPLE__
#include <OpenCL/cl_gl.h>
#else
#include <CL/cl_gl.h>
#endif
@CL_REMAP_DYNAMIC@
...
...
modules/core/src/opencl/runtime/generator/template/static_impl.hpp.in
0 → 100644
View file @
26ad229b
@CL_STATIC_DEFINITIONS@
modules/core/src/opencl/runtime/opencl_core.cpp
View file @
26ad229b
...
...
@@ -41,10 +41,22 @@
#include "../../precomp.hpp"
#if defined(HAVE_OPENCL)
&& !defined(HAVE_OPENCL_STATIC)
#if defined(HAVE_OPENCL)
#include "opencv2/core.hpp" // CV_Error
#if defined(HAVE_OPENCL_STATIC)
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
CV_SUPPRESS_DEPRECATED_START
#include "autogenerated/opencl_core_static_impl.hpp"
CV_SUPPRESS_DEPRECATED_END
#include "opencv2/core/opencl/runtime/opencl_core.hpp"
#else
#include "opencv2/core/opencl/runtime/opencl_core.hpp"
#define OPENCL_FUNC_TO_CHECK_1_1 "clEnqueueReadBufferRect"
...
...
@@ -205,7 +217,11 @@ static void* opencl_check_fn(int ID);
#define CUSTOM_FUNCTION_ID 1000
#ifdef HAVE_OPENCL_SVM
#endif // HAVE_OPENCL_STATIC
#if defined HAVE_OPENCL_SVM && !defined(HAVE_OPENCL_STATIC)
#include "opencv2/core/opencl/runtime/opencl_svm_20.hpp"
#define SVM_FUNCTION_ID_START CUSTOM_FUNCTION_ID
#define SVM_FUNCTION_ID_END CUSTOM_FUNCTION_ID + 100
...
...
@@ -269,6 +285,7 @@ static const struct DynamicFnEntry* opencl_svm_fn_list[] = {
// END OF CUSTOM FUNCTIONS HERE
//
#if !defined(HAVE_OPENCL_STATIC)
static
void
*
opencl_check_fn
(
int
ID
)
{
const
struct
DynamicFnEntry
*
e
=
NULL
;
...
...
@@ -299,9 +316,26 @@ static void* opencl_check_fn(int ID)
*
(
e
->
ppFn
)
=
func
;
return
func
;
}
#endif // HAVE_OPENCL_STATIC
#ifdef HAVE_OPENGL
#if defined(HAVE_OPENCL_STATIC)
#if defined __APPLE__
#include <OpenCL/cl_gl.h>
#else
#include <CL/cl_gl.h>
#endif
#ifdef cl_khr_gl_sharing
CV_SUPPRESS_DEPRECATED_START
#include "autogenerated/opencl_gl_static_impl.hpp"
CV_SUPPRESS_DEPRECATED_END
#include "opencv2/core/opencl/runtime/opencl_gl.hpp"
#endif
#else HAVE_OPENCL_STATIC
#include "opencv2/core/opencl/runtime/opencl_gl.hpp"
#ifdef cl_khr_gl_sharing
...
...
@@ -328,6 +362,8 @@ static void* opencl_gl_check_fn(int ID)
#endif // cl_khr_gl_sharing
#endif // HAVE_OPENCL_STATIC
#endif // HAVE_OPENGL
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment