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
9e1809d9
Commit
9e1809d9
authored
Mar 13, 2019
by
Sergey Shalnov
Committed by
Scott Cyphers
Mar 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IntelGPU backend: ReluBackprop operation fix for datatypes (#2605)
parent
a2df5c7c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
7 deletions
+85
-7
intelgpu_backend.cpp
src/ngraph/runtime/intelgpu/intelgpu_backend.cpp
+23
-7
intelgpu_op_custom_kernels.cpp
src/ngraph/runtime/intelgpu/intelgpu_op_custom_kernels.cpp
+52
-0
intelgpu_op_custom_kernels.hpp
src/ngraph/runtime/intelgpu/intelgpu_op_custom_kernels.hpp
+10
-0
No files found.
src/ngraph/runtime/intelgpu/intelgpu_backend.cpp
View file @
9e1809d9
...
...
@@ -1156,13 +1156,29 @@ shared_ptr<runtime::Executable>
{
arguments_check
(
op
,
2
,
1
);
const
cldnn_activation_additional_params
&
param
=
{
0.
f
,
0.
f
};
const
cldnn
::
activation_grad
cldnn_activ_grad
(
get_output_name
(
op
),
get_input_name
(
op
,
1
),
get_input_name
(
op
,
0
),
activation_grad_relu
,
param
);
topology
.
add
(
cldnn_activ_grad
);
if
(
get_input_type
(
op
)
!=
element
::
f32
||
get_input_type
(
op
,
1
)
!=
element
::
f32
||
get_output_type
(
op
)
!=
element
::
f32
||
get_output_shape
(
op
).
size
()
>
4
)
{
do_relu_backprop
(
topology
,
get_input_name
(
op
,
0
),
get_input_shape
(
op
,
0
),
get_input_type
(
op
,
0
),
get_input_name
(
op
,
1
),
get_input_shape
(
op
,
1
),
get_output_name
(
op
),
get_output_shape
(
op
),
get_output_type
(
op
));
}
else
{
const
cldnn_activation_additional_params
&
param
=
{
0.
f
,
0.
f
};
const
cldnn
::
activation_grad
cldnn_activ_grad
(
get_output_name
(
op
),
get_input_name
(
op
,
1
),
get_input_name
(
op
,
0
),
activation_grad_relu
,
param
);
topology
.
add
(
cldnn_activ_grad
);
}
break
;
}
case
OP_TYPEID
:
:
Abs
:
...
...
src/ngraph/runtime/intelgpu/intelgpu_op_custom_kernels.cpp
View file @
9e1809d9
...
...
@@ -1383,6 +1383,58 @@ void runtime::intelgpu::do_eltwise_kernel(cldnn::topology& topology,
topology
.
add
(
op_eltwise
);
}
void
runtime
::
intelgpu
::
do_relu_backprop
(
cldnn
::
topology
&
topology
,
const
string
&
input0_name
,
const
Shape
&
input0_shape
,
const
element
::
Type
&
input0_type
,
const
string
&
input1_name
,
const
Shape
&
input1_shape
,
const
string
&
output_name
,
const
Shape
&
output_shape
,
const
element
::
Type
&
output_type
)
{
const
cldnn
::
layout
layout
=
IntelGPULayout
::
create_cldnn_layout
(
output_type
,
output_shape
);
const
string
entry_point_name
=
"relubackprop_"
+
output_name
;
const
string
input0_type_name
=
get_opencl_type_name
(
input0_type
);
const
string
output_type_name
=
get_opencl_type_name
(
output_type
);
const
string
zero_input0_const
=
"convert_"
+
input0_type_name
+
"(0)"
;
const
string
zero_output_const
=
"convert_"
+
output_type_name
+
"(0)"
;
CodeWriter
writer
;
vector
<
size_t
>
gws
;
gen_func_def
(
writer
,
entry_point_name
,
{
2
,
input0_type_name
},
{
input0_shape
,
input1_shape
},
output_type_name
,
output_shape
);
writer
.
block_begin
();
{
// Main loops
gws
=
generate_loops
(
writer
,
output_shape
,
true
);
writer
<<
"output"
<<
access_dims
(
output_shape
)
<<
" = (input0"
<<
access_dims
(
input0_shape
)
<<
" > "
<<
zero_input0_const
<<
") ? input1"
<<
access_dims
(
input1_shape
)
<<
" : "
<<
zero_output_const
<<
";
\n
"
;
// Closing brackets for main loops
generate_loops
(
writer
,
output_shape
,
false
);
}
writer
.
block_end
();
const
cldnn
::
custom_gpu_primitive
op_reluback
(
output_name
,
{
input0_name
,
input1_name
},
{
writer
.
get_code
()},
entry_point_name
,
get_kernel_args
(
2
,
1
),
""
,
layout
,
gws
);
topology
.
add
(
op_reluback
);
}
void
runtime
::
intelgpu
::
do_reverse_operation
(
cldnn
::
topology
&
topology
,
const
string
&
input_name
,
const
Shape
&
input_shape
,
...
...
src/ngraph/runtime/intelgpu/intelgpu_op_custom_kernels.hpp
View file @
9e1809d9
...
...
@@ -144,6 +144,16 @@ namespace ngraph
const
std
::
string
&
operation
,
bool
function_operation
);
void
do_relu_backprop
(
cldnn
::
topology
&
topology
,
const
std
::
string
&
input0_name
,
const
Shape
&
input0_shape
,
const
element
::
Type
&
input0_type
,
const
std
::
string
&
input1_name
,
const
Shape
&
input1_shape
,
const
std
::
string
&
output_name
,
const
Shape
&
output_shape
,
const
element
::
Type
&
output_type
);
void
do_reverse_operation
(
cldnn
::
topology
&
topology
,
const
std
::
string
&
input_name
,
const
Shape
&
input_shape
,
...
...
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