Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VkCV Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vulkan2021
VkCV Framework
Commits
915e0b90
Commit
915e0b90
authored
3 years ago
by
Lars Hoerttrich
Browse files
Options
Downloads
Patches
Plain Diff
[
#91
] small fixes, still not working
parent
0fcdae9d
No related branches found
No related tags found
1 merge request
!79
Draft: Resolve "Compute: First Network"
Pipeline
#26767
passed
3 years ago
Stage: build
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
projects/neural_network/src/main.cpp
+9
-4
9 additions, 4 deletions
projects/neural_network/src/main.cpp
src/vkcv/BufferManager.cpp
+5
-6
5 additions, 6 deletions
src/vkcv/BufferManager.cpp
with
14 additions
and
10 deletions
projects/neural_network/src/main.cpp
+
9
−
4
View file @
915e0b90
...
...
@@ -27,7 +27,8 @@ int main(int argc, const char** argv) {
);
int
input
[
64
]
=
{
0
};
vkcv
::
Buffer
<
int
>
inputBuffer
=
core
.
createBuffer
<
int
>
(
vkcv
::
BufferType
::
STORAGE
,
64
);
std
::
fill_n
(
input
,
64
,
2
);
vkcv
::
Buffer
<
int
>
inputBuffer
=
core
.
createBuffer
<
int
>
(
vkcv
::
BufferType
::
STORAGE
,
64
,
vkcv
::
BufferMemoryType
::
HOST_VISIBLE
);
inputBuffer
.
fill
(
input
);
vkcv
::
PassConfig
computePassDefinition
({});
...
...
@@ -64,7 +65,7 @@ int main(int argc, const char** argv) {
}
auto
cmdStream
=
core
.
createCommandStream
(
vkcv
::
QueueType
::
Compute
);
uint32_t
computeDispatchCount
[
3
]
=
{
inputBuffer
.
getSize
()
,
1
,
1
};
uint32_t
computeDispatchCount
[
3
]
=
{
64
,
1
,
1
};
vkcv
::
PushConstants
pushConstantsCompute
(
sizeof
(
int
));
pushConstantsCompute
.
appendDrawcall
(
1
);
...
...
@@ -76,9 +77,13 @@ int main(int argc, const char** argv) {
pushConstantsCompute
);
int
output
[
64
]
=
{
0
};
std
::
fill_n
(
output
,
64
,
-
1
);
core
.
readBufferMemoryBarrier
(
cmdStream
,
inputBuffer
.
getHandle
(),
&
output
);
core
.
submitCommandStream
(
cmdStream
);
std
::
cout
<<
output
<<
std
::
endl
;
std
::
cout
<<
"["
;
for
(
int
i
=
0
;
i
<
64
;
i
++
)
{
std
::
cout
<<
output
[
i
]
<<
", "
;
}
std
::
cout
<<
"]"
<<
std
::
endl
;
return
0
;
}
This diff is collapsed.
Click to expand it.
src/vkcv/BufferManager.cpp
+
5
−
6
View file @
915e0b90
...
...
@@ -350,9 +350,8 @@ namespace vkcv {
const
size_t
max_size
=
std
::
min
(
size
,
buffer
.
m_size
);
void
*
mapped
=
allocator
.
mapMemory
(
buffer
.
m_allocation
);
memcpy
(
data
,
reinterpret_cast
<
char
*>
(
mapped
)
,
max_size
);
memcpy
(
reinterpret_cast
<
int
*>
(
data
)
,
reinterpret_cast
<
char
*>
(
mapped
)
,
max_size
);
allocator
.
unmapMemory
(
buffer
.
m_allocation
);
}
void
BufferManager
::
readBufferMemoryBarrier
(
const
BufferHandle
&
handle
,
vk
::
CommandBuffer
cmdBuffer
,
void
*
data
)
{
...
...
@@ -376,8 +375,8 @@ namespace vkcv {
buffer
.
m_size
);
cmdBuffer
.
pipelineBarrier
(
vk
::
PipelineStageFlagBits
::
e
TopOfPipe
,
vk
::
PipelineStageFlagBits
::
e
BottomOfPipe
,
vk
::
PipelineStageFlagBits
::
e
ComputeShader
,
vk
::
PipelineStageFlagBits
::
e
Transfer
,
{},
nullptr
,
memoryBarrier
,
...
...
@@ -395,8 +394,8 @@ namespace vkcv {
buffer
.
m_size
);
cmdBuffer
.
pipelineBarrier
(
vk
::
PipelineStageFlagBits
::
eT
opOfPipe
,
vk
::
PipelineStageFlagBits
::
e
BottomOfPipe
,
vk
::
PipelineStageFlagBits
::
eT
ransfer
,
vk
::
PipelineStageFlagBits
::
e
Host
,
{},
nullptr
,
memoryBarrier2
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment