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
if(begin != end)
{
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;
}
......
......@@ -49,7 +49,7 @@ struct literal : raw_data<literal>
* Empty literal with a specific 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,9 +129,10 @@ struct parse_if : op_parser<parse_if>
assert(not(then_lens.empty() and else_lens.empty()));
auto handle_empty_branch = [](module_ref& mdl, int index, const shape& out_shape) {
auto scalar_ins =
mdl->insert_instruction(std::prev(mdl->end()),
make_op("scalar", {{"out_lens", out_shape.lens()}}),
mdl->debug_print();
auto scalar_ins = mdl->insert_instruction(
mdl->begin(),
make_op("scalar", {{"scalar_bcst_dims", out_shape.lens()}}),
std::prev(mdl->end()));
auto broad_ins = mdl->insert_instruction(
std::prev(mdl->end()),
......@@ -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 out_s = if_ret->get_shape();
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