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

Work in progress. Not working


Need to get this last bit resolving constants.

Either I break test const_of_empty_shape() alongside other tests (which are easily fixed)
and one of the literals has flipped lens and strides (len 0, strides 1) which doesn't make sense

Using scalar to broadcast causes a failure on checkshapes. Doesn't seem to make any
sense.
parent c297ce5f
...@@ -119,7 +119,8 @@ struct check_shapes ...@@ -119,7 +119,8 @@ struct check_shapes
if(begin != end) if(begin != end)
{ {
if(begin->max_lens().size() != n) if(begin->max_lens().size() != n)
MIGRAPHX_THROW(prefix() + "Only " + std::to_string(n) + "d supported"); MIGRAPHX_THROW(prefix() + "Only " + std::to_string(n) + "d supported " +
std::to_string(begin->max_lens().size()));
} }
return *this; return *this;
} }
......
...@@ -49,7 +49,7 @@ struct literal : raw_data<literal> ...@@ -49,7 +49,7 @@ struct literal : raw_data<literal>
* Empty literal with a specific shape type * Empty literal with a specific shape type
*/ */
explicit literal(shape::type_t shape_type) explicit literal(shape::type_t shape_type)
: m_shape(shape_type, {1}, {0}), buffer(make_shared_array<char>(m_shape.type_size())) : m_shape(shape_type, {1}, {}), buffer(make_shared_array<char>(m_shape.type_size()))
{ {
} }
......
...@@ -129,10 +129,11 @@ struct parse_if : op_parser<parse_if> ...@@ -129,10 +129,11 @@ struct parse_if : op_parser<parse_if>
assert(not(then_lens.empty() and else_lens.empty())); assert(not(then_lens.empty() and else_lens.empty()));
auto handle_empty_branch = [](module_ref& mdl, int index, const shape& out_shape) { auto handle_empty_branch = [](module_ref& mdl, int index, const shape& out_shape) {
auto scalar_ins = mdl->debug_print();
mdl->insert_instruction(std::prev(mdl->end()), auto scalar_ins = mdl->insert_instruction(
make_op("scalar", {{"out_lens", out_shape.lens()}}), mdl->begin(),
std::prev(mdl->end())); make_op("scalar", {{"scalar_bcst_dims", out_shape.lens()}}),
std::prev(mdl->end()));
auto broad_ins = mdl->insert_instruction( auto broad_ins = mdl->insert_instruction(
std::prev(mdl->end()), std::prev(mdl->end()),
make_op("multibroadcast", {{"out_lens", out_shape.lens()}}), make_op("multibroadcast", {{"out_lens", out_shape.lens()}}),
...@@ -185,9 +186,6 @@ struct parse_if : op_parser<parse_if> ...@@ -185,9 +186,6 @@ struct parse_if : op_parser<parse_if>
} }
} }
then_mdl->debug_print();
else_mdl->debug_print();
auto if_ret = info.add_instruction(make_op("if"), args, {then_mdl, else_mdl}); auto if_ret = info.add_instruction(make_op("if"), args, {then_mdl, else_mdl});
auto out_s = if_ret->get_shape(); auto out_s = if_ret->get_shape();
assert(out_s.type() == shape::tuple_type); assert(out_s.type() == shape::tuple_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