Commit 12d0915e authored by Paul's avatar Paul
Browse files

Formatting

parent c10e3bb9
......@@ -240,20 +240,16 @@ void find_matches(program& p, Ms&&... ms)
}
}
template<class M>
template <class M>
struct find_skip
{
M m;
M matcher() const
{
return m;
}
M matcher() const { return m; }
void apply(program&, matcher_result) const
{}
void apply(program&, matcher_result) const {}
};
template<class M>
template <class M>
find_skip<M> make_find_skip(M m)
{
return {m};
......@@ -330,7 +326,7 @@ const constexpr auto all_of = match_fold_f<lazy_and, true, true>{};
const constexpr auto any_of = match_fold_f<lazy_or, false, true>{};
const constexpr auto none_of = match_fold_f<lazy_or, false, false>{};
template<class... Ms>
template <class... Ms>
auto skip_matches(Ms... ms)
{
return make_find_skip(any_of(ms...));
......@@ -398,7 +394,7 @@ MIGRAPHX_PRED_MATCHER(is_constant, instruction_ref ins) { return ins->can_eval()
MIGRAPHX_BASIC_MATCHER(is_unused, matcher_context& ctx, instruction_ref ins)
{
if (ins->outputs().empty() and ins != std::prev(ctx.not_found()))
if(ins->outputs().empty() and ins != std::prev(ctx.not_found()))
return ins;
return ctx.not_found();
}
......
......@@ -56,11 +56,11 @@ struct find_mul_add
auto matcher() const
{
return match::name("mul")(match::either_arg(0, 1)(
match::name("add")(match::either_arg(0, 1)(
match::any().bind("x"),
match::any_of(conv_const_weights(), match::is_constant()).bind("y")),
match::none_of(match::args(match::is_constant(), match::is_constant()))
),
match::name("add")(
match::either_arg(0, 1)(
match::any().bind("x"),
match::any_of(conv_const_weights(), match::is_constant()).bind("y")),
match::none_of(match::args(match::is_constant(), match::is_constant()))),
match::is_constant().bind("a")));
}
......@@ -139,7 +139,12 @@ void simplify_algebra::apply(program& p) const
{
// Run simplifications multiple times
for(int i = 0; i < 4; i++)
match::find_matches(p, match::skip_matches(match::is_unused(), match::is_constant()), find_double_add_lit_broadcast{}, find_add_lit_broadcast{}, find_mul_conv{}, find_mul_add{});
match::find_matches(p,
match::skip_matches(match::is_unused(), match::is_constant()),
find_double_add_lit_broadcast{},
find_add_lit_broadcast{},
find_mul_conv{},
find_mul_add{});
}
} // namespace MIGRAPHX_INLINE_NS
......
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