Commit fad4da8a authored by Ted Themistokleous's avatar Ted Themistokleous
Browse files

Remove the use of add_outline and use literal instead

outline seems to be bugged, and going to be depreciated, thus switching to
creating a new literal with the proper shape for the empty output branch.
parent cd9560ed
...@@ -128,8 +128,9 @@ struct parse_if : op_parser<parse_if> ...@@ -128,8 +128,9 @@ struct parse_if : op_parser<parse_if>
} }
auto handle_empty_branch = [](module_ref& mdl, const shape& out_shape) { auto handle_empty_branch = [](module_ref& mdl, const shape& out_shape) {
auto outline_ins = mdl->add_outline(out_shape); shape gen_shape(out_shape.type(), out_shape.lens(), out_shape.strides());
mdl->replace_return({outline_ins}); auto literal_ins = mdl->add_literal(gen_shape, gen_shape.lens());
mdl->replace_return({literal_ins});
return out_shape.lens(); return out_shape.lens();
}; };
......
...@@ -2600,8 +2600,9 @@ TEST_CASE(if_then_empty_constant_test) ...@@ -2600,8 +2600,9 @@ TEST_CASE(if_then_empty_constant_test)
auto* then_mod = p.create_module("If_4_if"); auto* then_mod = p.create_module("If_4_if");
then_mod->add_literal(migraphx::shape::int64_type); then_mod->add_literal(migraphx::shape::int64_type);
auto outline = then_mod->add_outline(s); migraphx::shape gen_s{s.type(), s.lens(), s.strides()};
then_mod->add_return({outline}); auto then_lit = then_mod->add_literal(gen_s, gen_s.lens());
then_mod->add_return({then_lit});
auto* else_mod = p.create_module("If_4_else"); auto* else_mod = p.create_module("If_4_else");
auto re = else_mod->add_instruction(migraphx::make_op("mul"), y, l2); auto re = else_mod->add_instruction(migraphx::make_op("mul"), y, l2);
...@@ -2633,8 +2634,9 @@ TEST_CASE(if_else_empty_constant_test) ...@@ -2633,8 +2634,9 @@ TEST_CASE(if_else_empty_constant_test)
auto* else_mod = p.create_module("If_4_else"); auto* else_mod = p.create_module("If_4_else");
else_mod->add_literal(migraphx::shape::int64_type); else_mod->add_literal(migraphx::shape::int64_type);
auto outline = else_mod->add_outline(s); migraphx::shape gen_s{s.type(), s.lens(), s.strides()};
else_mod->add_return({outline}); auto else_lit = else_mod->add_literal(gen_s, gen_s.lens());
else_mod->add_return({else_lit});
auto ret = mm->add_instruction(migraphx::make_op("if"), {cond}, {then_mod, else_mod}); auto ret = mm->add_instruction(migraphx::make_op("if"), {cond}, {then_mod, else_mod});
auto r = mm->add_instruction(migraphx::make_op("get_tuple_elem", {{"index", 0}}), ret); auto r = mm->add_instruction(migraphx::make_op("get_tuple_elem", {{"index", 0}}), ret);
......
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