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
83ce18ef
Commit
83ce18ef
authored
Apr 08, 2019
by
Shucai Xiao
Browse files
clang format
parent
f70710c8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
src/quantization.cpp
src/quantization.cpp
+2
-1
src/quantize_ins.cpp
src/quantize_ins.cpp
+10
-8
No files found.
src/quantization.cpp
View file @
83ce18ef
...
@@ -18,7 +18,8 @@ inline namespace MIGRAPHX_INLINE_NS {
...
@@ -18,7 +18,8 @@ inline namespace MIGRAPHX_INLINE_NS {
instruction_ref
convert_fp32_fp16
(
program
&
prog
,
instruction_ref
&
ins
)
instruction_ref
convert_fp32_fp16
(
program
&
prog
,
instruction_ref
&
ins
)
{
{
assert
(
ins
->
get_shape
().
type
()
==
shape
::
float_type
||
ins
->
get_shape
().
type
()
==
shape
::
double_type
);
assert
(
ins
->
get_shape
().
type
()
==
shape
::
float_type
||
ins
->
get_shape
().
type
()
==
shape
::
double_type
);
assert
(
ins
->
name
().
front
()
==
'@'
);
assert
(
ins
->
name
().
front
()
==
'@'
);
instruction_ref
ins_fp16
{};
instruction_ref
ins_fp16
{};
if
(
ins
->
name
()
==
"@literal"
)
if
(
ins
->
name
()
==
"@literal"
)
...
...
src/quantize_ins.cpp
View file @
83ce18ef
...
@@ -8,15 +8,18 @@
...
@@ -8,15 +8,18 @@
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
instruction_ref
insert_fp16
(
program
&
prog
,
instruction_ref
&
ins
,
shape
::
type_t
type
instruction_ref
std
::
unordered_map
<
instruction_ref
,
instruction_ref
>&
map_fp16
)
insert_fp16
(
program
&
prog
,
instruction_ref
&
ins
,
shape
::
type_t
type
std
::
unordered_map
<
instruction_ref
,
instruction_ref
>&
map_fp16
)
{
{
if
(
map_fp16
.
count
(
ins
)
>
0
)
if
(
map_fp16
.
count
(
ins
)
>
0
)
{
{
return
map_fp16
[
ins
];
return
map_fp16
[
ins
];
}
}
assert
(
ins
->
get_shape
().
type
()
==
shape
::
float_type
||
ins
->
get_shape
().
type
()
==
shape
::
double_type
);
assert
(
ins
->
get_shape
().
type
()
==
shape
::
float_type
||
ins
->
get_shape
().
type
()
==
shape
::
double_type
);
instruction_ref
ins_fp16
{};
instruction_ref
ins_fp16
{};
if
(
ins
==
std
::
prev
(
prog
.
end
()))
if
(
ins
==
std
::
prev
(
prog
.
end
()))
{
{
...
@@ -43,10 +46,10 @@ void quantize_ins(program& prog, const std::vector<std::string>& ins_names)
...
@@ -43,10 +46,10 @@ void quantize_ins(program& prog, const std::vector<std::string>& ins_names)
}
}
auto
inputs
=
ins
->
inputs
();
auto
inputs
=
ins
->
inputs
();
for
(
auto
input
:
inputs
)
for
(
auto
input
:
inputs
)
{
{
auto
s
=
input
->
get_shape
();
auto
s
=
input
->
get_shape
();
if
(
s
.
type
()
==
shape
::
float_type
||
s
.
type
()
==
shape
::
double_type
)
if
(
s
.
type
()
==
shape
::
float_type
||
s
.
type
()
==
shape
::
double_type
)
{
{
auto
input_fp16
=
insert_fp16
(
prog
,
input
,
s
.
type
(),
map_fp16
);
auto
input_fp16
=
insert_fp16
(
prog
,
input
,
s
.
type
(),
map_fp16
);
instruction
::
replace_argument
(
ins
,
input
,
input_fp16
,
false
);
instruction
::
replace_argument
(
ins
,
input
,
input_fp16
,
false
);
...
@@ -54,9 +57,8 @@ void quantize_ins(program& prog, const std::vector<std::string>& ins_names)
...
@@ -54,9 +57,8 @@ void quantize_ins(program& prog, const std::vector<std::string>& ins_names)
}
}
ins
->
recompute_ins_shape
();
ins
->
recompute_ins_shape
();
if
(
ins
->
get_shape
().
type
()
==
shape
::
half_type
)
if
(
ins
->
get_shape
().
type
()
==
shape
::
half_type
)
{
{
}
}
}
}
}
}
...
...
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