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
e63efe29
Commit
e63efe29
authored
Nov 26, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13275 from wzw-intel:thread_safe
parents
c6daa4aa
4e652830
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
common.hpp
modules/dnn/src/vkcom/src/common.hpp
+1
-0
context.cpp
modules/dnn/src/vkcom/src/context.cpp
+2
-1
op_base.cpp
modules/dnn/src/vkcom/src/op_base.cpp
+5
-1
No files found.
modules/dnn/src/vkcom/src/common.hpp
View file @
e63efe29
...
@@ -33,6 +33,7 @@ extern VkPhysicalDevice kPhysicalDevice;
...
@@ -33,6 +33,7 @@ extern VkPhysicalDevice kPhysicalDevice;
extern
VkDevice
kDevice
;
extern
VkDevice
kDevice
;
extern
VkQueue
kQueue
;
extern
VkQueue
kQueue
;
extern
VkCommandPool
kCmdPool
;
extern
VkCommandPool
kCmdPool
;
extern
cv
::
Mutex
kContextMtx
;
enum
ShapeIdx
enum
ShapeIdx
{
{
...
...
modules/dnn/src/vkcom/src/context.cpp
View file @
e63efe29
...
@@ -25,6 +25,7 @@ VkDebugReportCallbackEXT kDebugReportCallback;
...
@@ -25,6 +25,7 @@ VkDebugReportCallbackEXT kDebugReportCallback;
uint32_t
kQueueFamilyIndex
;
uint32_t
kQueueFamilyIndex
;
std
::
vector
<
const
char
*>
kEnabledLayers
;
std
::
vector
<
const
char
*>
kEnabledLayers
;
std
::
map
<
std
::
string
,
std
::
vector
<
uint32_t
>>
kShaders
;
std
::
map
<
std
::
string
,
std
::
vector
<
uint32_t
>>
kShaders
;
cv
::
Mutex
kContextMtx
;
static
uint32_t
getComputeQueueFamilyIndex
()
static
uint32_t
getComputeQueueFamilyIndex
()
{
{
...
@@ -86,7 +87,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugReportCallbackFn(
...
@@ -86,7 +87,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugReportCallbackFn(
// internally used
// internally used
void
createContext
()
void
createContext
()
{
{
cv
::
AutoLock
lock
(
getInitializationMutex
()
);
cv
::
AutoLock
lock
(
kContextMtx
);
if
(
!
kCtx
)
if
(
!
kCtx
)
{
{
kCtx
.
reset
(
new
Context
());
kCtx
.
reset
(
new
Context
());
...
...
modules/dnn/src/vkcom/src/op_base.cpp
View file @
e63efe29
...
@@ -150,6 +150,7 @@ void OpBase::recordCommandBuffer(void* push_constants, size_t push_constants_siz
...
@@ -150,6 +150,7 @@ void OpBase::recordCommandBuffer(void* push_constants, size_t push_constants_siz
VkCommandBufferBeginInfo
beginInfo
=
{};
VkCommandBufferBeginInfo
beginInfo
=
{};
beginInfo
.
sType
=
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
;
beginInfo
.
sType
=
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
;
beginInfo
.
flags
=
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT
;
beginInfo
.
flags
=
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT
;
cv
::
AutoLock
lock
(
kContextMtx
);
VK_CHECK_RESULT
(
vkBeginCommandBuffer
(
cmd_buffer_
,
&
beginInfo
));
VK_CHECK_RESULT
(
vkBeginCommandBuffer
(
cmd_buffer_
,
&
beginInfo
));
if
(
push_constants
)
if
(
push_constants
)
vkCmdPushConstants
(
cmd_buffer_
,
pipeline_layout_
,
vkCmdPushConstants
(
cmd_buffer_
,
pipeline_layout_
,
...
@@ -176,7 +177,10 @@ void OpBase::runCommandBuffer()
...
@@ -176,7 +177,10 @@ void OpBase::runCommandBuffer()
fence_create_info_
.
flags
=
0
;
fence_create_info_
.
flags
=
0
;
VK_CHECK_RESULT
(
vkCreateFence
(
device_
,
&
fence_create_info_
,
NULL
,
&
fence
));
VK_CHECK_RESULT
(
vkCreateFence
(
device_
,
&
fence_create_info_
,
NULL
,
&
fence
));
VK_CHECK_RESULT
(
vkQueueSubmit
(
kQueue
,
1
,
&
submit_info
,
fence
));
{
cv
::
AutoLock
lock
(
kContextMtx
);
VK_CHECK_RESULT
(
vkQueueSubmit
(
kQueue
,
1
,
&
submit_info
,
fence
));
}
VK_CHECK_RESULT
(
vkWaitForFences
(
device_
,
1
,
&
fence
,
VK_TRUE
,
100000000000
));
VK_CHECK_RESULT
(
vkWaitForFences
(
device_
,
1
,
&
fence
,
VK_TRUE
,
100000000000
));
vkDestroyFence
(
device_
,
fence
,
NULL
);
vkDestroyFence
(
device_
,
fence
,
NULL
);
}
}
...
...
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