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
66e48e7e
Commit
66e48e7e
authored
Nov 26, 2018
by
Shucai Xiao
Browse files
clang format.
parent
fe29afc5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
28 deletions
+30
-28
src/targets/gpu/lowering.cpp
src/targets/gpu/lowering.cpp
+30
-28
No files found.
src/targets/gpu/lowering.cpp
View file @
66e48e7e
...
@@ -47,8 +47,7 @@ struct miopen_apply
...
@@ -47,8 +47,7 @@ struct miopen_apply
{
{
program
*
prog
=
nullptr
;
program
*
prog
=
nullptr
;
context
ctx
{};
context
ctx
{};
std
::
unordered_map
<
std
::
string
,
std
::
function
<
instruction_ref
(
instruction_ref
)
>>
std
::
unordered_map
<
std
::
string
,
std
::
function
<
instruction_ref
(
instruction_ref
)
>>
apply_map
{};
apply_map
{};
void
check_shape
(
shape
x
,
instruction_ref
i
)
void
check_shape
(
shape
x
,
instruction_ref
i
)
{
{
...
@@ -115,7 +114,8 @@ struct miopen_apply
...
@@ -115,7 +114,8 @@ struct miopen_apply
}
}
}
}
void
add_convolution_op
()
{
void
add_convolution_op
()
{
apply_map
.
emplace
(
"convolution"
,
[
=
](
instruction_ref
ins
)
{
apply_map
.
emplace
(
"convolution"
,
[
=
](
instruction_ref
ins
)
{
auto
&&
op
=
any_cast
<
op
::
convolution
>
(
ins
->
get_operator
());
auto
&&
op
=
any_cast
<
op
::
convolution
>
(
ins
->
get_operator
());
...
@@ -130,7 +130,8 @@ struct miopen_apply
...
@@ -130,7 +130,8 @@ struct miopen_apply
});
});
}
}
void
add_pooling_op
()
{
void
add_pooling_op
()
{
apply_map
.
emplace
(
"pooling"
,
[
=
](
instruction_ref
ins
)
{
apply_map
.
emplace
(
"pooling"
,
[
=
](
instruction_ref
ins
)
{
auto
&&
op
=
any_cast
<
op
::
pooling
>
(
ins
->
get_operator
());
auto
&&
op
=
any_cast
<
op
::
pooling
>
(
ins
->
get_operator
());
auto
pd
=
make_pooling
(
op
);
auto
pd
=
make_pooling
(
op
);
...
@@ -141,7 +142,7 @@ struct miopen_apply
...
@@ -141,7 +142,7 @@ struct miopen_apply
});
});
}
}
template
<
class
T
>
template
<
class
T
>
void
add_generic_op
(
std
::
string
name
,
T
x
)
void
add_generic_op
(
std
::
string
name
,
T
x
)
{
{
apply_map
.
emplace
(
name
,
[
=
](
instruction_ref
ins
)
{
apply_map
.
emplace
(
name
,
[
=
](
instruction_ref
ins
)
{
...
@@ -154,7 +155,7 @@ struct miopen_apply
...
@@ -154,7 +155,7 @@ struct miopen_apply
(
void
)
x
;
(
void
)
x
;
}
}
template
<
class
T
,
class
Op
>
template
<
class
T
,
class
Op
>
void
add_extend_op
(
std
::
string
name
,
T
x
,
Op
o
)
void
add_extend_op
(
std
::
string
name
,
T
x
,
Op
o
)
{
{
apply_map
.
emplace
(
name
,
[
=
](
instruction_ref
ins
)
{
apply_map
.
emplace
(
name
,
[
=
](
instruction_ref
ins
)
{
...
@@ -169,34 +170,35 @@ struct miopen_apply
...
@@ -169,34 +170,35 @@ struct miopen_apply
(
void
)
o
;
(
void
)
o
;
}
}
template
<
class
T
,
class
Op
,
class
F
>
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
,
T
x
,
Op
o
,
F
f
)
{
apply_map
.
emplace
(
name
,
[
=
](
instruction_ref
ins
)
{
apply_map
.
emplace
(
name
,
[
=
](
instruction_ref
ins
)
{
auto
&&
op
=
any_cast
<
Op
>
(
ins
->
get_operator
());
auto
&&
op
=
any_cast
<
Op
>
(
ins
->
get_operator
());
auto
ad
=
f
(
op
.
alpha
);
auto
ad
=
f
(
op
.
alpha
);
auto
output
=
insert_allocation
(
ins
,
ins
->
get_shape
());
auto
output
=
insert_allocation
(
ins
,
ins
->
get_shape
());
return
prog
->
replace_instruction
(
return
prog
->
replace_instruction
(
ins
,
T
{
std
::
move
(
ad
)},
ins
->
inputs
().
at
(
0
),
output
);
ins
,
T
{
std
::
move
(
ad
)},
ins
->
inputs
().
at
(
0
),
output
);
});
});
(
void
)
x
;
(
void
)
x
;
(
void
)
o
;
(
void
)
o
;
(
void
)
f
;
(
void
)
f
;
}
}
template
<
class
T
,
class
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
,
T
x
,
F
f
)
{
apply_map
.
emplace
(
name
,
[
=
](
instruction_ref
ins
)
{
apply_map
.
emplace
(
name
,
[
=
](
instruction_ref
ins
)
{
auto
ad
=
f
();
auto
ad
=
f
();
auto
output
=
insert_allocation
(
ins
,
ins
->
get_shape
());
auto
output
=
insert_allocation
(
ins
,
ins
->
get_shape
());
return
prog
->
replace_instruction
(
return
prog
->
replace_instruction
(
ins
,
T
{
std
::
move
(
ad
)},
ins
->
inputs
().
at
(
0
),
output
);
ins
,
T
{
std
::
move
(
ad
)},
ins
->
inputs
().
at
(
0
),
output
);
});
});
(
void
)
x
;
(
void
)
x
;
(
void
)
f
;
(
void
)
f
;
}
}
void
add_batch_norm_inference_op
()
{
void
add_batch_norm_inference_op
()
{
apply_map
.
emplace
(
"batch_norm_inference"
,
[
=
](
instruction_ref
ins
)
{
apply_map
.
emplace
(
"batch_norm_inference"
,
[
=
](
instruction_ref
ins
)
{
auto
&&
op
=
any_cast
<
op
::
batch_norm_inference
>
(
ins
->
get_operator
());
auto
&&
op
=
any_cast
<
op
::
batch_norm_inference
>
(
ins
->
get_operator
());
auto
output
=
insert_allocation
(
ins
,
ins
->
get_shape
());
auto
output
=
insert_allocation
(
ins
,
ins
->
get_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