Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
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
ngraph
Commits
c95bdf64
Commit
c95bdf64
authored
Dec 07, 2018
by
Sergey Shalnov
Committed by
Robert Kimball
Dec 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IntelGPU backend: Fix memory copy into zero tensors (#2192)
parent
125f7242
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
intelgpu_backend.cpp
src/ngraph/runtime/intelgpu/intelgpu_backend.cpp
+28
-2
No files found.
src/ngraph/runtime/intelgpu/intelgpu_backend.cpp
View file @
c95bdf64
...
...
@@ -139,6 +139,21 @@ static void arguments_check(const shared_ptr<Node>& op, size_t input, size_t out
}
}
static
void
memory_size_check
(
size_t
memory_size
,
const
shared_ptr
<
Node
>&
node
,
const
string
&
function_name
)
{
const
size_t
tensor_size
=
shape_size
(
node
->
get_shape
())
*
node
->
get_element_type
().
size
();
if
(
memory_size
!=
tensor_size
)
{
ostringstream
os
;
os
<<
"IntelGPU backend failed memory check. In
\"
"
<<
function_name
<<
"
\"
with Node
\"
"
<<
node
->
get_name
()
<<
"
\"
and "
<<
node
->
get_shape
()
<<
" mismatched memory sizes "
<<
tensor_size
<<
" and "
<<
memory_size
;
throw
invalid_argument
(
os
.
str
());
}
}
static
const
string
&
get_input_name
(
const
shared_ptr
<
Node
>&
op
,
size_t
num
=
0
)
{
return
op
->
get_inputs
().
at
(
num
).
get_tensor
().
get_name
();
...
...
@@ -1788,11 +1803,22 @@ bool runtime::intelgpu::IntelGPUBackend::call(shared_ptr<Function> func,
// we try to match them by index number in vectors.
for
(
size_t
i
=
0
;
i
<
func
->
get_output_size
();
i
++
)
{
const
shared_ptr
<
Node
>&
dst_node
=
func
->
get_output_op
(
i
);
const
size_t
dst_shape_size
=
shape_size
(
dst_node
->
get_shape
());
// We should not touch destination memory if it is not existed
if
(
!
dst_shape_size
)
{
continue
;
}
shared_ptr
<
runtime
::
intelgpu
::
IntelGPUTensorView
>
ngraph_res
=
static_pointer_cast
<
runtime
::
intelgpu
::
IntelGPUTensorView
>
(
outputs
[
i
]);
const
string
&
tensor_name
=
get_input_name
(
func
->
get_output_op
(
i
));
const
string
&
tensor_name
=
get_input_name
(
dst_node
);
auto
result_memory
=
result
.
at
(
tensor_name
).
get_memory
().
pointer
<
char
>
();
memory_size_check
(
result_memory
.
size
(),
dst_node
,
func
->
get_name
());
ngraph_res
->
write
(
result_memory
.
data
(),
0
,
result_memory
.
size
());
}
...
...
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