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
32bb71d6
Commit
32bb71d6
authored
Sep 13, 2017
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9603 from alalek:ocl_device_extensions
parents
822d33d6
9e381d07
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
19 deletions
+46
-19
ocl.hpp
modules/core/include/opencv2/core/ocl.hpp
+2
-0
ocl.cpp
modules/core/src/ocl.cpp
+27
-19
ocl_test.cpp
modules/ts/src/ocl_test.cpp
+17
-0
No files found.
modules/core/include/opencv2/core/ocl.hpp
View file @
32bb71d6
...
...
@@ -91,6 +91,7 @@ public:
String
name
()
const
;
String
extensions
()
const
;
bool
isExtensionSupported
(
const
String
&
extensionName
)
const
;
String
version
()
const
;
String
vendorName
()
const
;
String
OpenCL_C_Version
()
const
;
...
...
@@ -160,6 +161,7 @@ public:
uint
imagePitchAlignment
()
const
;
uint
imageBaseAddressAlignment
()
const
;
/// deprecated, use isExtensionSupported() method (probably with "cl_khr_subgroups" value)
bool
intelSubgroupsSupport
()
const
;
size_t
image2DMaxWidth
()
const
;
...
...
modules/core/src/ocl.cpp
View file @
32bb71d6
...
...
@@ -43,6 +43,7 @@
#include <list>
#include <map>
#include <deque>
#include <set>
#include <string>
#include <sstream>
#include <iostream> // std::cerr
...
...
@@ -518,6 +519,7 @@ struct Device::Impl
name_
=
getStrProp
(
CL_DEVICE_NAME
);
version_
=
getStrProp
(
CL_DEVICE_VERSION
);
extensions_
=
getStrProp
(
CL_DEVICE_EXTENSIONS
);
doubleFPConfig_
=
getProp
<
cl_device_fp_config
,
int
>
(
CL_DEVICE_DOUBLE_FP_CONFIG
);
hostUnifiedMemory_
=
getBoolProp
(
CL_DEVICE_HOST_UNIFIED_MEMORY
);
maxComputeUnits_
=
getProp
<
cl_uint
,
int
>
(
CL_DEVICE_MAX_COMPUTE_UNITS
);
...
...
@@ -528,6 +530,20 @@ struct Device::Impl
String
deviceVersion_
=
getStrProp
(
CL_DEVICE_VERSION
);
parseDeviceVersion
(
deviceVersion_
,
deviceVersionMajor_
,
deviceVersionMinor_
);
size_t
pos
=
0
;
while
(
pos
<
extensions_
.
size
())
{
size_t
pos2
=
extensions_
.
find
(
' '
,
pos
);
if
(
pos2
==
String
::
npos
)
pos2
=
extensions_
.
size
();
if
(
pos2
>
pos
)
{
std
::
string
extensionName
=
extensions_
.
substr
(
pos
,
pos2
-
pos
);
extensions_set_
.
insert
(
extensionName
);
}
pos
=
pos2
+
1
;
}
intelSubgroupsSupport_
=
isExtensionSupported
(
"cl_intel_subgroups"
);
vendorName_
=
getStrProp
(
CL_DEVICE_VENDOR
);
...
...
@@ -569,23 +585,19 @@ struct Device::Impl
sz
<
sizeof
(
buf
)
?
String
(
buf
)
:
String
();
}
bool
isExtensionSupported
(
const
S
tring
&
extensionName
)
const
bool
isExtensionSupported
(
const
std
::
s
tring
&
extensionName
)
const
{
bool
ret
=
false
;
size_t
pos
=
getStrProp
(
CL_DEVICE_EXTENSIONS
).
find
(
extensionName
);
if
(
pos
!=
String
::
npos
)
{
ret
=
true
;
}
return
ret
;
return
extensions_set_
.
count
(
extensionName
)
>
0
;
}
IMPLEMENT_REFCOUNTABLE
();
cl_device_id
handle
;
String
name_
;
String
version_
;
std
::
string
extensions_
;
int
doubleFPConfig_
;
bool
hostUnifiedMemory_
;
int
maxComputeUnits_
;
...
...
@@ -597,6 +609,8 @@ struct Device::Impl
String
vendorName_
;
int
vendorID_
;
bool
intelSubgroupsSupport_
;
std
::
set
<
std
::
string
>
extensions_set_
;
};
...
...
@@ -651,7 +665,10 @@ String Device::name() const
{
return
p
?
p
->
name_
:
String
();
}
String
Device
::
extensions
()
const
{
return
p
?
p
->
getStrProp
(
CL_DEVICE_EXTENSIONS
)
:
String
();
}
{
return
p
?
String
(
p
->
extensions_
)
:
String
();
}
bool
Device
::
isExtensionSupported
(
const
String
&
extensionName
)
const
{
return
p
?
p
->
isExtensionSupported
(
extensionName
)
:
false
;
}
String
Device
::
version
()
const
{
return
p
?
p
->
version_
:
String
();
}
...
...
@@ -744,16 +761,7 @@ bool Device::imageSupport() const
bool
Device
::
imageFromBufferSupport
()
const
{
bool
ret
=
false
;
if
(
p
)
{
size_t
pos
=
p
->
getStrProp
(
CL_DEVICE_EXTENSIONS
).
find
(
"cl_khr_image2d_from_buffer"
);
if
(
pos
!=
String
::
npos
)
{
ret
=
true
;
}
}
return
ret
;
return
p
?
p
->
isExtensionSupported
(
"cl_khr_image2d_from_buffer"
)
:
false
;
}
uint
Device
::
imagePitchAlignment
()
const
...
...
modules/ts/src/ocl_test.cpp
View file @
32bb71d6
...
...
@@ -181,6 +181,23 @@ void dumpOpenCLDevice()
DUMP_MESSAGE_STDOUT
(
" Host unified memory = "
<<
isUnifiedMemoryStr
);
DUMP_PROPERTY_XML
(
"cv_ocl_current_hostUnifiedMemory"
,
device
.
hostUnifiedMemory
());
DUMP_MESSAGE_STDOUT
(
" Device extensions:"
);
String
extensionsStr
=
device
.
extensions
();
size_t
pos
=
0
;
while
(
pos
<
extensionsStr
.
size
())
{
size_t
pos2
=
extensionsStr
.
find
(
' '
,
pos
);
if
(
pos2
==
String
::
npos
)
pos2
=
extensionsStr
.
size
();
if
(
pos2
>
pos
)
{
String
extensionName
=
extensionsStr
.
substr
(
pos
,
pos2
-
pos
);
DUMP_MESSAGE_STDOUT
(
" "
<<
extensionName
);
}
pos
=
pos2
+
1
;
}
DUMP_PROPERTY_XML
(
"cv_ocl_current_extensions"
,
extensionsStr
.
c_str
());
const
char
*
haveAmdBlasStr
=
haveAmdBlas
()
?
"Yes"
:
"No"
;
DUMP_MESSAGE_STDOUT
(
" Has AMD Blas = "
<<
haveAmdBlasStr
);
DUMP_PROPERTY_XML
(
"cv_ocl_current_AmdBlas"
,
haveAmdBlas
());
...
...
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