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
8ab89b29
Commit
8ab89b29
authored
Aug 04, 2018
by
shssf
Committed by
Robert Kimball
Aug 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IntelGPU backend: Code refactored. No algo changed. (#1328)
parent
2b26df18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
75 deletions
+14
-75
intelgpu_op_batchnorm.cpp
src/ngraph/runtime/intelgpu/intelgpu_op_batchnorm.cpp
+4
-41
intelgpu_op_broadcast.cpp
src/ngraph/runtime/intelgpu/intelgpu_op_broadcast.cpp
+5
-34
intelgpu_op_custom_kernels.cpp
src/ngraph/runtime/intelgpu/intelgpu_op_custom_kernels.cpp
+0
-0
intelgpu_op_custom_kernels.hpp
src/ngraph/runtime/intelgpu/intelgpu_op_custom_kernels.hpp
+5
-0
No files found.
src/ngraph/runtime/intelgpu/intelgpu_op_batchnorm.cpp
View file @
8ab89b29
...
...
@@ -23,50 +23,13 @@
#include "ngraph/runtime/intelgpu/code_writer.hpp"
#include "ngraph/runtime/intelgpu/intelgpu_layout.hpp"
#include "ngraph/runtime/intelgpu/intelgpu_op_batchnorm.hpp"
#include "ngraph/runtime/intelgpu/intelgpu_op_custom_kernels.hpp"
#include "ngraph/op/batch_norm.hpp"
using
namespace
std
;
using
namespace
ngraph
;
static
vector
<
cldnn_arg
>
parameters_1inp_1out
=
{{
arg_input
,
0
},
{
arg_output
,
0
}};
static
vector
<
cldnn_arg
>
parameters_2inp_1out
=
{{
arg_input
,
0
},
{
arg_input
,
1
},
{
arg_output
,
0
}};
static
vector
<
cldnn_arg
>
parameters_5inp_1out
=
{{
arg_input
,
0
},
{
arg_input
,
1
},
{
arg_input
,
2
},
{
arg_input
,
3
},
{
arg_input
,
4
},
{
arg_output
,
0
}};
static
string
array_dims
(
const
Shape
&
dimentions
)
{
string
buffer
;
for
(
auto
const
&
dim
:
dimentions
)
{
buffer
+=
"["
+
to_string
(
dim
)
+
"]"
;
}
return
buffer
;
}
static
string
access_dims
(
const
Shape
&
dimentions
,
const
AxisSet
&
axis
=
{})
{
size_t
var_idx
=
0
;
string
buffer
;
for
(
auto
const
&
i
:
dimentions
)
{
if
(
axis
.
find
(
var_idx
)
==
axis
.
end
())
{
buffer
+=
"[i"
+
to_string
(
var_idx
)
+
"]"
;
}
++
var_idx
;
}
return
buffer
;
}
void
runtime
::
intelgpu
::
do_create_mean
(
cldnn
::
topology
&
topology
,
const
string
&
output_name
,
const
Shape
&
output_shape
,
...
...
@@ -138,7 +101,7 @@ void runtime::intelgpu::do_create_mean(cldnn::topology& topology,
{
input_name
},
{
writer
.
get_code
()},
entry_point_name
,
parameters_1inp_1out
,
get_kernel_args
(
1
,
1
)
,
""
,
layout
,
{
1
});
...
...
@@ -221,7 +184,7 @@ void runtime::intelgpu::do_create_variance(cldnn::topology& topology,
{
input_name
,
mean_name
},
{
writer
.
get_code
()},
entry_point_name
,
parameters_2inp_1out
,
get_kernel_args
(
2
,
1
)
,
""
,
layout
,
{
1
});
...
...
@@ -313,7 +276,7 @@ void runtime::intelgpu::do_batch_norm_operation(cldnn::topology& topology,
inputs
,
{
writer
.
get_code
()},
entry_point_name
,
parameters_5inp_1out
,
get_kernel_args
(
5
,
1
)
,
""
,
layout
,
{
1
});
...
...
src/ngraph/runtime/intelgpu/intelgpu_op_broadcast.cpp
View file @
8ab89b29
...
...
@@ -21,43 +21,13 @@
#include "ngraph/runtime/intelgpu/code_writer.hpp"
#include "ngraph/runtime/intelgpu/intelgpu_layout.hpp"
#include "ngraph/runtime/intelgpu/intelgpu_op_broadcast.hpp"
#include "ngraph/runtime/intelgpu/intelgpu_op_custom_kernels.hpp"
#include "ngraph/util.hpp"
using
namespace
std
;
using
namespace
ngraph
;
static
vector
<
cldnn_arg
>
parameters_1inp_1out
=
{{
arg_input
,
0
},
{
arg_output
,
0
}};
static
string
array_dims
(
const
Shape
&
dimentions
)
{
string
buffer
;
for
(
auto
const
&
dim
:
dimentions
)
{
buffer
+=
"["
+
to_string
(
dim
)
+
"]"
;
}
return
buffer
;
}
static
string
access_dims
(
const
Shape
&
dimentions
,
const
AxisSet
&
axis
=
{})
{
size_t
var_idx
=
0
;
string
buffer
;
for
(
auto
const
&
i
:
dimentions
)
{
if
(
axis
.
find
(
var_idx
)
==
axis
.
end
())
{
buffer
+=
"[i"
+
to_string
(
var_idx
)
+
"]"
;
}
++
var_idx
;
}
return
buffer
;
}
void
runtime
::
intelgpu
::
do_bcast_sum_operation_scalar
(
cldnn
::
topology
&
topology
,
const
string
&
input_name
,
const
Shape
&
input_shape
,
...
...
@@ -66,7 +36,8 @@ void runtime::intelgpu::do_bcast_sum_operation_scalar(cldnn::topology& topology,
const
element
::
Type
&
output_type
,
bool
is_bcast
)
{
const
string
function_name
=
is_bcast
?
"broadcast_scalar"
:
"sum_scalar"
;
string
function_name
=
is_bcast
?
"broadcast_scalar"
:
"sum_scalar"
;
function_name
+=
output_name
;
const
size_t
input_count
=
is_bcast
?
shape_size
<
Shape
>
(
output_shape
)
:
shape_size
<
Shape
>
(
input_shape
);
codegen
::
CodeWriter
writer
;
...
...
@@ -98,7 +69,7 @@ void runtime::intelgpu::do_bcast_sum_operation_scalar(cldnn::topology& topology,
{
input_name
},
{
writer
.
get_code
()},
function_name
,
parameters_1inp_1out
,
get_kernel_args
(
1
,
1
)
,
string
(
"-DCOUNT="
+
to_string
(
input_count
)),
layout
,
{
1
});
...
...
@@ -170,7 +141,7 @@ void runtime::intelgpu::do_bcast_sum_operation(cldnn::topology& topology,
{
input_name
},
{
writer
.
get_code
()},
function_name
,
parameters_1inp_1out
,
get_kernel_args
(
1
,
1
)
,
""
,
layout
,
{
1
});
...
...
src/ngraph/runtime/intelgpu/intelgpu_op_custom_kernels.cpp
View file @
8ab89b29
This diff is collapsed.
Click to expand it.
src/ngraph/runtime/intelgpu/intelgpu_op_custom_kernels.hpp
View file @
8ab89b29
...
...
@@ -69,6 +69,11 @@ namespace ngraph
const
std
::
string
&
output_name
,
const
Shape
&
output_shape
,
const
element
::
Type
&
output_type
);
// Helper functions used in cldnn::custom_gpu_primitive kernels
std
::
vector
<
cldnn_arg
>
get_kernel_args
(
size_t
input
,
size_t
output
);
std
::
string
array_dims
(
const
Shape
&
dimentions
);
std
::
string
access_dims
(
const
Shape
&
dimentions
,
const
AxisSet
&
axis
=
{});
}
}
}
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