Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
8885e8ac
Commit
8885e8ac
authored
Nov 29, 2018
by
Shucai Xiao
Browse files
code cleanup according to comments from Paul.
parent
682ad83a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
35 deletions
+27
-35
src/targets/gpu/lowering.cpp
src/targets/gpu/lowering.cpp
+27
-35
No files found.
src/targets/gpu/lowering.cpp
View file @
8885e8ac
...
...
@@ -58,29 +58,29 @@ struct miopen_apply
void
init
()
{
add_miopen_simple_op
(
"relu"
,
miopen_relu
{}
,
make_relu
);
add_miopen_simple_op
(
"sigmoid"
,
miopen_sigmoid
{}
,
make_sigmoid
);
add_miopen_simple_op
(
"abs"
,
miopen_abs
{}
,
make_abs
);
add_miopen_simple_op
(
"tanh"
,
miopen_tanh
{}
,
make_tanh
);
add_miopen_extend_op
(
"
leaky_relu
"
,
miopen_
leaky_relu
{},
op
::
leaky_relu
{}
,
make_leaky_relu
);
add_miopen_extend_op
(
"elu"
,
miopen_elu
{}
,
op
::
elu
{}
,
make_elu
);
add_generic_op
(
"add"
,
hip_add
{}
);
add_generic_op
(
"sin"
,
hip_sin
{}
);
add_generic_op
(
"cos"
,
hip_cos
{}
);
add_generic_op
(
"tan"
,
hip_tan
{}
);
add_generic_op
(
"sinh"
,
hip_
sinh
{}
);
add_generic_op
(
"cosh"
,
hip_
cosh
{}
);
add_generic_op
(
"asin"
,
hip_
asin
{}
);
add_generic_op
(
"acos"
,
hip_
acos
{}
);
add_generic_op
(
"atan"
,
hip_
atan
{}
);
add_generic_op
(
"mul"
,
hip_mul
{}
);
add_extend_op
(
"dot"
,
miopen_gemm
{}
,
op
::
dot
{}
);
add_extend_op
(
"
contiguous
"
,
miopen_
contiguous
{},
op
::
contiguous
{}
);
add_extend_op
(
"concat"
,
hip_concat
{}
,
op
::
concat
{}
);
add_extend_op
(
"softmax"
,
miopen_softmax
{}
,
op
::
softmax
{}
);
add_miopen_simple_op
<
miopen_relu
>
(
"relu"
,
make_relu
);
add_miopen_simple_op
<
miopen_sigmoid
>
(
"sigmoid"
,
make_sigmoid
);
add_miopen_simple_op
<
miopen_abs
>
(
"abs"
,
make_abs
);
add_miopen_simple_op
<
miopen_tanh
>
(
"tanh"
,
make_tanh
);
add_miopen_extend_op
<
miopen_
leaky_relu
,
op
::
leaky_relu
>
(
"
leaky_relu
"
,
make_leaky_relu
);
add_miopen_extend_op
<
miopen_elu
,
op
::
elu
>
(
"elu"
,
make_elu
);
add_generic_op
<
hip_add
>
(
"add"
);
add_generic_op
<
hip_sin
>
(
"sin"
);
add_generic_op
<
hip_cos
>
(
"cos"
);
add_generic_op
<
hip_tan
>
(
"tan"
);
add_generic_op
<
hip_sinh
>
(
"
sinh
"
);
add_generic_op
<
hip_cosh
>
(
"
cosh
"
);
add_generic_op
<
hip_asin
>
(
"
asin
"
);
add_generic_op
<
hip_acos
>
(
"
acos
"
);
add_generic_op
<
hip_atan
>
(
"
atan
"
);
add_generic_op
<
hip_mul
>
(
"mul"
);
add_extend_op
<
miopen_gemm
,
op
::
dot
>
(
"dot"
);
add_extend_op
<
miopen_
contiguous
,
op
::
contiguous
>
(
"
contiguous
"
);
add_extend_op
<
hip_concat
,
op
::
concat
>
(
"concat"
);
add_extend_op
<
miopen_softmax
,
op
::
softmax
>
(
"softmax"
);
add_convolution_op
();
add_pooling_op
();
...
...
@@ -143,7 +143,7 @@ struct miopen_apply
}
template
<
class
T
>
void
add_generic_op
(
std
::
string
name
,
T
x
)
void
add_generic_op
(
std
::
string
name
)
{
apply_map
.
emplace
(
name
,
[
=
](
instruction_ref
ins
)
{
auto
output
=
insert_allocation
(
ins
,
ins
->
get_shape
());
...
...
@@ -152,11 +152,10 @@ struct miopen_apply
return
prog
->
replace_instruction
(
ins
,
T
{},
refs
);
});
(
void
)
x
;
}
template
<
class
T
,
class
Op
>
void
add_extend_op
(
std
::
string
name
,
T
x
,
Op
o
)
void
add_extend_op
(
std
::
string
name
)
{
apply_map
.
emplace
(
name
,
[
=
](
instruction_ref
ins
)
{
auto
&&
op
=
any_cast
<
Op
>
(
ins
->
get_operator
());
...
...
@@ -166,12 +165,10 @@ struct miopen_apply
return
prog
->
replace_instruction
(
ins
,
T
{
op
},
refs
);
});
(
void
)
x
;
(
void
)
o
;
}
template
<
class
T
,
class
Op
,
class
F
>
void
add_miopen_extend_op
(
std
::
string
name
,
T
x
,
Op
o
,
F
f
)
void
add_miopen_extend_op
(
std
::
string
name
,
F
f
)
{
apply_map
.
emplace
(
name
,
[
=
](
instruction_ref
ins
)
{
auto
&&
op
=
any_cast
<
Op
>
(
ins
->
get_operator
());
...
...
@@ -180,21 +177,16 @@ struct miopen_apply
auto
output
=
insert_allocation
(
ins
,
ins
->
get_shape
());
return
prog
->
replace_instruction
(
ins
,
T
{
std
::
move
(
ad
)},
ins
->
inputs
().
at
(
0
),
output
);
});
(
void
)
x
;
(
void
)
o
;
(
void
)
f
;
}
template
<
class
T
,
class
F
>
void
add_miopen_simple_op
(
std
::
string
name
,
T
x
,
F
f
)
void
add_miopen_simple_op
(
std
::
string
name
,
F
f
)
{
apply_map
.
emplace
(
name
,
[
=
](
instruction_ref
ins
)
{
auto
ad
=
f
();
auto
output
=
insert_allocation
(
ins
,
ins
->
get_shape
());
return
prog
->
replace_instruction
(
ins
,
T
{
std
::
move
(
ad
)},
ins
->
inputs
().
at
(
0
),
output
);
});
(
void
)
x
;
(
void
)
f
;
}
void
add_batch_norm_inference_op
()
...
...
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