Commit 9d2f66e7 authored by Paul's avatar Paul
Browse files

Fix int8 issue in test

parent 8c196652
......@@ -131,6 +131,8 @@ struct MIGRAPHX_EXPORT shape
static std::string name(type_t t);
static std::string cpp_type(type_t t);
static bool is_integral(type_t t);
shape();
shape(type_t t);
shape(type_t t, std::vector<std::size_t> l);
......
......@@ -243,6 +243,14 @@ std::string shape::cpp_type(shape::type_t t)
}
MIGRAPHX_THROW("Invalid type");
}
bool shape::is_integral(shape::type_t t)
{
bool result = false;
visit(t, [&](auto as) {
result = as.is_integral();
});
return result;
}
shape::shape() : impl(shape_impl::default_shape()) {}
......
......@@ -1200,6 +1200,9 @@ struct find_div_const
auto ins = r.result;
auto c_ins = r.instructions["c"];
if(shape::is_integral(ins->get_shape().type()))
return;
auto recip = m.insert_instruction(std::next(c_ins), make_op("recip"), c_ins);
auto args = ins->inputs();
......
......@@ -36,9 +36,9 @@ struct test_block_reduce_small : verify_program<test_block_reduce_small<N, T>>
auto* mm = p.get_main_module();
migraphx::shape s{T, {2, N}};
auto x = mm->add_parameter("x", s);
auto y = mm->add_parameter("x", s);
auto y = mm->add_parameter("y", s);
auto two = mm->add_literal(migraphx::literal{migraphx::shape{s.type(), {1}}, {2}});
auto mul = migraphx::add_common_op(*mm, migraphx::make_op("mul"), {x, two});
auto mul = migraphx::add_common_op(*mm, migraphx::make_op("div"), {x, two});
auto r = mm->add_instruction(migraphx::make_op("reduce_sum", {{"axes", {1}}}), mul);
auto rb =
mm->add_instruction(migraphx::make_op("multibroadcast", {{"out_lens", s.lens()}}), r);
......
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