Commit 83ce18ef authored by Shucai Xiao's avatar Shucai Xiao
Browse files

clang format

parent f70710c8
...@@ -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")
......
...@@ -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)
{ {
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment